summaryrefslogtreecommitdiff
path: root/pr/include/md/_solaris.h
diff options
context:
space:
mode:
Diffstat (limited to 'pr/include/md/_solaris.h')
-rw-r--r--pr/include/md/_solaris.h296
1 files changed, 148 insertions, 148 deletions
diff --git a/pr/include/md/_solaris.h b/pr/include/md/_solaris.h
index 9da60ebb..4ebf77fd 100644
--- a/pr/include/md/_solaris.h
+++ b/pr/include/md/_solaris.h
@@ -10,33 +10,33 @@
* Internal configuration macros
*/
-#define PR_LINKER_ARCH "solaris"
-#define _PR_SI_SYSNAME "SOLARIS"
+#define PR_LINKER_ARCH "solaris"
+#define _PR_SI_SYSNAME "SOLARIS"
#ifdef sparc
-#define _PR_SI_ARCHITECTURE "sparc"
+#define _PR_SI_ARCHITECTURE "sparc"
#elif defined(__x86_64)
-#define _PR_SI_ARCHITECTURE "x86-64"
+#define _PR_SI_ARCHITECTURE "x86-64"
#elif defined(i386)
-#define _PR_SI_ARCHITECTURE "x86"
+#define _PR_SI_ARCHITECTURE "x86"
#else
#error unknown processor
#endif
-#define PR_DLL_SUFFIX ".so"
+#define PR_DLL_SUFFIX ".so"
-#define _PR_VMBASE 0x30000000
-#define _PR_STACK_VMBASE 0x50000000
-#define _MD_DEFAULT_STACK_SIZE (2*65536L)
+#define _PR_VMBASE 0x30000000
+#define _PR_STACK_VMBASE 0x50000000
+#define _MD_DEFAULT_STACK_SIZE (2*65536L)
#define _MD_MMAP_FLAGS MAP_SHARED
#undef HAVE_STACK_GROWING_UP
#ifndef HAVE_WEAK_IO_SYMBOLS
-#define HAVE_WEAK_IO_SYMBOLS
+#define HAVE_WEAK_IO_SYMBOLS
#endif
-#undef HAVE_WEAK_MALLOC_SYMBOLS
-#define HAVE_DLL
-#define USE_DLFCN
+#undef HAVE_WEAK_MALLOC_SYMBOLS
+#define HAVE_DLL
+#define USE_DLFCN
#define NEED_STRFTIME_LOCK
/*
@@ -137,10 +137,10 @@ NSPR_API(PRInt32) _MD_AtomicSet(PRInt32 *val, PRInt32 newval);
#if defined(_PR_PTHREADS)
-NSPR_API(void) _MD_EarlyInit(void);
+NSPR_API(void) _MD_EarlyInit(void);
-#define _MD_EARLY_INIT _MD_EarlyInit
-#define _MD_FINAL_INIT _PR_UnixInit
+#define _MD_EARLY_INIT _MD_EarlyInit
+#define _MD_FINAL_INIT _PR_UnixInit
#else /* _PR_PTHREADS */
@@ -159,46 +159,46 @@ NSPR_API(void) _MD_EarlyInit(void);
** Initialization Related definitions
*/
-NSPR_API(void) _MD_EarlyInit(void);
-NSPR_API(void) _MD_SolarisInit();
-#define _MD_EARLY_INIT _MD_EarlyInit
-#define _MD_FINAL_INIT _MD_SolarisInit
-#define _MD_INIT_THREAD _MD_InitializeThread
+NSPR_API(void) _MD_EarlyInit(void);
+NSPR_API(void) _MD_SolarisInit();
+#define _MD_EARLY_INIT _MD_EarlyInit
+#define _MD_FINAL_INIT _MD_SolarisInit
+#define _MD_INIT_THREAD _MD_InitializeThread
#ifdef USE_SETJMP
#include <setjmp.h>
-#define _PR_CONTEXT_TYPE jmp_buf
+#define _PR_CONTEXT_TYPE jmp_buf
#ifdef sparc
-#define _MD_GET_SP(_t) (_t)->md.context[2]
+#define _MD_GET_SP(_t) (_t)->md.context[2]
#else
-#define _MD_GET_SP(_t) (_t)->md.context[4]
+#define _MD_GET_SP(_t) (_t)->md.context[4]
#endif
-#define PR_NUM_GCREGS _JBLEN
-#define CONTEXT(_thread) (_thread)->md.context
+#define PR_NUM_GCREGS _JBLEN
+#define CONTEXT(_thread) (_thread)->md.context
#else /* ! USE_SETJMP */
#ifdef sparc
-#define _PR_CONTEXT_TYPE ucontext_t
-#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[REG_SP]
+#define _PR_CONTEXT_TYPE ucontext_t
+#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[REG_SP]
/*
** Sparc's use register windows. the _MD_GetRegisters for the sparc's
** doesn't actually store anything into the argument buffer; instead the
** register windows are homed to the stack. I assume that the stack
** always has room for the registers to spill to...
*/
-#define PR_NUM_GCREGS 0
+#define PR_NUM_GCREGS 0
#else
-#define _PR_CONTEXT_TYPE unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
-#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[USP]
-#define PR_NUM_GCREGS _JBLEN
+#define _PR_CONTEXT_TYPE unsigned int edi; sigset_t oldMask, blockMask; ucontext_t
+#define _MD_GET_SP(_t) (_t)->md.context.uc_mcontext.gregs[USP]
+#define PR_NUM_GCREGS _JBLEN
#endif
-#define CONTEXT(_thread) (&(_thread)->md.context)
+#define CONTEXT(_thread) (&(_thread)->md.context)
#endif /* ! USE_SETJMP */
@@ -214,35 +214,35 @@ NSPR_API(void) _MD_SolarisInit();
#define GETTIME(tt) clock_gettime(CLOCK_REALTIME, (tt))
#endif /* i386 */
-#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
-#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
+#define _MD_SAVE_ERRNO(_thread) (_thread)->md.errcode = errno;
+#define _MD_RESTORE_ERRNO(_thread) errno = (_thread)->md.errcode;
#ifdef sparc
#ifdef USE_SETJMP
-#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
- PR_BEGIN_MACRO \
- int *context = (_thread)->md.context; \
+#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
+ PR_BEGIN_MACRO \
+ int *context = (_thread)->md.context; \
*status = PR_TRUE; \
- (void) setjmp(context); \
- (_thread)->md.context[1] = (int) ((_sp) - 64); \
- (_thread)->md.context[2] = (int) _main; \
- (_thread)->md.context[3] = (int) _main + 4; \
+ (void) setjmp(context); \
+ (_thread)->md.context[1] = (int) ((_sp) - 64); \
+ (_thread)->md.context[2] = (int) _main; \
+ (_thread)->md.context[3] = (int) _main + 4; \
_thread->no_sched = 0; \
PR_END_MACRO
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
- _MD_SAVE_ERRNO(_thread) \
- _MD_SET_LAST_THREAD(_thread); \
- _MD_SET_CURRENT_THREAD(_thread); \
- _PR_Schedule(); \
+ _MD_SAVE_ERRNO(_thread) \
+ _MD_SET_LAST_THREAD(_thread); \
+ _MD_SET_CURRENT_THREAD(_thread); \
+ _PR_Schedule(); \
}
-#define _MD_RESTORE_CONTEXT(_newThread) \
-{ \
- _MD_RESTORE_ERRNO(_newThread) \
- _MD_SET_CURRENT_THREAD(_newThread); \
+#define _MD_RESTORE_CONTEXT(_newThread) \
+{ \
+ _MD_RESTORE_ERRNO(_newThread) \
+ _MD_SET_CURRENT_THREAD(_newThread); \
longjmp(CONTEXT(_newThread), 1); \
}
@@ -250,19 +250,19 @@ NSPR_API(void) _MD_SolarisInit();
/*
** Initialize the thread context preparing it to execute _main.
*/
-#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
- PR_BEGIN_MACRO \
- ucontext_t *uc = CONTEXT(_thread); \
- *status = PR_TRUE; \
- getcontext(uc); \
- uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
- uc->uc_stack.ss_size = _thread->stack->stackSize; \
- uc->uc_stack.ss_flags = 0; /* ? */ \
- uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp; \
- uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main; \
- uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4; \
- uc->uc_flags = UC_ALL; \
- _thread->no_sched = 0; \
+#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
+ PR_BEGIN_MACRO \
+ ucontext_t *uc = CONTEXT(_thread); \
+ *status = PR_TRUE; \
+ getcontext(uc); \
+ uc->uc_stack.ss_sp = (char *) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
+ uc->uc_stack.ss_size = _thread->stack->stackSize; \
+ uc->uc_stack.ss_flags = 0; /* ? */ \
+ uc->uc_mcontext.gregs[REG_SP] = (unsigned int) uc->uc_stack.ss_sp; \
+ uc->uc_mcontext.gregs[REG_PC] = (unsigned int) _main; \
+ uc->uc_mcontext.gregs[REG_nPC] = (unsigned int) ((char*)_main)+4; \
+ uc->uc_flags = UC_ALL; \
+ _thread->no_sched = 0; \
PR_END_MACRO
/*
@@ -270,26 +270,26 @@ NSPR_API(void) _MD_SolarisInit();
** calling the thread scheduler. Reload cpu when we come back from the
** context switch because it might have changed.
*/
-#define _MD_SWITCH_CONTEXT(_thread) \
- PR_BEGIN_MACRO \
- if (!getcontext(CONTEXT(_thread))) { \
- _MD_SAVE_ERRNO(_thread); \
- _MD_SET_LAST_THREAD(_thread); \
- _PR_Schedule(); \
- } \
+#define _MD_SWITCH_CONTEXT(_thread) \
+ PR_BEGIN_MACRO \
+ if (!getcontext(CONTEXT(_thread))) { \
+ _MD_SAVE_ERRNO(_thread); \
+ _MD_SET_LAST_THREAD(_thread); \
+ _PR_Schedule(); \
+ } \
PR_END_MACRO
/*
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
** initialized by _MD_INIT_CONTEXT.
*/
-#define _MD_RESTORE_CONTEXT(_newThread) \
- PR_BEGIN_MACRO \
- ucontext_t *uc = CONTEXT(_newThread); \
- uc->uc_mcontext.gregs[11] = 1; \
- _MD_RESTORE_ERRNO(_newThread); \
- _MD_SET_CURRENT_THREAD(_newThread); \
- setcontext(uc); \
+#define _MD_RESTORE_CONTEXT(_newThread) \
+ PR_BEGIN_MACRO \
+ ucontext_t *uc = CONTEXT(_newThread); \
+ uc->uc_mcontext.gregs[11] = 1; \
+ _MD_RESTORE_ERRNO(_newThread); \
+ _MD_SET_CURRENT_THREAD(_newThread); \
+ setcontext(uc); \
PR_END_MACRO
#endif
@@ -307,7 +307,7 @@ NSPR_API(void) _MD_SolarisInit();
#define _MD_SWITCH_CONTEXT(_thread) \
if (!setjmp(CONTEXT(_thread))) { \
_MD_SAVE_ERRNO(_thread) \
- _PR_Schedule(); \
+ _PR_Schedule(); \
}
#define _MD_RESTORE_CONTEXT(_newThread) \
@@ -319,71 +319,71 @@ NSPR_API(void) _MD_SolarisInit();
#else /* USE_SETJMP */
-#define WINDOWSIZE 0
+#define WINDOWSIZE 0
int getedi(void);
void setedi(int);
-#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
- PR_BEGIN_MACRO \
- ucontext_t *uc = CONTEXT(_thread); \
+#define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
+ PR_BEGIN_MACRO \
+ ucontext_t *uc = CONTEXT(_thread); \
*status = PR_TRUE; \
- getcontext(uc); \
- /* Force sp to be double aligned! */ \
- uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
- uc->uc_mcontext.gregs[PC] = (int) _main; \
- (_thread)->no_sched = 0; \
- PR_END_MACRO
+ getcontext(uc); \
+ /* Force sp to be double aligned! */ \
+ uc->uc_mcontext.gregs[USP] = (int) ((unsigned long)(_sp - WINDOWSIZE - SA(MINFRAME)) & 0xfffffff8); \
+ uc->uc_mcontext.gregs[PC] = (int) _main; \
+ (_thread)->no_sched = 0; \
+ PR_END_MACRO
/* getcontext() may return 1, contrary to what the man page says */
-#define _MD_SWITCH_CONTEXT(_thread) \
- PR_BEGIN_MACRO \
- ucontext_t *uc = CONTEXT(_thread); \
- PR_ASSERT(_thread->no_sched); \
- sigfillset(&((_thread)->md.blockMask)); \
- sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask), \
- &((_thread)->md.oldMask)); \
- (_thread)->md.edi = getedi(); \
- if (! getcontext(uc)) { \
- sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
- uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi; \
- _MD_SAVE_ERRNO(_thread) \
- _MD_SET_LAST_THREAD(_thread); \
- _PR_Schedule(); \
- } else { \
- sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
- setedi((_thread)->md.edi); \
- PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
- _MD_LAST_THREAD()->no_sched = 0; \
- } \
- PR_END_MACRO
+#define _MD_SWITCH_CONTEXT(_thread) \
+ PR_BEGIN_MACRO \
+ ucontext_t *uc = CONTEXT(_thread); \
+ PR_ASSERT(_thread->no_sched); \
+ sigfillset(&((_thread)->md.blockMask)); \
+ sigprocmask(SIG_BLOCK, &((_thread)->md.blockMask), \
+ &((_thread)->md.oldMask)); \
+ (_thread)->md.edi = getedi(); \
+ if (! getcontext(uc)) { \
+ sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
+ uc->uc_mcontext.gregs[EDI] = (_thread)->md.edi; \
+ _MD_SAVE_ERRNO(_thread) \
+ _MD_SET_LAST_THREAD(_thread); \
+ _PR_Schedule(); \
+ } else { \
+ sigprocmask(SIG_SETMASK, &((_thread)->md.oldMask), NULL); \
+ setedi((_thread)->md.edi); \
+ PR_ASSERT(_MD_LAST_THREAD() !=_MD_CURRENT_THREAD()); \
+ _MD_LAST_THREAD()->no_sched = 0; \
+ } \
+ PR_END_MACRO
/*
** Restore a thread context, saved by _PR_SWITCH_CONTEXT
*/
-#define _MD_RESTORE_CONTEXT(_newthread) \
- PR_BEGIN_MACRO \
- ucontext_t *uc = CONTEXT(_newthread); \
- uc->uc_mcontext.gregs[EAX] = 1; \
- _MD_RESTORE_ERRNO(_newthread) \
- _MD_SET_CURRENT_THREAD(_newthread); \
- (_newthread)->no_sched = 1; \
- setcontext(uc); \
- PR_END_MACRO
+#define _MD_RESTORE_CONTEXT(_newthread) \
+ PR_BEGIN_MACRO \
+ ucontext_t *uc = CONTEXT(_newthread); \
+ uc->uc_mcontext.gregs[EAX] = 1; \
+ _MD_RESTORE_ERRNO(_newthread) \
+ _MD_SET_CURRENT_THREAD(_newthread); \
+ (_newthread)->no_sched = 1; \
+ setcontext(uc); \
+ PR_END_MACRO
#endif /* USE_SETJMP */
#endif /* sparc */
struct _MDLock {
- PRInt8 notused;
+ PRInt8 notused;
};
struct _MDCVar {
- PRInt8 notused;
+ PRInt8 notused;
};
struct _MDSemaphore {
- PRInt8 notused;
+ PRInt8 notused;
};
struct _MDThread {
@@ -413,35 +413,35 @@ struct _MDCPU_Unix {
#ifndef _PR_USE_POLL
fd_set fd_read_set, fd_write_set, fd_exception_set;
PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
- fd_exception_cnt[_PR_MD_MAX_OSFD];
+ fd_exception_cnt[_PR_MD_MAX_OSFD];
#else
- struct pollfd *ioq_pollfds;
- int ioq_pollfds_size;
-#endif /* _PR_USE_POLL */
+ struct pollfd *ioq_pollfds;
+ int ioq_pollfds_size;
+#endif /* _PR_USE_POLL */
};
-#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
+#define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
#define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
-#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
-#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
-#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
-#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
-#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
-#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
-#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
-#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
-#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
-#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
-#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
-
-#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
+#define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
+#define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
+#define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
+#define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
+#define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
+#define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
+#define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
+#define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
+#define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
+#define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
+#define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
+
+#define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
struct _MDCPU {
- struct _MDCPU_Unix md_unix;
+ struct _MDCPU_Unix md_unix;
};
#define _MD_INIT_LOCKS()
-#define _MD_NEW_LOCK(lock) PR_SUCCESS
+#define _MD_NEW_LOCK(lock) PR_SUCCESS
#define _MD_FREE_LOCK(lock)
#define _MD_LOCK(lock)
#define _MD_UNLOCK(lock)
@@ -449,8 +449,8 @@ struct _MDCPU {
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
-#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
-#define _MD_INIT_THREAD _MD_InitializeThread
+#define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
+#define _MD_INIT_THREAD _MD_InitializeThread
#define _MD_EXIT_THREAD(thread)
#define _MD_SUSPEND_THREAD(thread)
#define _MD_RESUME_THREAD(thread)
@@ -461,15 +461,15 @@ extern PRStatus _MD_WAKEUP_WAITER(struct PRThread *);
extern void _MD_YIELD(void);
extern PRStatus _MD_InitializeThread(PRThread *thread);
extern void _MD_SET_PRIORITY(struct _MDThread *thread,
- PRThreadPriority newPri);
+ PRThreadPriority newPri);
extern PRStatus _MD_CREATE_THREAD(PRThread *thread, void (*start) (void *),
- PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
- PRUint32 stackSize);
+ PRThreadPriority priority, PRThreadScope scope, PRThreadState state,
+ PRUint32 stackSize);
/* The following defines the unwrapped versions of select() and poll(). */
extern int _select(int nfds, fd_set *readfds, fd_set *writefds,
- fd_set *exceptfds, struct timeval *timeout);
-#define _MD_SELECT _select
+ fd_set *exceptfds, struct timeval *timeout);
+#define _MD_SELECT _select
#include <stropts.h>
#include <poll.h>