Browse Source

[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>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
f747a00c54
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      src/arch/i386/prefix/lkrnprefix.S

+ 4
- 3
src/arch/i386/prefix/lkrnprefix.S View File

@@ -1,6 +1,5 @@
1 1
 FILE_LICENCE ( GPL_ANY )
2 2
 
3
-#define BZI_RM_SEGMENT 0x1000
4 3
 #define BZI_LOAD_HIGH_ADDR 0x100000
5 4
 
6 5
 	.text
@@ -61,7 +60,7 @@ version:
61 60
 realmode_swtch:
62 61
 	.long	0
63 62
 start_sys:
64
-	.word	BZI_RM_SEGMENT
63
+	.word	0
65 64
 kernel_version:
66 65
 	.word	version_string - 0x200
67 66
 type_of_loader:
@@ -114,7 +113,9 @@ version_string:
114 113
 
115 114
 setup:
116 115
 	/* Fix up code segment */
117
-	ljmp	$BZI_RM_SEGMENT, $1f
116
+	pushw	%ds
117
+	pushw	$1f
118
+	lret
118 119
 1:
119 120
 	/* Set up stack just below 0x7c00 and clear direction flag */
120 121
 	xorw	%ax, %ax

Loading…
Cancel
Save