[Qemu-ppc] Please have a look at my attempted slbfee code
From:
Michael Sabino
Subject:
[Qemu-ppc] Please have a look at my attempted slbfee code
Date:
Fri, 22 Jun 2012 01:46:40 -0500
Hello,
I am trying to implement the slbfee instruction in agraf's AIX tree for AIX boot on qemu-system-ppc64. AIX appears to require this instruction. One important aspect of the slbfee function is to be able to search through the SLB and find a matching entry based on an Entry address/ESID. I am doing this in helper.c through the ppc_find_slb function. Please provide some input on whether this function looks valid, or provide me with some direction to work on this code some more.
int ppc_find_slb (CPUPPCState *env, target_ulong ea, target_ulong *flagg)
{
int index = 0; // index initialized outside of for loop as per C99+ standards target_ulong mask1 = 0xffffffffffffffff; // mask for determining active segment int bitset = (int)log2(SLB_VSID_B_1T); // VSID for 1TB segments. Calculate logarithm to get bit position of set bit.
target_ulong mask2 = mask1 >> bitset; // move mask over to set bit, selecting segment target_ulong ea2 = ea & mask2; printf("--MASK2-- %llu --MASK2--",mask2); for (; (index < 64) && (*flagg != 0); index++)
{ printf("SLB %d ESID: %llu",index,env->slb[index].esid); // if (slb->vsid != NULL) if (env->slb[index].esid == ea2) {*flagg = 1; printf("\nSLB Match!\n");}
}