First pass for the following:
* adding sample function call * adding 4KB of stack space
This commit is contained in:
parent
5436a330c4
commit
0e05266313
26
loader.asm
26
loader.asm
@ -5,6 +5,27 @@ MAGIC_NUMBER equ 0x1BADB002
|
||||
FLAGS equ 0x0
|
||||
CHECKSUM equ -MAGIC_NUMBER
|
||||
|
||||
; example stuff
|
||||
A equ 3
|
||||
B equ 2
|
||||
C equ 1
|
||||
|
||||
; size in bytes
|
||||
KERNEL_STACK_SIZE equ 4096
|
||||
|
||||
; external labels(cdecl) calling convention
|
||||
extern sum
|
||||
|
||||
section .bss
|
||||
align 4 ; aligning to bytes for x86(32-bit) reasons
|
||||
; because this is the first thing we actually do (virual)address 0x00000000 will
|
||||
; contain 4KB of memory for our stack
|
||||
kernel_stack:
|
||||
resb KERNEL_STACK_SIZE ; reserver bytes instruction
|
||||
; point to what will be bottom of stack
|
||||
; which will grow down towards (virtual)address 0x00000000
|
||||
mov esp, kernel_stack + KERNEL_STACK_SIZE
|
||||
|
||||
section .text
|
||||
; align all instructions to 4 byte boundary by the x86 instruction set law
|
||||
align 4
|
||||
@ -15,6 +36,11 @@ align 4
|
||||
|
||||
loader:
|
||||
mov eax, 0X1234ABCD
|
||||
; call our external function
|
||||
push dword C
|
||||
push dword B
|
||||
push dword A
|
||||
call sum
|
||||
|
||||
.loop:
|
||||
jmp .loop
|
||||
|
Loading…
Reference in New Issue
Block a user