qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 2/2] spapr: -kernel: allow linking with specifie


From: Andrew Jones
Subject: [Qemu-devel] [RFC PATCH 2/2] spapr: -kernel: allow linking with specified addr
Date: Fri, 17 Jul 2015 13:56:40 +0200

I've started playing with adding ppc support to kvm-unit-tests,
using spapr for the machine model. I wanted to link the unit test
at 0x400000 to match qemu's load address, making the unit test
startup code simpler, but ended up with 0x800000 instead, due to
how translate_kernel_address works. The translation makes sense
for how Linux kernels are linked (always at 0xc0000000 or
0xc000000000000000), but for the unit test case we need to avoid
adding the offset.

Signed-off-by: Andrew Jones <address@hidden>
---
Big RFC because I don't know if the "always at 0xc..." statement
is 100% true for Linux, nor if this patch would break other stuff...

 hw/ppc/spapr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index c1cbf3387ae0c..4f1548f5168db 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -832,6 +832,9 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr,
 
 static uint64_t translate_kernel_address(void *opaque, uint64_t addr)
 {
+    if ((addr & 0x0fffffff) == addr) {
+        return addr;
+    }
     return (addr & 0x0fffffff) + KERNEL_LOAD_ADDR;
 }
 
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]