summaryrefslogtreecommitdiff
path: root/sim/mcore/interp.c
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2000-01-18 00:55:13 +0000
committerJason Molenda <jmolenda@apple.com>2000-01-18 00:55:13 +0000
commitc5394b80aefdea6b2f589723a4b79bcbc1942629 (patch)
treec53989048ae15966e62006aaee403659bde346bf /sim/mcore/interp.c
parent67a95c88f38aa938757c92389ba59bbc89e7fa79 (diff)
downloadbinutils-gdb-c5394b80aefdea6b2f589723a4b79bcbc1942629.tar.gz
import gdb-2000-01-17 snapshot
Diffstat (limited to 'sim/mcore/interp.c')
-rw-r--r--sim/mcore/interp.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sim/mcore/interp.c b/sim/mcore/interp.c
index 810bb069835..899b3718a5a 100644
--- a/sim/mcore/interp.c
+++ b/sim/mcore/interp.c
@@ -1181,7 +1181,9 @@ sim_resume (sd, step, siggnal)
unsigned long dst, src;
dst = cpu.gr[RD];
src = cpu.gr[RS];
- dst = dst >> src;
+ /* We must not rely solely upon the native shift operations, since they
+ may not match the M*Core's behaviour on boundary conditions. */
+ dst = src > 31 ? 0 : dst >> src;
cpu.gr[RD] = dst;
}
break;
@@ -1256,11 +1258,18 @@ sim_resume (sd, step, siggnal)
break;
case 0x1A: /* asr */
- cpu.gr[RD] = (long)cpu.gr[RD] >> cpu.gr[RS];
+ /* We must not rely solely upon the native shift operations, since they
+ may not match the M*Core's behaviour on boundary conditions. */
+ if (cpu.gr[RS] > 30)
+ cpu.gr[RD] = ((long) cpu.gr[RD]) < 0 ? -1 : 0;
+ else
+ cpu.gr[RD] = (long) cpu.gr[RD] >> cpu.gr[RS];
break;
case 0x1B: /* lsl */
- cpu.gr[RD] = cpu.gr[RD] << cpu.gr[RS];
+ /* We must not rely solely upon the native shift operations, since they
+ may not match the M*Core's behaviour on boundary conditions. */
+ cpu.gr[RD] = cpu.gr[RS] > 31 ? 0 : cpu.gr[RD] << cpu.gr[RS];
break;
case 0x1C: /* addu */