Skip to content

Commit 3964c93

Browse files
iLauncherDevHBelusca
authored andcommitted
[FREELDR] Add the relocator caller on realmode code (reactos#8439)
CORE-19882
1 parent 16f9ad2 commit 3964c93

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

boot/freeldr/freeldr/arch/realmode/amd64.S

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ Startup:
2929
mov byte ptr ds:[BSS_BootPartition], dh
3030

3131
/* Setup a real mode stack */
32-
mov sp, word ptr ds:[stack16]
32+
mov sp, STACK16ADDR
33+
34+
/* Enable A20 address line */
35+
call EnableA20
36+
37+
/* Relocate FreeLdr if necessary */
38+
call RelocateFreeLdr
3339

3440
/* Output first status */
3541
mov si, offset Msg_Starting
3642
call writestr
3743

38-
/* Enable A20 address line */
39-
call EnableA20
40-
4144
/* Check the CPU */
4245
call CheckFor64BitSupport
4346
test al, al
@@ -361,12 +364,13 @@ CallbackTable:
361364
.word PnpBiosGetDeviceNode
362365
.word PnpBiosGetDockStationInformation
363366

364-
/* 16-bit stack pointer */
367+
/* 16-bit stack pointer (the code must change it to the current stack pointer later) */
365368
stack16:
366-
.word STACK16ADDR
369+
.word 0
367370

368371

369372
#include "int386.inc"
373+
#include "relocator.inc"
370374
#include "helpers.inc"
371375
#include "pxe.inc"
372376
#include "pnp.inc"

boot/freeldr/freeldr/arch/realmode/i386.S

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,18 @@ RealModeEntryPoint:
2525
mov ss, ax
2626

2727
/* Setup the stack */
28-
mov sp, word ptr ds:[stack16]
28+
mov sp, STACK16ADDR
2929

3030
/* Enable A20 address line */
3131
call EnableA20
3232

33+
/* Relocate FreeLdr if necessary */
34+
call RelocateFreeLdr
35+
36+
/* Output first status */
37+
mov si, offset Msg_Starting
38+
call writestr
39+
3340
/* Save real mode entry point in shared memory */
3441
mov dword ptr ds:[BSS_RealModeEntry], offset switch_to_real16
3542

@@ -54,6 +61,8 @@ RealModeEntryPoint:
5461

5562
jmp exit_to_protected
5663

64+
Msg_Starting:
65+
.ascii "Starting FreeLoader...", CR, LF, NUL
5766

5867
/* This is the entry point from protected mode */
5968
switch_to_real16:
@@ -143,9 +152,9 @@ CallbackTable:
143152
.word PnpBiosGetDockStationInformation
144153

145154

146-
/* 16-bit stack pointer */
155+
/* 16-bit stack pointer (the code must change it to the current stack pointer later) */
147156
stack16:
148-
.word STACK16ADDR
157+
.word 0
149158

150159

151160
.align 4 /* force 4-byte alignment */
@@ -191,6 +200,7 @@ rmode_idtptr:
191200
.long 0 /* Base Address */
192201

193202
#include "int386.inc"
203+
#include "relocator.inc"
194204
#if defined(SARCH_PC98)
195205
#include "helpers_pc98.inc"
196206
#else

0 commit comments

Comments
 (0)