Skip to content

Commit ba592af

Browse files
committed
[FREELDR] Add the relocator caller on realmode code (reactos#7530)
CORE-19882
1 parent bc10285 commit ba592af

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@ 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
39+
AfterRelocation:
3340

3441
/* Output first status */
3542
mov si, offset Msg_Starting
3643
call writestr
3744

38-
/* Enable A20 address line */
39-
call EnableA20
40-
4145
/* Check the CPU */
4246
call CheckFor64BitSupport
4347
test al, al
@@ -363,7 +367,7 @@ CallbackTable:
363367

364368
/* 16-bit stack pointer */
365369
stack16:
366-
.word STACK16ADDR
370+
.word 0
367371

368372

369373
#include "int386.inc"

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,19 @@ 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+
AfterRelocation:
36+
37+
/* Output first status */
38+
mov si, offset Msg_Starting
39+
call writestr
40+
3341
/* Save real mode entry point in shared memory */
3442
mov dword ptr ds:[BSS_RealModeEntry], offset switch_to_real16
3543

@@ -54,6 +62,8 @@ RealModeEntryPoint:
5462

5563
jmp exit_to_protected
5664

65+
Msg_Starting:
66+
.ascii "Starting FreeLoader...", CR, LF, NUL
5767

5868
/* This is the entry point from protected mode */
5969
switch_to_real16:
@@ -153,7 +163,7 @@ CallbackTable:
153163

154164
/* 16-bit stack pointer */
155165
stack16:
156-
.word STACK16ADDR
166+
.word 0
157167

158168

159169
.align 4 /* force 4-byte alignment */

0 commit comments

Comments
 (0)