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]

Re: [patch] SPU errno fix


Patch checked in.

-- Jeff J.

Jeff Johnston wrote:
Yes, please go ahead.

-- Jeff J.

Ken Werner wrote:
Hi,

this patch prevents errno from being reset if an assist call is made. Ok to Apply?

Ken

libgloss/ChangeLog:

2008-07-17 Ken Werner <ken.werner@de.ibm.com>

* spu/syscalls.c: Check and set the errno value.

Index: src/libgloss/spu/syscalls.c
===================================================================
--- src.orig/libgloss/spu/syscalls.c
+++ src/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, 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.



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