realemu: bittest memory operands

This commit is contained in:
cinap_lenrek 2011-04-29 03:56:20 +00:00
parent 4e9d8a7435
commit c1305acf9f

View file

@ -485,7 +485,7 @@ opror(Cpu *cpu, Inst *i)
} }
static void static void
opbt(Cpu *cpu, Inst *i) opbittest(Cpu *cpu, Inst *i)
{ {
ulong a, m; ulong a, m;
int n, s; int n, s;
@ -495,9 +495,12 @@ opbt(Cpu *cpu, Inst *i)
x = i->a1; x = i->a1;
s = x->len*8; s = x->len*8;
if(x->tag == TMEM){ if(x->tag == TMEM){
int z;
x = adup(x); x = adup(x);
x->off += n / s; x->off += (n / s) * x->len;
x->off &= mask(i->alen*8); z = i->alen*8;
x->off &= mask(z);
} }
a = ar(x); a = ar(x);
n &= s-1; n &= s-1;
@ -1208,10 +1211,10 @@ static void (*exctab[NUMOP])(Cpu *cpu, Inst*) = {
[OROL] = oprol, [OROL] = oprol,
[OROR] = opror, [OROR] = opror,
[OBT] = opbt, [OBT] = opbittest,
[OBTS] = opbt, [OBTS] = opbittest,
[OBTR] = opbt, [OBTR] = opbittest,
[OBTC] = opbt, [OBTC] = opbittest,
[OBSF] = opbitscan, [OBSF] = opbitscan,
[OBSR] = opbitscan, [OBSR] = opbitscan,