[FREELDR] Add the relocator caller on realmode code (#8439)

CORE-19882
This commit is contained in:
Daniel Victor
2025-11-07 18:51:13 -03:00
committed by Hermès BÉLUSCA - MAÏTO
parent 16f9ad2f46
commit 3964c936cb
2 changed files with 23 additions and 9 deletions

View File

@@ -29,15 +29,18 @@ Startup:
mov byte ptr ds:[BSS_BootPartition], dh mov byte ptr ds:[BSS_BootPartition], dh
/* Setup a real mode stack */ /* Setup a real mode stack */
mov sp, word ptr ds:[stack16] mov sp, STACK16ADDR
/* Enable A20 address line */
call EnableA20
/* Relocate FreeLdr if necessary */
call RelocateFreeLdr
/* Output first status */ /* Output first status */
mov si, offset Msg_Starting mov si, offset Msg_Starting
call writestr call writestr
/* Enable A20 address line */
call EnableA20
/* Check the CPU */ /* Check the CPU */
call CheckFor64BitSupport call CheckFor64BitSupport
test al, al test al, al
@@ -361,12 +364,13 @@ CallbackTable:
.word PnpBiosGetDeviceNode .word PnpBiosGetDeviceNode
.word PnpBiosGetDockStationInformation .word PnpBiosGetDockStationInformation
/* 16-bit stack pointer */ /* 16-bit stack pointer (the code must change it to the current stack pointer later) */
stack16: stack16:
.word STACK16ADDR .word 0
#include "int386.inc" #include "int386.inc"
#include "relocator.inc"
#include "helpers.inc" #include "helpers.inc"
#include "pxe.inc" #include "pxe.inc"
#include "pnp.inc" #include "pnp.inc"

View File

@@ -25,11 +25,18 @@ RealModeEntryPoint:
mov ss, ax mov ss, ax
/* Setup the stack */ /* Setup the stack */
mov sp, word ptr ds:[stack16] mov sp, STACK16ADDR
/* Enable A20 address line */ /* Enable A20 address line */
call EnableA20 call EnableA20
/* Relocate FreeLdr if necessary */
call RelocateFreeLdr
/* Output first status */
mov si, offset Msg_Starting
call writestr
/* Save real mode entry point in shared memory */ /* Save real mode entry point in shared memory */
mov dword ptr ds:[BSS_RealModeEntry], offset switch_to_real16 mov dword ptr ds:[BSS_RealModeEntry], offset switch_to_real16
@@ -54,6 +61,8 @@ RealModeEntryPoint:
jmp exit_to_protected jmp exit_to_protected
Msg_Starting:
.ascii "Starting FreeLoader...", CR, LF, NUL
/* This is the entry point from protected mode */ /* This is the entry point from protected mode */
switch_to_real16: switch_to_real16:
@@ -143,9 +152,9 @@ CallbackTable:
.word PnpBiosGetDockStationInformation .word PnpBiosGetDockStationInformation
/* 16-bit stack pointer */ /* 16-bit stack pointer (the code must change it to the current stack pointer later) */
stack16: stack16:
.word STACK16ADDR .word 0
.align 4 /* force 4-byte alignment */ .align 4 /* force 4-byte alignment */
@@ -191,6 +200,7 @@ rmode_idtptr:
.long 0 /* Base Address */ .long 0 /* Base Address */
#include "int386.inc" #include "int386.inc"
#include "relocator.inc"
#if defined(SARCH_PC98) #if defined(SARCH_PC98)
#include "helpers_pc98.inc" #include "helpers_pc98.inc"
#else #else