This is the mail archive of the gdb-patches@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]

sim/arm RedBoot meminfo syscall [PATCH]


This patch implements the RedBoot meminfo syscall. In addition, rather
than ignoring unhandled syscalls, it sets errno to ENOSYS and returns
-1. This makes it possible to run "Hello, world!" compiled using
newlib and a RedBoot libgloss.

Cheers,
Shaun

2005-12-14  Shaun Jackman  <sjackman@gmail.com>

	* sim/arm/armos.c (ARMul_OSHandleSWI): Handle the RedBoot system
	call meminfo. Return ENOSYS for unhandled RedBoot syscalls.

Index: armos.c
===================================================================
RCS file: /cvs/src/src/sim/arm/armos.c,v
retrieving revision 1.23
diff -u -r1.23 armos.c
--- armos.c	17 Nov 2005 04:23:03 -0000	1.23
+++ armos.c	14 Dec 2005 18:36:19 -0000
@@ -859,9 +859,26 @@
  	    case 18: /* Time.  */
 	      sim_callback->printf_filtered
 		(sim_callback,
-		 "sim: unhandled RedBoot syscall '%d' encountered - ignoring\n",
+		 "sim: unhandled RedBoot syscall `%d' encountered - "
+		 "returning ENOSYS\n",
  		 state->Reg[0]);
-	      return FALSE;
+	      state->Reg[0] = -1;
+	      OSptr->ErrorNo = cb_host_to_target_errno
+		(sim_callback, ENOSYS);
+	      break;
+	    case 1001: /* Meminfo. */
+	      {
+		ARMword totmem = state->Reg[1],
+			topmem = state->Reg[2];
+		ARMword stack = state->MemSize > 0
+		  ? state->MemSize : ADDRUSERSTACK;
+		if (totmem != 0)
+		  ARMul_WriteWord (state, totmem, stack);
+		if (topmem != 0)
+		  ARMul_WriteWord (state, topmem, stack);
+		state->Reg[0] = 0;
+		break;
+	      }

  	    default:
 	      sim_callback->printf_filtered


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