This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] Blackfin syscall change
- From: Jie Zhang <jie dot zhang at analog dot com>
- To: newlib at sourceware dot org
- Date: Thu, 07 Aug 2008 12:07:43 +0800
- Subject: [PATCH] Blackfin syscall change
This patch replaces "RAISE 0;" with "EXCPT 0;" for syscall in Blackfin
libgloss. The syscall mechanism in libgloss is used for simulator and
hardware board. "RAISE 0" is OK for simulator, but cannot be used for
hardware board. Using a valid instruction will ensure predictable
behavior of application on hardware board although currently there is no
non-trivial implementation of syscall for hardware board. Please review
and commit. Thanks.
Jie
2008-08-07 Jie Zhang <jie.zhang@analog.com>
* bfin/syscalls.c (do_syscall): Use `EXCPT 0' instead of `RAISE 0'
for syscall.
Index: libgloss/bfin/syscalls.c
===================================================================
--- libgloss/bfin/syscalls.c.orig 2008-07-24 18:35:59.000000000 +0800
+++ libgloss/bfin/syscalls.c 2008-07-24 18:40:53.000000000 +0800
@@ -32,13 +32,10 @@
static inline int
do_syscall (int reason, void *arg)
{
- int result;
- asm volatile ("[--sp] = %1; [--sp] = %2; \
- r1 = [sp++]; r0 = [sp++]; \
- raise 0; %0 = r0;"
- : "=r" (result)
- : "r" (reason), "r" (arg)
- : "R0", "R1", "memory", "cc");
+ 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");
return result;
}