aboutsummaryrefslogtreecommitdiff
path: root/target-mips
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-07 01:09:17 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-04-07 01:09:17 +0000
commitf757d6ff29128dd0a09e02299306be22fa38821e (patch)
tree62ad012686ea6c42050aed88d9c8cb766add3c6e /target-mips
parentd85fb99bf7ad9b6ebf163c2276333cef4faec147 (diff)
Fix ins/ext cornercase.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2627 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips')
-rw-r--r--target-mips/op.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/target-mips/op.c b/target-mips/op.c
index 5048bc0f9f..1e2dbc8c21 100644
--- a/target-mips/op.c
+++ b/target-mips/op.c
@@ -2232,7 +2232,7 @@ void op_ext(void)
unsigned int pos = PARAM1;
unsigned int size = PARAM2;
- T0 = ((uint32_t)T1 >> pos) & ((1 << size) - 1);
+ T0 = ((uint32_t)T1 >> pos) & ((size < 32) ? ((1 << size) - 1) : ~0);
RETURN();
}
@@ -2240,7 +2240,7 @@ void op_ins(void)
{
unsigned int pos = PARAM1;
unsigned int size = PARAM2;
- target_ulong mask = ((1 << size) - 1) << pos;
+ target_ulong mask = ((size < 32) ? ((1 << size) - 1) : ~0) << pos;
T0 = (T2 & ~mask) | (((uint32_t)T1 << pos) & mask);
RETURN();
@@ -2258,7 +2258,7 @@ void op_dext(void)
unsigned int pos = PARAM1;
unsigned int size = PARAM2;
- T0 = (T1 >> pos) & ((1 << size) - 1);
+ T0 = (T1 >> pos) & ((size < 32) ? ((1 << size) - 1) : ~0);
RETURN();
}
@@ -2266,7 +2266,7 @@ void op_dins(void)
{
unsigned int pos = PARAM1;
unsigned int size = PARAM2;
- target_ulong mask = ((1 << size) - 1) << pos;
+ target_ulong mask = ((size < 32) ? ((1 << size) - 1) : ~0) << pos;
T0 = (T2 & ~mask) | ((T1 << pos) & mask);
RETURN();