Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[lkrnprefix] Make real-mode setup code relocatable
The bzImage boot protocol allows the real-mode code to be loaded at
any segment within base memory.  (The fact that both iPXE and recent
versions of Syslinux will load the real-mode code at 1000:0000 is a
coincidence; it is not guaranteed by the specification.)

Fix by making the code relocatable.

Reported-by: Andrew Stuart <andrew@shopcusa.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed May 15, 2014
1 parent a8f037a commit f747a00
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/arch/i386/prefix/lkrnprefix.S
@@ -1,6 +1,5 @@
FILE_LICENCE ( GPL_ANY )

#define BZI_RM_SEGMENT 0x1000
#define BZI_LOAD_HIGH_ADDR 0x100000

.text
Expand Down Expand Up @@ -61,7 +60,7 @@ version:
realmode_swtch:
.long 0
start_sys:
.word BZI_RM_SEGMENT
.word 0
kernel_version:
.word version_string - 0x200
type_of_loader:
Expand Down Expand Up @@ -114,7 +113,9 @@ version_string:

setup:
/* Fix up code segment */
ljmp $BZI_RM_SEGMENT, $1f
pushw %ds
pushw $1f
lret
1:
/* Set up stack just below 0x7c00 and clear direction flag */
xorw %ax, %ax
Expand Down

0 comments on commit f747a00

Please sign in to comment.