# HG changeset patch # User Deepa Srinivasan <deepas@xxxxxxxxxx> # Date 1226682073 21600 # Node ID c7f077a848cb4e80704450397f2f9bb300b9ee20 # Parent d175d293f2bff5bf882ef45286c973c094cfed1e [PATCH] kvm-userspace: ppc: Fix for guest load address From: Deepa Srinivasan <deepas@xxxxxxxxxx> Fix to ensure that guest test code is loaded at 1 MB. Signed-off-by: Deepa Srinivasan <deepas@xxxxxxxxxx> --- [diffstat] main-ppc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) [diff] diff -r d175d293f2bf -r c7f077a848cb user/main-ppc.c --- a/user/main-ppc.c Fri Nov 14 10:54:11 2008 -0600 +++ b/user/main-ppc.c Fri Nov 14 11:01:13 2008 -0600 @@ -62,6 +62,9 @@ struct vcpu_info { }; struct vcpu_info *vcpus; + +/* Load the guest binary at 1 MB since the flat.lds linker script sets the base address to this value. */ +#define VM_TEST_LOAD_ADDRESS 0x100000 static int test_debug(void *opaque, int vcpu) { @@ -241,9 +244,13 @@ static void *do_create_vcpu(void *_n) static void *do_create_vcpu(void *_n) { int n = (long)_n; + struct kvm_regs regs; kvm_create_vcpu(kvm, n); init_vcpu(n); + kvm_get_regs(kvm, n, ®s); + regs.pc = VM_TEST_LOAD_ADDRESS; + kvm_set_regs(kvm, n, ®s); kvm_run(kvm, n); sem_post(&exited_sem); return NULL; @@ -364,8 +371,8 @@ int main(int argc, char **argv) vm_mem = kvm_create_phys_mem(kvm, 0, memory_size, 0, 1); - len = load_file(vm_mem, argv[optind], 1); - sync_caches(vm_mem, len); + len = load_file(vm_mem + VM_TEST_LOAD_ADDRESS, argv[optind], 1); + sync_caches(vm_mem + VM_TEST_LOAD_ADDRESS, len); io_table_register(&mmio_table, 0xf0000000, 64, mmio_handler, NULL); -- To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html