[PATCH 3/5] user: ppc: Fix guest load address

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

 



From: Deepa Srinivasan <deepas@xxxxxxxxxx>

Test cases must be loaded at 1 MB, their link address.

Signed-off-by: Deepa Srinivasan <deepas@xxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 user/main-ppc.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/user/main-ppc.c b/user/main-ppc.c
index 5fdf28e..71afc9e 100644
--- a/user/main-ppc.c
+++ b/user/main-ppc.c
@@ -63,6 +63,9 @@ struct vcpu_info {
 
 struct vcpu_info *vcpus;
 
+/* Must match flat.lds linker script */
+#define VM_TEST_LOAD_ADDRESS 0x100000
+
 static int test_debug(void *opaque, void *vcpu)
 {
 	printf("test_debug\n");
@@ -239,10 +242,16 @@ static void init_vcpu(int n)
 
 static void *do_create_vcpu(void *_n)
 {
+	struct kvm_regs regs;
 	int n = (long)_n;
 
 	kvm_create_vcpu(kvm, n);
 	init_vcpu(n);
+
+	kvm_get_regs(kvm, n, &regs);
+	regs.pc = VM_TEST_LOAD_ADDRESS;
+	kvm_set_regs(kvm, n, &regs);
+
 	kvm_run(kvm, n, &vcpus[n]);
 	sem_post(&exited_sem);
 	return NULL;
@@ -363,8 +372,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);
 
-- 
1.5.6.5

--
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

[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux