Skip to content

Commit c603820

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

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

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

Lines changed: 8 additions & 5 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
@@ -363,7 +366,7 @@ CallbackTable:
363366

364367
/* 16-bit stack pointer */
365368
stack16:
366-
.word STACK16ADDR
369+
.word 0
367370

368371

369372
#include "int386.inc"

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

Lines changed: 11 additions & 2 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:
@@ -153,7 +162,7 @@ CallbackTable:
153162

154163
/* 16-bit stack pointer */
155164
stack16:
156-
.word STACK16ADDR
165+
.word 0
157166

158167

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

0 commit comments

Comments
 (0)