aboutsummaryrefslogtreecommitdiffstats
path: root/src/shadow.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-07-04 15:29:23 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-07-04 15:29:23 -0400
commite3677b12f8895c062bcd7e2a4b82963f7a62ca00 (patch)
treec0cd39deae6bc34d0891eb1c3a4713b48f37a21a /src/shadow.c
parentd43fcd300aaa7b33b6cc0f06c74a3ef01863264d (diff)
downloadseabios-e3677b12f8895c062bcd7e2a4b82963f7a62ca00.tar.gz
Define 16bit OFFSET_x to be 32bit addresses; introduce CONFIG_BIOS_ADDR.
The rom16.o object will now have absolute (32bit applicable) addresses. Replace several 0xf0000 and 0x10000 uses with CONFIG_BIOS_ADDR/SIZE macros.
Diffstat (limited to 'src/shadow.c')
-rw-r--r--src/shadow.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shadow.c b/src/shadow.c
index b9457c55..730dc53c 100644
--- a/src/shadow.c
+++ b/src/shadow.c
@@ -24,7 +24,8 @@ copy_bios(PCIDevice d)
int v = pci_config_readb(d, 0x59);
v |= 0x30;
pci_config_writeb(d, 0x59, v);
- memcpy((void *)0x000f0000, (void *)BUILD_BIOS_TMP_ADDR, 0x10000);
+ memcpy((void *)BUILD_BIOS_ADDR, (void *)BUILD_BIOS_TMP_ADDR
+ , BUILD_BIOS_SIZE);
}
// Make the BIOS code segment area (0xf0000) writable.
@@ -45,14 +46,15 @@ make_bios_writable()
}
// Copy the bios to a temporary area.
- memcpy((void *)BUILD_BIOS_TMP_ADDR, (void *)0x000f0000, 0x10000);
+ memcpy((void *)BUILD_BIOS_TMP_ADDR, (void *)BUILD_BIOS_ADDR
+ , BUILD_BIOS_SIZE);
// Enable shadowing and copy bios.
- if (IN_RANGE((u32)copy_bios, 0xf0000, 0x10000)) {
+ if (IN_RANGE((u32)copy_bios, BUILD_BIOS_ADDR, BUILD_BIOS_SIZE)) {
// Jump to shadow enable function - use the copy in the
// temporary storage area so that memory does not change under
// the executing code.
- u32 pos = (u32)copy_bios - 0xf0000 + BUILD_BIOS_TMP_ADDR;
+ u32 pos = (u32)copy_bios - BUILD_BIOS_ADDR + BUILD_BIOS_TMP_ADDR;
void (*func)(PCIDevice) = (void*)pos;
func(d);
} else {
@@ -60,7 +62,7 @@ make_bios_writable()
}
// Clear the temporary area.
- memset((void *)BUILD_BIOS_TMP_ADDR, 0, 0x10000);
+ memset((void *)BUILD_BIOS_TMP_ADDR, 0, BUILD_BIOS_SIZE);
}
// Make the BIOS code segment area (0xf0000) read-only.