aboutsummaryrefslogtreecommitdiffstats
path: root/src/fw/shadow.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-11-10 13:47:56 -0500
committerKevin O'Connor <kevin@koconnor.net>2018-11-10 13:47:56 -0500
commit693a88eaa802e8d14c44cba1bb2d1c593eec1647 (patch)
treef8e2e4d7388e3aeb2d9073d18728d30e1313fc3e /src/fw/shadow.c
parentb44803247cfc86b38106049a2c5349548ca054df (diff)
downloadseabios-693a88eaa802e8d14c44cba1bb2d1c593eec1647.tar.gz
shadow: Rework bios copy code to prevent gcc array-bounds warning
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/fw/shadow.c')
-rw-r--r--src/fw/shadow.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/fw/shadow.c b/src/fw/shadow.c
index 987eaf4a..4c627a8f 100644
--- a/src/fw/shadow.c
+++ b/src/fw/shadow.c
@@ -173,9 +173,9 @@ qemu_reboot(void)
return;
// QEMU doesn't map 0xc0000-0xfffff back to the original rom on a
// reset, so do that manually before invoking a hard reset.
- void *cstart = VSYMBOL(code32flat_start), *cend = VSYMBOL(code32flat_end);
- void *hrp = &HaveRunPost;
- if (readl(hrp + BIOS_SRC_OFFSET)) {
+ void *flash = (void*)BIOS_SRC_OFFSET;
+ u32 hrp = (u32)&HaveRunPost;
+ if (readl(flash + hrp)) {
// There isn't a pristine copy of the BIOS at 0xffff0000 to copy
if (HaveRunPost == 3) {
// In a reboot loop. Try to shutdown the machine instead.
@@ -187,8 +187,9 @@ qemu_reboot(void)
} else {
// Copy the BIOS making sure to only reset HaveRunPost at end
make_bios_writable();
- memcpy(cstart, cstart + BIOS_SRC_OFFSET, hrp - cstart);
- memcpy(hrp + 4, hrp + 4 + BIOS_SRC_OFFSET, cend - (hrp + 4));
+ u32 cstart = SYMBOL(code32flat_start), cend = SYMBOL(code32flat_end);
+ memcpy((void*)cstart, flash + cstart, hrp - cstart);
+ memcpy((void*)hrp + 4, flash + hrp + 4, cend - (hrp + 4));
barrier();
HaveRunPost = 0;
barrier();