From c1305acf9f82393a14a4cb318b36ccdff79f8123 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 29 Apr 2011 03:56:20 +0000 Subject: [PATCH] realemu: bittest memory operands --- sys/src/cmd/aux/realemu/xec.c | 17 ++++++++++------- 1 file 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,