summaryrefslogtreecommitdiff
path: root/sys/src/cmd/aux/realemu
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@centraldogma>2011-04-29 03:56:20 +0000
committercinap_lenrek <cinap_lenrek@centraldogma>2011-04-29 03:56:20 +0000
commitc1305acf9f82393a14a4cb318b36ccdff79f8123 (patch)
tree707532fd1a0449e01fc81557153df6503af6ea8d /sys/src/cmd/aux/realemu
parent4e9d8a7435e7c91618282b68b4247f6f9b5bd395 (diff)
realemu: bittest memory operands
Diffstat (limited to 'sys/src/cmd/aux/realemu')
-rw-r--r--sys/src/cmd/aux/realemu/xec.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/src/cmd/aux/realemu/xec.c b/sys/src/cmd/aux/realemu/xec.c
index c39ad27b5..bbe8bcfdd 100644
--- a/sys/src/cmd/aux/realemu/xec.c
+++ b/sys/src/cmd/aux/realemu/xec.c
@@ -485,7 +485,7 @@ opror(Cpu *cpu, Inst *i)
}
static void
-opbt(Cpu *cpu, Inst *i)
+opbittest(Cpu *cpu, Inst *i)
{
ulong a, m;
int n, s;
@@ -495,9 +495,12 @@ opbt(Cpu *cpu, Inst *i)
x = i->a1;
s = x->len*8;
if(x->tag == TMEM){
+ int z;
+
x = adup(x);
- x->off += n / s;
- x->off &= mask(i->alen*8);
+ x->off += (n / s) * x->len;
+ z = i->alen*8;
+ x->off &= mask(z);
}
a = ar(x);
n &= s-1;
@@ -1208,10 +1211,10 @@ static void (*exctab[NUMOP])(Cpu *cpu, Inst*) = {
[OROL] = oprol,
[OROR] = opror,
- [OBT] = opbt,
- [OBTS] = opbt,
- [OBTR] = opbt,
- [OBTC] = opbt,
+ [OBT] = opbittest,
+ [OBTS] = opbittest,
+ [OBTR] = opbittest,
+ [OBTC] = opbittest,
[OBSF] = opbitscan,
[OBSR] = opbitscan,