Bootloader: Fix bootloader on bochs

Bochs int 0x10 seems to scrap full ebp and top bits in some
registers. I now save all 32-bit registers on call frame. Also
ebp is across all int 0x10 calls.
This commit is contained in:
Bananymous 2024-01-03 13:09:55 +02:00
parent 50ca2ac09e
commit 2a68df81e2
1 changed files with 6 additions and 14 deletions

View File

@ -57,11 +57,7 @@ vesa_scan_kernel_image:
# Find suitable video mode and save it in (vesa_target_mode)
vesa_find_video_mode:
pushw %ax
pushw %bx
pushw %cx
pushw %di
pushl %esi
pushal
pushl %ebp
movl %esp, %ebp
@ -87,7 +83,7 @@ vesa_find_video_mode:
# get vesa information
movw $0x4F00, %ax
movw $vesa_info_buffer, %di
int $0x10
pushl %ebp; int $0x10; popl %ebp # BOCHS doesn't seem to reserve ebp
cmpb $0x4F, %al; jne .vesa_unsupported
cmpb $0x00, %ah; jne .vesa_error
@ -109,7 +105,7 @@ vesa_find_video_mode:
movw $0x4F01, %ax
movw (%esi), %cx
movw $vesa_mode_info_buffer, %di
int $0x10
pushl %ebp; int $0x10; popl %ebp # BOCHS doesn't seem to reserve ebp
cmpb $0x4F, %al; jne .vesa_unsupported
cmpb $0x00, %ah; jne .vesa_error
@ -146,11 +142,7 @@ vesa_find_video_mode:
.vesa_find_video_mode_loop_modes_done:
leavel
popl %esi
popw %di
popw %cx
popw %bx
popw %ax
popal
ret
.vesa_unsupported:
@ -180,14 +172,14 @@ vesa_set_video_mode:
movw $0x4F02, %ax
orw $0x4000, %bx
int $0x10
pushl %ebp; int $0x10; popl %ebp # BOCHS doesn't seem to reserve ebp
jmp .set_video_done
.vesa_set_target_mode_generic:
movb $0x03, %al
movb $0x00, %ah
int $0x10
pushl %ebp; int $0x10; popl %ebp # BOCHS doesn't seem to reserve ebp
.set_video_done:
popw %bx