libgloss: bfin: handle result2/errcode in sim syscalls

Mike Frysinger vapier@gentoo.org
Wed Jun 22 18:27:00 GMT 2011


the sim passes back results via two values, and the error code via a 3rd.
make sure libgloss extracts all three so that things like errno work as
expected.  this fixes many gdb tests which look for this sort of thing.

committed.
-mike

2011-06-22  Mike Frysinger  <vapier@gentoo.org>

	* bfin/syscalls.c (do_syscall): Delete local variable definitions.
	Declare result, result2, errcode local ints.  Delete asm inputs
	and outputs.  Set output constraints to q0/result, q1/result2, and
	q2/errcode.  Set input constraints to qA/reason and q0/arg.  Set
	errno to errcode.

--- libgloss/bfin/syscalls.c	22 Jun 2011 03:00:44 -0000	1.5
+++ libgloss/bfin/syscalls.c	22 Jun 2011 04:16:32 -0000
@@ -32,10 +32,15 @@ register char *stack_ptr asm ("SP");
 static inline int
 do_syscall (int reason, void *arg)
 {
-  register int r asm ("P0") = reason;
-  register void *a asm ("R0") = arg;
-  register int result asm ("R0");
-  asm volatile ("excpt 0;" : "=r" (result) : "a" (r), "r" (a) : "memory", "CC");
+  int result, result2, errcode;
+  asm volatile ("excpt 0;"
+		: "=q0" (result),
+		  "=q1" (result2),
+		  "=q2" (errcode)
+		: "qA" (reason),
+		  "q0" (arg)
+		: "memory", "CC");
+  errno = errcode;
   return result;
 }
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/newlib/attachments/20110622/bfe0eba9/attachment.sig>


More information about the Newlib mailing list