#include #include #include #define SERIAL_PORT 0x70000000 #define DRAM_DEVICE 0 #define UART_DEVICE 1 void serial_write(char value) { *(char *)SERIAL_PORT = value; } void kernel_main(int hart, struct boot_args *args) { if (hart != 0) { return; } register_console_callback(serial_write); printk("webkernel version %s (Compiler %s, Linker %s) on %s\n", VERSION, COMPILER_NAME, LINKER_NAME, ARCH_NAME); printk("Command line: %s\n", args->cmd_line); printk("BIOS provided device map:\n"); struct device *root = args->devices; while (root != NULL) { printk("....Device at 0x%x to 0x%x is ", (uintptr_t)root->start, (uintptr_t)root->start + root->size ); switch(root->device_type) { case DRAM_DEVICE: printk("generic DRAM device, usable\n"); break; case UART_DEVICE: printk("Web OS UART character device, not ns16550a compatible, MMIO device\n"); break; default: printk("unknown\n"); } root = root->next; } } void panic(char *cause) { printk("PANIC: %s\n", cause); }