From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36540) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBjVc-0002c1-Fz for qemu-devel@nongnu.org; Tue, 20 Aug 2013 06:50:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBjVS-0001pb-Jc for qemu-devel@nongnu.org; Tue, 20 Aug 2013 06:49:56 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:55430) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBjVR-0001oR-Ql for qemu-devel@nongnu.org; Tue, 20 Aug 2013 06:49:46 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Aug 2013 16:13:17 +0530 From: "Aneesh Kumar K.V" Date: Tue, 20 Aug 2013 16:19:23 +0530 Message-Id: <1376995766-16526-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> In-Reply-To: <1376995766-16526-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1376995766-16526-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH -V2 1/4] target-ppc: Update slb array with correct index values. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , Alexey Kardashevskiy Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, "Aneesh Kumar K.V" From: "Aneesh Kumar K.V" Without this, a value of rb=0 and rs=0 results in replacing the 0th index. This can be observed when using gdb remote debugging support. (gdb) x/10i do_fork 0xc000000000085330 : Cannot access memory at address 0xc000000000085330 (gdb) This is because when we do the slb sync via kvm_cpu_synchronize_state, we overwrite the slb entry (0th entry) for 0xc000000000085330 Signed-off-by: Aneesh Kumar K.V --- target-ppc/kvm.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 30a870e..a629447 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -1034,8 +1034,18 @@ int kvm_arch_get_registers(CPUState *cs) /* Sync SLB */ #ifdef TARGET_PPC64 for (i = 0; i < 64; i++) { - ppc_store_slb(env, sregs.u.s.ppc64.slb[i].slbe, - sregs.u.s.ppc64.slb[i].slbv); + target_ulong rb = sregs.u.s.ppc64.slb[i].slbe; + /* + * KVM_GET_SREGS doesn't retun slb entry with slot information + * same as index. So don't depend on the slot information in + * the returned value. + */ + rb &= ~0xfff; + /* + * use the array index as the slot + */ + rb |= i; + ppc_store_slb(env, rb, sregs.u.s.ppc64.slb[i].slbv); } #endif -- 1.8.1.2