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

Loading…
Cancel
Save