diff options
author | Jason Molenda <jmolenda@apple.com> | 2000-01-26 21:49:14 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2000-01-26 21:49:14 +0000 |
commit | f743149ecb74d161c7be3171d36bafc805473ebc (patch) | |
tree | dbc3f2cbbcc2d0d35b57b4702caaac431a1288a8 /sim/arm | |
parent | cb268829510cffcfdefd0ac26118216321be2039 (diff) | |
download | gdb-f743149ecb74d161c7be3171d36bafc805473ebc.zip gdb-f743149ecb74d161c7be3171d36bafc805473ebc.tar.gz gdb-f743149ecb74d161c7be3171d36bafc805473ebc.tar.bz2 |
import gdb-2000-01-26 snapshot
Diffstat (limited to 'sim/arm')
-rw-r--r-- | sim/arm/armemu.h | 3 | ||||
-rw-r--r-- | sim/arm/armsupp.c | 22 |
2 files changed, 20 insertions, 5 deletions
diff --git a/sim/arm/armemu.h b/sim/arm/armemu.h index 9c40b8c..e64dc93 100644 --- a/sim/arm/armemu.h +++ b/sim/arm/armemu.h @@ -95,6 +95,7 @@ extern ARMword isize; #define CLEARV state->VFlag = 0 #define ASSIGNV(res) state->VFlag = res + #define IFLAG (state->IFFlags >> 1) #define FFLAG (state->IFFlags & 1) #define IFFLAGS state->IFFlags @@ -367,6 +368,8 @@ extern unsigned ARMul_NthReg(ARMword instr,unsigned number) ; extern void ARMul_MSRCpsr(ARMul_State *state, ARMword instr, ARMword rhs) ; extern void ARMul_NegZero(ARMul_State *state, ARMword result) ; extern void ARMul_AddCarry(ARMul_State *state, ARMword a, ARMword b, ARMword result) ; +extern int AddOverflow(ARMword a, ARMword b, ARMword result) ; +extern int SubOverflow(ARMword a, ARMword b, ARMword result) ; extern void ARMul_AddOverflow(ARMul_State *state, ARMword a, ARMword b, ARMword result) ; extern void ARMul_SubCarry(ARMul_State *state, ARMword a, ARMword b, ARMword result) ; extern void ARMul_SubOverflow(ARMul_State *state, ARMword a, ARMword b, ARMword result) ; diff --git a/sim/arm/armsupp.c b/sim/arm/armsupp.c index 67edd95..4979fd8 100644 --- a/sim/arm/armsupp.c +++ b/sim/arm/armsupp.c @@ -391,6 +391,20 @@ void ARMul_NegZero(ARMul_State *state, ARMword result) else { CLEARN ; CLEARZ ; } ; } +/* Compute whether an addition of A and B, giving RESULT, overflowed. */ +int AddOverflow (ARMword a, ARMword b, ARMword result) +{ + return ((NEG (a) && NEG (b) && POS (result)) + || (POS (a) && POS (b) && NEG (result))); +} + +/* Compute whether a subtraction of A and B, giving RESULT, overflowed. */ +int SubOverflow (ARMword a, ARMword b, ARMword result) +{ + return ((NEG (a) && POS (b) && POS (result)) + || (POS (a) && NEG (b) && NEG (result))); +} + /***************************************************************************\ * Assigns the C flag after an addition of a and b to give result * \***************************************************************************/ @@ -408,9 +422,8 @@ void ARMul_AddCarry(ARMul_State *state, ARMword a,ARMword b,ARMword result) void ARMul_AddOverflow(ARMul_State *state, ARMword a,ARMword b,ARMword result) { - ASSIGNV( (NEG(a) && NEG(b) && POS(result)) || - (POS(a) && POS(b) && NEG(result)) ) ; - } + ASSIGNV (AddOverflow (a, b, result)); +} /***************************************************************************\ * Assigns the C flag after an subtraction of a and b to give result * @@ -429,8 +442,7 @@ ASSIGNC( (NEG(a) && POS(b)) || void ARMul_SubOverflow(ARMul_State *state,ARMword a,ARMword b,ARMword result) { -ASSIGNV( (NEG(a) && POS(b) && POS(result)) || - (POS(a) && NEG(b) && NEG(result)) ) ; + ASSIGNV (SubOverflow (a, b, result)); } /***************************************************************************\ |