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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
Michael Frysinger 2011-06-22 04:18:45 +00:00
parent 3a81efd10e
commit 4dfc786b8b
2 changed files with 17 additions and 4 deletions

View File

@ -1,3 +1,11 @@
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.
2011-06-21 Mike Frysinger <vapier@gentoo.org>
* bfin/syscalls.c: Trim trailing whitespace.

View File

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