gets the memory map from GRUB
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
; We set up some parameters and then pass the execution to our kmain
|
||||
|
||||
global loader ; entry symbol for ELF
|
||||
extern kmain
|
||||
extern _main
|
||||
|
||||
MAGIC_NUMBER equ 0x1BADB002 ; magic number constant
|
||||
FLAGS equ 0x3
|
||||
@ -30,7 +30,10 @@ section .text
|
||||
loader:
|
||||
mov esp, kernel_stack + KERNEL_STACK_SIZE ; move the top of the stack into esp
|
||||
|
||||
call kmain ; pass execution over to our kmain function, where all of the real stuff is done
|
||||
push eax
|
||||
push ebx
|
||||
|
||||
call _main ; pass execution over to our _main function, where all of the real stuff is done
|
||||
|
||||
; Should the system exit, we clear the interrupt flag
|
||||
; and do an infinite loop of nothing
|
||||
|
@ -19,6 +19,7 @@ SECTIONS
|
||||
*/
|
||||
.text BLOCK(4K) : ALIGN(4K) /* The first section we want is the text section, this is where most code is */
|
||||
{
|
||||
text_start = .;
|
||||
*(.multiboot) /* Multiboot needs to be early in the file, required by grub */
|
||||
*(.text) /* The text section */
|
||||
}
|
||||
@ -33,12 +34,16 @@ SECTIONS
|
||||
.data BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.data)
|
||||
end_data = .;
|
||||
}
|
||||
|
||||
/* BSS */
|
||||
.bss BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
sbss = .;
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
ebss = .;
|
||||
endkernel = .;
|
||||
}
|
||||
}
|
||||
|
6
kernel/arch/paging.c
Normal file
6
kernel/arch/paging.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdint.h>
|
||||
|
||||
extern uint32_t endkernel; // found in link.ld
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user