Commit dd9209b7 by triazo

Add multiboot header and test read some info

parent 09b732fe
Showing with 17 additions and 5 deletions
......@@ -56,6 +56,9 @@ _start:
; our stack (as it grows downwards).
mov esp, stack_top
push eax ; Multiboot magic number
push ebx ; Multiboot info struct
; We are now ready to actually execute C code. We cannot embed that in an
; assembly file, so we'll create a kernel.c file in a moment. In that file,
; we'll create a C entry point called kernel_main and call it here.
......
#include <stdbool.h> /* C doesn't have booleans by default. */
/*
kern.c is where the c code starts, as invoked by our heading
assembly. It should only contain high level code
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
......@@ -9,11 +14,10 @@
#include "gdt.h"
#include "idt.h"
#include "test.h"
#include "multiboot.h"
#if defined(__cplusplus)
extern "C" /* Use C linkage for kernel_main. */
#endif
void kernel_main()
// The parameters passed here ultimately come through the bootloader
void kernel_main(multiboot_info* mbd, uint32_t magic)
{
/* Initialize terminal and serial interfaces */
terminal_initialize();
......@@ -29,6 +33,11 @@ void kernel_main()
terminal_writestring("Hello, kernel World!\n");
//serial_writestring("Second Serial Test\n");
serial_hexstring(&magic, 4);
serial_writestring("\n");
serial_hexstring(&(mbd->flags), 8);
serial_writestring("\n");
// Enable paging of memory. For now there is only one virtual
// memory space defined by page_dir
page_directory_entry* page_dir;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment