Setup stack bottom

This commit is contained in:
Mathieu Maret 2018-07-26 12:25:43 +02:00
parent 05c78e5e0c
commit a9c01aefda
2 changed files with 3 additions and 0 deletions

View File

@ -1,3 +1,4 @@
; c.f. https://www.gnu.org/software/grub/manual/multiboot/multiboot.html#OS-image-format
; Declare constants for the multiboot header. ; Declare constants for the multiboot header.
MBALIGN equ 1 << 0 ; align loaded modules on page boundaries MBALIGN equ 1 << 0 ; align loaded modules on page boundaries
MEMINFO equ 1 << 1 ; provide memory map MEMINFO equ 1 << 1 ; provide memory map
@ -54,6 +55,7 @@ _start:
; stack (as it grows downwards on x86 systems). This is necessarily done ; stack (as it grows downwards on x86 systems). This is necessarily done
; in assembly as languages such as C cannot function without a stack. ; in assembly as languages such as C cannot function without a stack.
mov esp, stack_top mov esp, stack_top
mov ebp, stack_bottom
; This is a good place to initialize crucial processor state before the ; This is a good place to initialize crucial processor state before the
; high-level kernel is entered. It's best to minimize the early ; high-level kernel is entered. It's best to minimize the early

1
boot.s
View File

@ -64,6 +64,7 @@ _start:
in assembly as languages such as C cannot function without a stack. in assembly as languages such as C cannot function without a stack.
*/ */
mov $stack_top, %esp mov $stack_top, %esp
mov $stack_bottom, %ebp
/* /*
This is a good place to initialize crucial processor state before the This is a good place to initialize crucial processor state before the