Fix jumping into 32-bit kernels

This commit is contained in:
Pierre Pronchery 2019-04-27 18:06:45 +02:00
parent b7418ac857
commit 3722889d66

View File

@ -7,6 +7,19 @@
#include "multiboot/header.S" #include "multiboot/header.S"
/* macros */
#ifdef DEBUG
# define DEBUG_STRING(s) \
pusha; \
push s; \
call puts; \
pop s; \
popa;
#else
# define DEBUG_STRING(s)
#endif
/* sections */ /* sections */
/* text */ /* text */
.section .text .section .text
@ -15,20 +28,16 @@
.type multiboot_boot_kernel32, @function .type multiboot_boot_kernel32, @function
multiboot_boot_kernel32: multiboot_boot_kernel32:
/* jump into the 32-bit kernel */ /* jump into the 32-bit kernel */
#if 0
mov 0x4(%esp), %ebx mov 0x4(%esp), %ebx
mov 0x8(%esp), %eax mov 0x8(%esp), %ecx
call *%eax #ifdef DEBUG
ret mov 0x10(%ebx), %eax
#else DEBUG_STRING(%eax)
push %ebp mov 0x40(%ebx), %eax
mov %esp, %ebp DEBUG_STRING(%eax)
#endif
mov 0x8(%ebp), %ebx
mov 0xc(%ebp), %ecx
mov $BOOT_MULTIBOOT_LOADER_MAGIC, %eax mov $BOOT_MULTIBOOT_LOADER_MAGIC, %eax
jmp *%ecx jmp *%ecx
#endif
.global multiboot_boot_kernel64 .global multiboot_boot_kernel64