|
@@ -32,12 +32,12 @@ extern char _etextdata[];
|
32
|
32
|
#define MAX_ADDR (0xfff00000UL)
|
33
|
33
|
|
34
|
34
|
/**
|
35
|
|
- * Relocate Etherboot
|
|
35
|
+ * Relocate iPXE
|
36
|
36
|
*
|
37
|
37
|
* @v ix86 x86 register dump from prefix
|
38
|
38
|
* @ret ix86 x86 registers to return to prefix
|
39
|
39
|
*
|
40
|
|
- * This finds a suitable location for Etherboot near the top of 32-bit
|
|
40
|
+ * This finds a suitable location for iPXE near the top of 32-bit
|
41
|
41
|
* address space, and returns the physical address of the new location
|
42
|
42
|
* to the prefix in %edi.
|
43
|
43
|
*/
|
|
@@ -59,11 +59,7 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
|
59
|
59
|
start, end, padded_size, max_align );
|
60
|
60
|
|
61
|
61
|
/* Walk through the memory map and find the highest address
|
62
|
|
- * below 4GB that etherboot will fit into. Ensure etherboot
|
63
|
|
- * lies entirely within a range with A20=0. This means that
|
64
|
|
- * even if something screws up the state of the A20 line, the
|
65
|
|
- * etherboot code is still visible and we have a chance to
|
66
|
|
- * diagnose the problem.
|
|
62
|
+ * below 4GB that iPXE will fit into.
|
67
|
63
|
*/
|
68
|
64
|
new_end = end;
|
69
|
65
|
for ( i = 0 ; i < memmap.count ; i++ ) {
|
|
@@ -87,42 +83,6 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
|
87
|
83
|
} else {
|
88
|
84
|
r_end = region->end;
|
89
|
85
|
}
|
90
|
|
-
|
91
|
|
- /* Shrink the range down to use only even megabytes
|
92
|
|
- * (i.e. A20=0).
|
93
|
|
- */
|
94
|
|
- if ( ( r_end - 1 ) & 0x100000 ) {
|
95
|
|
- /* If last byte that might be used (r_end-1)
|
96
|
|
- * is in an odd megabyte, round down r_end to
|
97
|
|
- * the top of the next even megabyte.
|
98
|
|
- *
|
99
|
|
- * Make sure that we don't accidentally wrap
|
100
|
|
- * r_end below 0.
|
101
|
|
- */
|
102
|
|
- if ( r_end >= 1 ) {
|
103
|
|
- r_end = ( r_end - 1 ) & ~0xfffff;
|
104
|
|
- DBG ( "...end truncated to %lx "
|
105
|
|
- "(avoid ending in odd megabyte)\n",
|
106
|
|
- r_end );
|
107
|
|
- }
|
108
|
|
- } else if ( ( r_end - size ) & 0x100000 ) {
|
109
|
|
- /* If the last byte that might be used
|
110
|
|
- * (r_end-1) is in an even megabyte, but the
|
111
|
|
- * first byte that might be used (r_end-size)
|
112
|
|
- * is an odd megabyte, round down to the top
|
113
|
|
- * of the next even megabyte.
|
114
|
|
- *
|
115
|
|
- * Make sure that we don't accidentally wrap
|
116
|
|
- * r_end below 0.
|
117
|
|
- */
|
118
|
|
- if ( r_end >= 0x100000 ) {
|
119
|
|
- r_end = ( r_end - 0x100000 ) & ~0xfffff;
|
120
|
|
- DBG ( "...end truncated to %lx "
|
121
|
|
- "(avoid starting in odd megabyte)\n",
|
122
|
|
- r_end );
|
123
|
|
- }
|
124
|
|
- }
|
125
|
|
-
|
126
|
86
|
DBG ( "...usable portion is [%lx,%lx)\n", r_start, r_end );
|
127
|
87
|
|
128
|
88
|
/* If we have rounded down r_end below r_ start, skip
|
|
@@ -133,19 +93,19 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
|
133
|
93
|
continue;
|
134
|
94
|
}
|
135
|
95
|
|
136
|
|
- /* Check that there is enough space to fit in Etherboot */
|
|
96
|
+ /* Check that there is enough space to fit in iPXE */
|
137
|
97
|
if ( ( r_end - r_start ) < size ) {
|
138
|
98
|
DBG ( "...too small (need %lx bytes)\n", size );
|
139
|
99
|
continue;
|
140
|
100
|
}
|
141
|
101
|
|
142
|
|
- /* If the start address of the Etherboot we would
|
|
102
|
+ /* If the start address of the iPXE we would
|
143
|
103
|
* place in this block is higher than the end address
|
144
|
104
|
* of the current highest block, use this block.
|
145
|
105
|
*
|
146
|
106
|
* Note that this avoids overlaps with the current
|
147
|
|
- * Etherboot, as well as choosing the highest of all
|
148
|
|
- * viable blocks.
|
|
107
|
+ * iPXE, as well as choosing the highest of all viable
|
|
108
|
+ * blocks.
|
149
|
109
|
*/
|
150
|
110
|
if ( ( r_end - size ) > new_end ) {
|
151
|
111
|
new_end = r_end;
|
|
@@ -153,7 +113,7 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
|
153
|
113
|
}
|
154
|
114
|
}
|
155
|
115
|
|
156
|
|
- /* Calculate new location of Etherboot, and align it to the
|
|
116
|
+ /* Calculate new location of iPXE, and align it to the
|
157
|
117
|
* required alignemnt.
|
158
|
118
|
*/
|
159
|
119
|
new_start = new_end - padded_size;
|