_irix.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nspr_irix_defs_h___
#define nspr_irix_defs_h___
#define _PR_HAVE_ATOMIC_CAS
/*
* MipsPro assembler defines _LANGUAGE_ASSEMBLY
*/
#ifndef _LANGUAGE_ASSEMBLY
#include "prclist.h"
#include "prthread.h"
#include <sys/ucontext.h>
/*
* Internal configuration macros
*/
#define PR_LINKER_ARCH "irix"
#define _PR_SI_SYSNAME "IRIX"
#define _PR_SI_ARCHITECTURE "mips"
#define PR_DLL_SUFFIX ".so"
#define _PR_VMBASE 0x30000000
#define _PR_STACK_VMBASE 0x50000000
#define _PR_NUM_GCREGS 9
#define _MD_MMAP_FLAGS MAP_PRIVATE
#define _MD_DEFAULT_STACK_SIZE 65536L
#define _MD_MIN_STACK_SIZE 16384L
#define HAVE_WEAK_IO_SYMBOLS
#define HAVE_WEAK_MALLOC_SYMBOLS
#define HAVE_DLL
#define USE_DLFCN
#define _PR_HAVE_ATOMIC_OPS
#define _PR_POLL_AVAILABLE
#define _PR_USE_POLL
#define _PR_STAT_HAS_ST_ATIM
#define _PR_HAVE_OFF64_T
#define HAVE_POINTER_LOCALTIME_R
#define _PR_HAVE_POSIX_SEMAPHORES
#define _PR_ACCEPT_INHERIT_NONBLOCK
#ifdef _PR_INET6
#define _PR_HAVE_INET_NTOP
#define _PR_HAVE_GETIPNODEBYNAME
#define _PR_HAVE_GETIPNODEBYADDR
#define _PR_HAVE_GETADDRINFO
#endif
/* Initialization entry points */
NSPR_API(void) _MD_EarlyInit(void);
#define _MD_EARLY_INIT _MD_EarlyInit
NSPR_API(void) _MD_IrixInit(void);
#define _MD_FINAL_INIT _MD_IrixInit
#define _MD_INIT_IO()
/* Timer operations */
#define _MD_GET_INTERVAL _MD_IrixGetInterval
/* GC operations */
#define _MD_GET_SP _MD_GetSP
/* The atomic operations */
#include <mutex.h>
#define _MD_INIT_ATOMIC()
#if defined(_PR_PTHREADS)
#else /* defined(_PR_PTHREADS) */
/************************************************************************/
#include <setjmp.h>
#include <errno.h>
#include <unistd.h>
#include <bstring.h>
#include <ulocks.h>
/*
* Data region private to each sproc. This region is setup by calling
* mmap(...,MAP_LOCAL,...). The private data is mapped at the same
* address in every sproc, but every sproc gets a private mapping.
*
* Just make sure that this structure fits in a page, as only one page
* is allocated for the private region.
*/
struct sproc_private_data {
int sproc_pid;
};
extern char *_nspr_sproc_private;
#define _MD_GET_ATTACHED_THREAD() _MD_get_attached_thread()
#define _MD_CURRENT_THREAD() _MD_get_current_thread()
#define _MD_CHECK_FOR_EXIT() { \
if (_pr_irix_exit_now) { \
_MD_Wakeup_CPUs(); \
_exit(0); \
} \
}
#define _MD_ATTACH_THREAD(threadp)
extern struct _PRCPU *_pr_primordialCPU;
extern usema_t *_pr_irix_exit_sem;
extern PRInt32 _pr_irix_exit_now;
extern int _pr_irix_primoridal_cpu_fd[];
extern PRInt32 _pr_irix_process_exit;
extern PRInt32 _pr_irix_process_exit_code;
/* Thread operations */
#define _PR_LOCK_HEAP() { \
if (_pr_primordialCPU) { \
if (_MD_GET_ATTACHED_THREAD() && \
_MD_GET_ATTACHED_THREAD())) \
_PR_INTSOFF(_is); \
_PR_LOCK(_pr_heapLock); \
}
#define _PR_UNLOCK_HEAP() if (_pr_primordialCPU) { \
if (_MD_GET_ATTACHED_THREAD() && \
_MD_GET_ATTACHED_THREAD())) \
_PR_INTSON(_is); \
} \
}
#define _MD_IOQ_LOCK()
#define _MD_IOQ_UNLOCK()
struct _MDLock {
};
/*
* disable pre-emption for the LOCAL threads when calling the arena lock
* routines
*/
_PR_INTSOFF(_is); \
_PR_FAST_INTSON(_is); \
}
#define _PR_UNLOCK(lock) { \
_PR_INTSOFF(_is); \
usunsetlock(lock); \
_PR_FAST_INTSON(_is); \
}
extern ulock_t _pr_heapLock;
struct _MDThread {
int errcode;
};
struct _MDThreadStack {
};
struct _MDSemaphore {
};
struct _MDCVar {
};
struct _MDSegment {
};
/*
* md-specific cpu structure field
*/
#define _PR_MD_MAX_OSFD FD_SETSIZE
struct _MDCPU_Unix {
#ifndef _PR_USE_POLL
#else
struct pollfd *ioq_pollfds;
int ioq_pollfds_size;
#endif /* _PR_USE_POLL */
};
struct _MDCPU {
struct _MDCPU_Unix md_unix;
};
/*
** Initialize the thread context preparing it to execute _main.
*/
/*
** Switch away from the current thread context by saving its state and
** calling the thread scheduler. Reload cpu when we come back from the
** context switch because it might have changed.
*
* XXX RUNQ lock needed before clearing _PR_NO_SCHED flag, because the
* thread may be unr RUNQ?
*/
#define _MD_SWITCH_CONTEXT(_thread) \
_PR_Schedule(); \
} else { \
_MD_LAST_THREAD()->no_sched = 0; \
} \
/*
** Restore a thread context that was saved by _MD_SWITCH_CONTEXT or
** initialized by _MD_INIT_CONTEXT.
*/
#define _MD_RESTORE_CONTEXT(_newThread) \
#define _MD_INIT_ATTACHED_THREAD(thread) \
#define _MD_EXIT_THREAD _MD_ExitThread
#define _MD_SUSPEND_THREAD _MD_SuspendThread
#define _MD_RESUME_THREAD _MD_ResumeThread
#define _MD_SUSPEND_CPU _MD_SuspendCPU
#define _MD_RESUME_CPU _MD_ResumeCPU
#define _MD_BEGIN_SUSPEND_ALL()
#define _MD_END_SUSPEND_ALL()
#define _MD_BEGIN_RESUME_ALL()
#define _MD_END_RESUME_ALL()
NSPR_API(void) _MD_InitLocks(void);
#define _MD_INIT_LOCKS _MD_InitLocks
#define _MD_CLEAN_THREAD _MD_CleanThread
/* The _PR_MD_WAIT_LOCK and _PR_MD_WAKEUP_WAITER functions put to sleep and
* awaken a thread which is waiting on a lock or cvar.
*/
NSPR_API(void) _PR_MD_primordial_cpu();
NSPR_API(void) _PR_MD_WAKEUP_PRIMORDIAL_CPU();
#define _MD_WAKEUP_WAITER _MD_WakeupWaiter
#include "prthread.h"
#define _MD_SET_PRIORITY _MD_SetPriority
void (*start) (void *),
#define _MD_CREATE_THREAD _MD_CreateThread
extern void _MD_CleanupBeforeExit(void);
/* The following defines the unwrapped versions of select() and poll(). */
#define _MD_SELECT _select
#include <stropts.h>
#include <poll.h>
#define HAVE_THREAD_AFFINITY 1
#endif /* defined(_PR_PTHREADS) */
#endif /* _LANGUAGE_ASSEMBLY */
#endif /* nspr_irix_defs_h___ */