aboutsummaryrefslogtreecommitdiff
path: root/sim/m32c/r8c.opc
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2006-03-14 03:34:28 +0000
committerDJ Delorie <dj@redhat.com>2006-03-14 03:34:28 +0000
commit727b6b4b411c55d0d6719556bcf6a5da5c54adb6 (patch)
treef356cad6da3037f2447b33a9a826b98f4d25c0c7 /sim/m32c/r8c.opc
parent1f810f7808a9364811ec4e9494eb5fc8daafe232 (diff)
downloadgdb-727b6b4b411c55d0d6719556bcf6a5da5c54adb6.zip
gdb-727b6b4b411c55d0d6719556bcf6a5da5c54adb6.tar.gz
gdb-727b6b4b411c55d0d6719556bcf6a5da5c54adb6.tar.bz2
* mem.c (mem_put_byte): Hook simulated UART to stdout.
(mem_put_hi): Hook in simulated trace port. (mem_get_byte): Hook in simulated uart control port. * opc2c: Be more picky about matching special comments. * r8c.opc (shift_op): Limit shift counts to -16..16. (BMcnd): Map conditional codes. * reg.c (condition_true): Mask condition code to 4 bits. * syscalls.c: Include local syscall.h. * syscall.h: New, copied from libgloss.
Diffstat (limited to 'sim/m32c/r8c.opc')
-rw-r--r--sim/m32c/r8c.opc17
1 files changed, 16 insertions, 1 deletions
diff --git a/sim/m32c/r8c.opc b/sim/m32c/r8c.opc
index 4a6ba51..4db0bda 100644
--- a/sim/m32c/r8c.opc
+++ b/sim/m32c/r8c.opc
@@ -240,6 +240,15 @@ shift_op (srcdest sd, int arith, int count)
{
mask = 0xffffffffU;
msb = 0x80000000U;
+ if (count > 16 || count < -16)
+ {
+ fprintf(stderr, "Error: SI shift of %d undefined\n", count);
+ exit(1);
+ }
+ if (count > 16)
+ count = (count - 1) % 16 + 1;
+ if (count < -16)
+ count = -((-count - 1) % 16 + 1);
}
tprintf("%s %x by %d\n", arith ? "sha" : "shl", v, count);
@@ -292,6 +301,12 @@ shift_op (srcdest sd, int arith, int count)
tprintf ("b=%d, carry=%d, %s = %d\n", b, carry, #expr, v); \
set_c (v);
+/* The "BMcnd dest" opcode uses a different encoding for the */
+/* condition than other opcodes. */
+static int bmcnd_cond_map[] = {
+ 0, 1, 2, 3, 8, 9, 10, 11, 4, 5, 6, 7, 12, 13, 14, 15
+};
+
int
decode_r8c()
{
@@ -448,7 +463,7 @@ decode_r8c()
/** 0111 1110 0010 dest BMcnd dest */
dc = decode_bit (dest);
- if (condition_true (IMM (0)))
+ if (condition_true (bmcnd_cond_map [IMM (0) & 15]))
put_bit (dc, 1);
else
put_bit (dc, 0);