diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2009-09-28 16:42:21 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2009-09-28 16:42:21 +0000 |
commit | 6c249577fbcdbb3d34747d8ba1b7d5920ef5f2ab (patch) | |
tree | ad02b8119806819c0ab895dfb4cc1f332404da47 /newlib/libc/include/sys | |
parent | 587b75f7bdac34df1cef09ea70b0fbd88a27ff16 (diff) | |
download | cygnal-6c249577fbcdbb3d34747d8ba1b7d5920ef5f2ab.tar.gz cygnal-6c249577fbcdbb3d34747d8ba1b7d5920ef5f2ab.tar.bz2 cygnal-6c249577fbcdbb3d34747d8ba1b7d5920ef5f2ab.zip |
2009-09-28 Michael Eager <eager@eagercon.com>
* configure.host: Add microblaze.
* libc/include/machine/ieeefp.h [MICROBLAZE]: Define __IEEE_BIG_ENDIAN.
* libc/include/machine/setjmp.h [MICROBLAZE]: Define _JBLEN, _JBTYPE.
* libc/include/sys/config.h [MICROBLAZE]: Define _REENT_SMALL,
_UNIX98_THREAD_MUTEX_ATTRIBUTES.
* libc/include/sys/types.h: Treat XMK like rtems, define
PTHREAD_MUTEX_NORMAL, PTHREAD_MUTEX_ERRORCHECK, PTHREAD_MUTEX_RECURSIVE,
PTHREAD_MUTEX_DEFAULT, PTHREAD_STACK_MIN, define stuct pthread_attr_s.
* libc/machine/configure.in: Add microblaze.
* libc/machine/configure: Add microblaze (not regenerated).
* libc/machine/microblaze/configure.in: NEW.
* libc/machine/microblaze/configure: Generate.
* libc/machine/microblaze/Makefile.am: NEW.
* libc/machine/microblaze/Makefile.in: Generate.
* libc/machine/microblaze/{abort.c, strcmp.c, strcpy.c, strlen.c,
mallocr.c, longjmp.S, setjmp.S}: NEW.
* libc/stdlib/mallocr.c [MICROBLAZE]: Don't declare sbrk prototype,
mALLOc(): return malloc value.
Diffstat (limited to 'newlib/libc/include/sys')
-rw-r--r-- | newlib/libc/include/sys/config.h | 11 | ||||
-rw-r--r-- | newlib/libc/include/sys/types.h | 59 |
2 files changed, 69 insertions, 1 deletions
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index ed0557d36..68d31a1ad 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -94,6 +94,17 @@ #endif #endif +/* Configure small REENT structure for Xilinx MicroBlaze platforms */ +#if defined (__MICROBLAZE__) +#ifndef _REENT_SMALL +#define _REENT_SMALL +#endif +/* Xilinx XMK uses Unix98 mutex */ +#ifdef __XMK__ +#define _UNIX98_THREAD_MUTEX_ATTRIBUTES +#endif +#endif + #if defined(__mips__) && !defined(__rtems__) #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata"))) #endif diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index 290c77a2b..05d0daf6e 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -24,7 +24,7 @@ #include <machine/_types.h> -#if defined(__rtems__) +#if defined(__rtems__) || defined(__XMK__) /* * The following section is RTEMS specific and is needed to more * closely match the types defined in the BSD sys/types.h. @@ -393,6 +393,63 @@ typedef struct { typedef unsigned int pthread_mutex_t; /* identify a mutex */ typedef struct { + int type; +} pthread_mutexattr_t; + + +#if defined(__XMK__) +/* The following defines are part of the X/Open System Interface (XSI). */ + +/* This type of mutex does not detect deadlock. A thread attempting to + * relock this mutex without first unlocking it shall deadlock. Attempting + * to unlock a mutex locked by a different thread results in undefined + * behavior. Attempting to unlock an unlocked mutex results in undefined + * behavior. + */ +#define PTHREAD_MUTEX_NORMAL 1 + +/* + * This type of mutex provides error checking. A thread attempting to + * relock this mutex without first unlocking it shall return with an error. + * A thread attempting to unlock a mutex which another thread has locked + * shall return with an error. A thread attempting to unlock an unlocked + * mutex shall return with an error. + */ +#define PTHREAD_MUTEX_ERRORCHECK 2 + +/* A thread attempting to relock this mutex without first unlocking it + * shall succeed in locking the mutex. The relocking deadlock which can + * occur with mutexes of type PTHREAD_MUTEX_NORMAL cannot occur with this + * type of mutex. Multiple locks of this mutex shall require the same + * number of unlocks to release the mutex before another thread can + * acquire the mutex. A thread attempting to unlock a mutex which another + * thread has locked shall return with an error. A thread attempting to + * unlock an unlocked mutex shall return with an error. + */ +#define PTHREAD_MUTEX_RECURSIVE 3 + +/* Attempting to recursively lock a mutex of this type results in + * undefined behavior. Attempting to unlock a mutex of this type which was + * not locked by the calling thread results in undefined behavior. + * Attempting to unlock a mutex of this type which is not locked results + * in undefined behavior. An implementation may map this mutex to one of + * the other mutex types. + */ +#define PTHREAD_MUTEX_DEFAULT 4 + +typedef struct pthread_attr_s { + int contentionscope; + struct sched_param schedparam; + int detachstate; + void *stackaddr; + size_t stacksize; +} pthread_attr_t; + +#define PTHREAD_STACK_MIN 200 + +#endif /* defined(__XMK__) */ + +typedef struct { int type; } pthread_mutexattr_t; #else /* !defined(__XMK__) */ |