aboutsummaryrefslogtreecommitdiff
path: root/sim/m32c/mem.c
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/mem.c
parent1f810f7808a9364811ec4e9494eb5fc8daafe232 (diff)
downloadfsf-binutils-gdb-727b6b4b411c55d0d6719556bcf6a5da5c54adb6.zip
fsf-binutils-gdb-727b6b4b411c55d0d6719556bcf6a5da5c54adb6.tar.gz
fsf-binutils-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/mem.c')
-rw-r--r--sim/m32c/mem.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/sim/m32c/mem.c b/sim/m32c/mem.c
index d7623a4..258c295 100644
--- a/sim/m32c/mem.c
+++ b/sim/m32c/mem.c
@@ -202,6 +202,23 @@ mem_put_byte (int address, unsigned char value)
}
break;
+ case 0x3aa: /* uart1tx */
+ {
+ static int pending_exit = 0;
+ if (value == 0)
+ {
+ if (pending_exit)
+ {
+ step_result = M32C_MAKE_EXITED(value);
+ return;
+ }
+ pending_exit = 1;
+ }
+ else
+ putchar(value);
+ }
+ break;
+
case 0x400:
m32c_syscall (value);
break;
@@ -232,6 +249,11 @@ mem_put_qi (int address, unsigned char value)
void
mem_put_hi (int address, unsigned short value)
{
+ if (address == 0x402)
+ {
+ printf ("SimTrace: %06lx %04x\n", regs.r_pc, value);
+ return;
+ }
S ("<=");
mem_put_byte (address, value & 0xff);
mem_put_byte (address + 1, value >> 8);
@@ -288,16 +310,16 @@ mem_get_byte (int address)
address &= membus_mask;
S ("=>");
m = mem_ptr (address);
- if (trace)
+ switch (address)
{
- if (tpr)
+ case 0x3ad: /* uart1c1 */
+ E();
+ return 2; /* transmitter empty */
+ break;
+ default:
+ if (trace)
printf (" %02x", *m);
- else
- {
- S ("=>");
- printf (" %02x", *m);
- E ();
- }
+ break;
}
E ();
return *m;