This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mips sim syscall


Thanks for the reply.

My intention at the moment is to run GCC testsuite in cross manner.
I'll visit to fix ld.elf_so for NetBSD/mips N32 support later. :)

On NetBSD (and probably other *nixes) syscall number is put in V0
rather than exception vector offset.  I cheated the `reason' parameter
to bet set the correct syscall number.  I could kind of run a simplest
program calling _exit() implicitly with this patch.

(I'll look further to run GDB testsuite next Monday.)

Masao

Index: gnu/dist/gdb/sim/mips/interp.c
===================================================================
RCS file: /cvsroot/seil3/src/gnu/dist/gdb/sim/mips/interp.c,v
retrieving revision 1.2
diff -u -d -r1.2 interp.c
--- gnu/dist/gdb/sim/mips/interp.c	9 Dec 2007 12:40:27 -0000	1.2
+++ gnu/dist/gdb/sim/mips/interp.c	6 Jun 2008 10:17:52 -0000
@@ -699,10 +699,18 @@
       sim_write (sd, 0x80000000, (char *) halt, sizeof (halt));
       sim_write (sd, 0x80000180, (char *) halt, sizeof (halt));
       sim_write (sd, 0x80000200, (char *) halt, sizeof (halt));
+/*
+ * XXXNETBSD
+ * http://www.cygwin.com/ml/gdb-patches/2002-04/msg00604.html
+ */
+#if 0
+      /* This is wrong.  We're not supposed to write code to the
+	 vector tables, but rather pointers to code.  */
       /* XXX: Write here unconditionally? */
       sim_write (sd, 0xBFC00200, (char *) halt, sizeof (halt));
       sim_write (sd, 0xBFC00380, (char *) halt, sizeof (halt));
       sim_write (sd, 0xBFC00400, (char *) halt, sizeof (halt));
+#endif
     }
   }
 
@@ -1219,6 +1227,7 @@
 	break;
       }
 
+    case 1: /* void exit() */
     case 17: /* void _exit() */
       {
 	sim_io_eprintf (sd, "sim_monitor(17): _exit(int reason) to be coded\n");
@@ -1716,7 +1725,12 @@
           perform this magic. */
        if ((instruction & RSVD_INSTRUCTION_MASK) == RSVD_INSTRUCTION)
 	 {
+/* XXXNETBSD */
+#if 0
 	   int reason = (instruction >> RSVD_INSTRUCTION_ARG_SHIFT) & RSVD_INSTRUCTION_ARG_MASK;
+#else
+	   int reason = V0 << 1;
+#endif
 	   if (!sim_monitor (SD, CPU, cia, reason))
 	     sim_io_error (sd, "sim_monitor: unhandled reason = %d, pc = 0x%s\n", reason, pr_addr (cia));
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]