Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2008-07-17 23:04:26 +0400
committerJeff Johnston <jjohnstn@redhat.com>2008-07-17 23:04:26 +0400
commit7f48e8a8b3e241579f57d0b5b91db1449ba96fe8 (patch)
tree597eaa648ce516208d757a71ca261130fff48bf9 /libgloss/spu
parenteb19b8f95a6a22ade6911ac98d1a76313ec99f53 (diff)
2008-07-17 Ken Werner <ken.werner@de.ibm.com>
* spu/syscalls.c: Check and set the errno value.
Diffstat (limited to 'libgloss/spu')
-rw-r--r--libgloss/spu/syscalls.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libgloss/spu/syscalls.c b/libgloss/spu/syscalls.c
index f2f292853..7e85fa502 100644
--- a/libgloss/spu/syscalls.c
+++ b/libgloss/spu/syscalls.c
@@ -29,6 +29,7 @@ POSSIBILITY OF SUCH DAMAGE.
Author: Andreas Neukoetter (ti95neuk@de.ibm.com)
*/
+#include <spu_intrinsics.h>
#include <errno.h>
#include "jsre.h"
@@ -36,6 +37,7 @@ int
__send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data)
{
+ int newerrno;
unsigned int combined = ( ( opcode<<24 )&0xff000000 ) | ( ( unsigned int )data & 0x00ffffff );
__vector unsigned int stopfunc = {
@@ -48,7 +50,13 @@ __send_to_ppe (unsigned int signalcode, unsigned int opcode, void *data)
void (*f) (void) = (void *) &stopfunc;
asm ("sync");
f ();
- errno = ((unsigned int *) data)[3];
+ newerrno = ((unsigned int *) data)[3];
+ /*
+ * Note: branchless code to conditionally set errno using
+ * spu_cmpeq and spu_sel used more space than the following.
+ */
+ if (newerrno)
+ errno = newerrno;
/*
* Return the rc code stored in slot 0.