From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20825 invoked by alias); 31 Jul 2009 11:43:44 -0000 Received: (qmail 20813 invoked by uid 22791); 31 Jul 2009 11:43:43 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtpauth04.prod.mesa1.secureserver.net (HELO smtpauth04.prod.mesa1.secureserver.net) (64.202.165.95) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Fri, 31 Jul 2009 11:43:37 +0000 Received: (qmail 10065 invoked from network); 31 Jul 2009 11:43:35 -0000 Received: from unknown (99.230.243.104) by smtpauth04.prod.mesa1.secureserver.net (64.202.165.95) with ESMTP; 31 Jul 2009 11:43:35 -0000 Subject: [patch, moxie] simulator updates From: Anthony Green To: gdb-patches@sourceware.org Content-Type: text/plain Date: Fri, 31 Jul 2009 15:00:00 -0000 Message-Id: <1249040795.24226.12.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00760.txt.bz2 I've committed the following patch for the moxie simulator. It increases the default simulated memory size, supports the new moxie system call ABI from libgloss and implements proper exception processing for Linux system call support. 2009-07-31 Anthony Green * 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. Index: sim/moxie/interp.c =================================================================== RCS file: /cvs/src/src/sim/moxie/interp.c,v retrieving revision 1.3 diff -u -r1.3 interp.c --- sim/moxie/interp.c 11 Jun 2009 11:36:14 -0000 1.3 +++ sim/moxie/interp.c 31 Jul 2009 11:38:28 -0000 @@ -132,8 +132,8 @@ 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 @@ { 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 @@ { 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 @@ { 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; }