aboutsummaryrefslogtreecommitdiff
path: root/sim/moxie
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2009-07-31 11:40:16 +0000
committerAnthony Green <green@redhat.com>2009-07-31 11:40:16 +0000
commit7a321525ff614c750174eb62b6204e6e7e29311d (patch)
treefcb2dcad047322aba6fdc57aaa656076e2d0e30c /sim/moxie
parent5d8d4872fea6a055fe362bbf176a963ae4c9d12f (diff)
downloadgdb-7a321525ff614c750174eb62b6204e6e7e29311d.zip
gdb-7a321525ff614c750174eb62b6204e6e7e29311d.tar.gz
gdb-7a321525ff614c750174eb62b6204e6e7e29311d.tar.bz2
Increase simulated memory size. Support new system call ABI. Support exception processing for Linux system calls.
Diffstat (limited to 'sim/moxie')
-rw-r--r--sim/moxie/ChangeLog11
-rw-r--r--sim/moxie/interp.c37
2 files changed, 38 insertions, 10 deletions
diff --git a/sim/moxie/ChangeLog b/sim/moxie/ChangeLog
index eacfeb98..f4a1a12 100644
--- a/sim/moxie/ChangeLog
+++ b/sim/moxie/ChangeLog
@@ -1,3 +1,14 @@
+2009-07-31 Anthony Green <green@moxielogic.com>
+
+ * interp.c: Increase simulated memory to 16MB.
+ (sim_resume): Tweak swi system calls to support new ABI (up to 5
+ args in regs). Also simluate proper exception processing for
+ Linux system calls.
+
+2009-07-30 Anthony Green <green@moxielogic.com>
+
+ * interp.c (sim_resume): Add system call software interrupt support.
+
2009-06-11 Anthony Green <green@moxielogic.com>
* interp.c (INST2OFFSET): Define.
diff --git a/sim/moxie/interp.c b/sim/moxie/interp.c
index 4980ff1..9627b41 100644
--- a/sim/moxie/interp.c
+++ b/sim/moxie/interp.c
@@ -132,8 +132,8 @@ static char *myname;
static SIM_OPEN_KIND sim_kind;
static int issue_messages = 0;
-/* Default to a 8 Mbyte (== 2^23) memory space. */
-static int sim_memory_size = 23;
+/* Default to a 16 Mbyte (== 2^23) memory space. */
+static int sim_memory_size = 24;
#define MEM_SIZE_FLOOR 64
void
@@ -997,12 +997,8 @@ sim_resume (sd, step, siggnal)
{
char *fname = &memory[cpu.asregs.regs[2]];
int mode = (int) convert_target_flags ((unsigned) cpu.asregs.regs[3]);
- /* Permission bits are at 0x12($fp) */
- int perm = (int) EXTRACT_WORD(&memory[cpu.asregs.regs[0] + 20]);
+ int perm = (int) cpu.asregs.regs[4];
int fd = open (fname, mode, perm);
-#if 0
- fprintf(stderr, "open(\"%s\", 0x%x, 0x%x) = %d\n", fname, mode, perm, fd);
-#endif
/* FIXME - set errno */
cpu.asregs.regs[2] = fd;
break;
@@ -1011,8 +1007,7 @@ sim_resume (sd, step, siggnal)
{
int fd = cpu.asregs.regs[2];
char *buf = &memory[cpu.asregs.regs[3]];
- /* String length is at 0x12($fp) */
- unsigned len = EXTRACT_WORD(&memory[cpu.asregs.regs[0] + 20]);
+ unsigned len = (unsigned) cpu.asregs.regs[4];
cpu.asregs.regs[2] = read (fd, buf, len);
break;
}
@@ -1020,11 +1015,33 @@ sim_resume (sd, step, siggnal)
{
char *str = &memory[cpu.asregs.regs[3]];
/* String length is at 0x12($fp) */
- unsigned count, len = EXTRACT_WORD(&memory[cpu.asregs.regs[0] + 20]);
+ unsigned count, len = (unsigned) cpu.asregs.regs[4];
count = write (cpu.asregs.regs[2], str, len);
cpu.asregs.regs[2] = count;
break;
}
+ case 0xffffffff: /* Linux System Call */
+ {
+ unsigned int handler = cpu.asregs.sregs[1];
+ unsigned int sp = cpu.asregs.regs[1];
+ cpu.asregs.sregs[2] = 3; /* MOXIE_EX_SWI */
+
+ /* Save a slot for the static chain. */
+ sp -= 4;
+
+ /* Push the return address. */
+ sp -= 4;
+ wlat (opc, sp, pc + 6);
+
+ /* Push the current frame pointer. */
+ sp -= 4;
+ wlat (opc, sp, cpu.asregs.regs[0]);
+
+ /* Uncache the stack pointer and set the fp & pc. */
+ cpu.asregs.regs[1] = sp;
+ cpu.asregs.regs[0] = sp;
+ pc = handler - 6;
+ }
default:
break;
}