summaryrefslogtreecommitdiffstats
path: root/src/arch/i386
diff options
context:
space:
mode:
authorMichael Brown2016-02-16 17:13:30 +0100
committerMichael Brown2016-02-16 20:32:32 +0100
commit44e05b0ffc2099ad51bcb9ff8c444d6a032c30da (patch)
tree3945f79be1b6aca9a9dbc135bff4e9a149f66088 /src/arch/i386
parent[bios] Use size_t when casting _text16_memsz and _data16_memsz (diff)
downloadipxe-44e05b0ffc2099ad51bcb9ff8c444d6a032c30da.tar.gz
ipxe-44e05b0ffc2099ad51bcb9ff8c444d6a032c30da.tar.xz
ipxe-44e05b0ffc2099ad51bcb9ff8c444d6a032c30da.zip
[bios] Allow relocate.c to be compiled for x86_64
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386')
-rw-r--r--src/arch/i386/core/relocate.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/arch/i386/core/relocate.c b/src/arch/i386/core/relocate.c
index 54ad387e..65a36e00 100644
--- a/src/arch/i386/core/relocate.c
+++ b/src/arch/i386/core/relocate.c
@@ -16,7 +16,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*
*/
extern char _max_align[];
-#define max_align ( ( unsigned int ) _max_align )
+#define max_align ( ( size_t ) _max_align )
/* Linker symbols */
extern char _textdata[];
@@ -44,8 +44,8 @@ extern char _etextdata[];
*/
__asmcall void relocate ( struct i386_all_regs *ix86 ) {
struct memory_map memmap;
- unsigned long start, end, size, padded_size, max;
- unsigned long new_start, new_end;
+ uint32_t start, end, size, padded_size, max;
+ uint32_t new_start, new_end;
unsigned i;
/* Get memory map and current location */
@@ -55,15 +55,15 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
size = ( end - start );
padded_size = ( size + max_align - 1 );
- DBG ( "Relocate: currently at [%lx,%lx)\n"
- "...need %lx bytes for %d-byte alignment\n",
+ DBG ( "Relocate: currently at [%x,%x)\n"
+ "...need %x bytes for %zd-byte alignment\n",
start, end, padded_size, max_align );
/* Determine maximum usable address */
max = MAX_ADDR;
if ( ix86->regs.ebp < max ) {
max = ix86->regs.ebp;
- DBG ( "Limiting relocation to [0,%lx)\n", max );
+ DBG ( "Limiting relocation to [0,%x)\n", max );
}
/* Walk through the memory map and find the highest address
@@ -72,7 +72,7 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
new_end = end;
for ( i = 0 ; i < memmap.count ; i++ ) {
struct memory_region *region = &memmap.regions[i];
- unsigned long r_start, r_end;
+ uint32_t r_start, r_end;
DBG ( "Considering [%llx,%llx)\n", region->start, region->end);
@@ -81,17 +81,17 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
* with using just 32-bit arithmetic after this stage.
*/
if ( region->start > max ) {
- DBG ( "...starts after max=%lx\n", max );
+ DBG ( "...starts after max=%x\n", max );
continue;
}
r_start = region->start;
if ( region->end > max ) {
- DBG ( "...end truncated to max=%lx\n", max );
+ DBG ( "...end truncated to max=%x\n", max );
r_end = max;
} else {
r_end = region->end;
}
- DBG ( "...usable portion is [%lx,%lx)\n", r_start, r_end );
+ DBG ( "...usable portion is [%x,%x)\n", r_start, r_end );
/* If we have rounded down r_end below r_ start, skip
* this block.
@@ -103,7 +103,7 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
/* Check that there is enough space to fit in iPXE */
if ( ( r_end - r_start ) < size ) {
- DBG ( "...too small (need %lx bytes)\n", size );
+ DBG ( "...too small (need %x bytes)\n", size );
continue;
}
@@ -128,7 +128,7 @@ __asmcall void relocate ( struct i386_all_regs *ix86 ) {
new_start += ( start - new_start ) & ( max_align - 1 );
new_end = new_start + size;
- DBG ( "Relocating from [%lx,%lx) to [%lx,%lx)\n",
+ DBG ( "Relocating from [%x,%x) to [%x,%x)\n",
start, end, new_start, new_end );
/* Let prefix know what to copy */