From 2a68df81e2ec36b543816d50624c2cd8111856d1 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 3 Jan 2024 13:09:55 +0200 Subject: [PATCH] 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. --- bootloader/bios/framebuffer.S | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/bootloader/bios/framebuffer.S b/bootloader/bios/framebuffer.S index 19d2261d..ad2fbe8c 100644 --- a/bootloader/bios/framebuffer.S +++ b/bootloader/bios/framebuffer.S @@ -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