Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Shaun Jackman <sjackman@gmail.com>
To: gdb-patches@sources.redhat.com
Subject: sim/arm RedBoot meminfo syscall [PATCH]
Date: Sat, 17 Dec 2005 22:46:00 -0000	[thread overview]
Message-ID: <7f45d9390512141040m6d43725ag@mail.gmail.com> (raw)

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


             reply	other threads:[~2005-12-14 18:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-17 22:46 Shaun Jackman [this message]
2006-01-23  2:01 ` Daniel Jacobowitz
2006-01-23 15:57   ` Richard Earnshaw
2006-01-23 16:03     ` Daniel Jacobowitz
2006-01-24 23:19       ` Shaun Jackman
2006-02-02  1:49         ` Daniel Jacobowitz
2006-02-02 13:49           ` Shaun Jackman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f45d9390512141040m6d43725ag@mail.gmail.com \
    --to=sjackman@gmail.com \
    --cc=gdb-patches@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox