This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

libgloss: bfin: handle result2/errcode in sim syscalls


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;
 }
 

Attachment: signature.asc
Description: This is a digitally signed message part.


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