Make relocation code not trash potentially important registers

This commit is contained in:
Nero 2019-03-23 20:54:08 +00:00
parent 5becc89872
commit d54f8ac4b9
2 changed files with 17 additions and 12 deletions

View File

@ -12,7 +12,11 @@ main:
mov ax, 18
call malloc
ret
int 0x2E
.endloop:
hlt
jmp .endloop
%include "kernel/heap.asm"
%include "kernel/intr.asm"

23
nbp.asm
View File

@ -7,8 +7,12 @@ org 0x0000
; during PXE, CS=0000 and IP=7C00
_startup:
xor ax, ax
mov ss, ax
mov sp, 0x0000
push cx ; byte counter
push si ; source offset
push di ; destination offset
push es ; destination segment
mov ds, ax
mov es, ax
@ -16,16 +20,13 @@ _startup:
mov di, 0x0500
mov cx, (_reloc_end)
rep movsb
jmp 0x0050:main
_exit:
mov si, .message
call kprintf
.loop:
hlt
jmp .loop
.message:
db "Halted: Waiting for poweroff...", 0
pop es
pop di
pop si
pop cx
jmp 0x0050:main
%include "kernel/main.asm"