nsprpub/pr/include/md/_riscos.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nspr_riscos_defs_h___
     7 #define nspr_riscos_defs_h___
     9 /*
    10 ** Internal configuration macros
    11 */
    12 #define PR_LINKER_ARCH		"riscos"
    13 #define _PR_SI_SYSNAME		"RISCOS"
    14 #define _PR_SI_ARCHITECTURE	"arm"
    15 #define PR_DLL_SUFFIX		".so"
    17 #define _PR_POLL_AVAILABLE
    18 #define _PR_USE_POLL
    19 #define _PR_HAVE_SOCKADDR_LEN
    20 #undef HAVE_BSD_FLOCK
    21 #define _PR_NO_LARGE_FILES
    22 #define _PR_STAT_HAS_ONLY_ST_ATIME
    23 #define _PR_HAVE_POSIX_SEMAPHORES
    25 #include <sys/select.h>
    26 #include <sys/poll.h>
    27 #include <kernel.h>
    30 #undef  HAVE_STACK_GROWING_UP
    31 #define HAVE_DLL
    32 #define USE_DLFCN
    33 #define NEED_STRFTIME_LOCK
    34 #define NEED_TIME_R
    35 #define PT_NO_SIGTIMEDWAIT
    37 #ifndef HAVE_STRERROR
    38 #define HAVE_STRERROR
    39 #endif
    41 #define USE_SETJMP
    43 #include <setjmp.h>
    45 #define _SETJMP			setjmp
    46 #define _LONGJMP		longjmp
    47 #define _PR_CONTEXT_TYPE	jmp_buf
    48 #define _PR_NUM_GCREGS		_JBLEN
    49 #define _MD_GET_SP(_t)		(_t)->md.context[7]
    51 #define CONTEXT(_th)		((_th)->md.context)
    54 /*
    55 ** Initialize the thread context preparing it to execute _main.
    56 */
    57 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status)	\
    58 {							\
    59     *status = PR_TRUE;					\
    60     if(_SETJMP(CONTEXT(_thread))) (*_main)();		\
    61     _MD_GET_SP(_thread) = (int) ((_sp) - 128);		\
    62 }
    64 #define _MD_SWITCH_CONTEXT(_thread)	\
    65     if (!_SETJMP(CONTEXT(_thread))) {	\
    66 	(_thread)->md.errcode = errno;	\
    67 	_PR_Schedule();			\
    68     }
    70 /*
    71 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
    72 */
    73 #define _MD_RESTORE_CONTEXT(_thread)	\
    74 {					\
    75     errno = (_thread)->md.errcode;	\
    76     _MD_SET_CURRENT_THREAD(_thread);	\
    77     _LONGJMP(CONTEXT(_thread), 1);	\
    78 }
    80 /*
    81 ** Machine-dependent (MD) data structures.
    82 */
    83 struct _MDThread {
    84     _PR_CONTEXT_TYPE context;
    85     int id;
    86     int errcode;
    87 };
    89 struct _MDThreadStack {
    90     PRInt8 notused;
    91 };
    93 struct _MDLock {
    94     PRInt8 notused;
    95 };
    97 struct _MDSemaphore {
    98     PRInt8 notused;
    99 };
   101 struct _MDCVar {
   102     PRInt8 notused;
   103 };
   105 struct _MDSegment {
   106     PRInt8 notused;
   107 };
   109 /*
   110 ** md-specific cpu structure field
   111 */
   112 #define _PR_MD_MAX_OSFD		FD_SETSIZE
   114 struct _MDCPU_Unix {
   115     PRCList ioQ;
   116     PRUint32 ioq_timeout;
   117     PRInt32 ioq_max_osfd;
   118     PRInt32 ioq_osfd_cnt;
   119 #ifndef _PR_USE_POLL
   120     fd_set fd_read_set, fd_write_set, fd_exception_set;
   121     PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD], fd_write_cnt[_PR_MD_MAX_OSFD], fd_exception_cnt[_PR_MD_MAX_OSFD];
   122 #else
   123     struct pollfd *ioq_pollfds;
   124     int ioq_pollfds_size;
   125 #endif
   126 };
   128 #define _PR_IOQ(_cpu)	/*	*/	((_cpu)->md.md_unix.ioQ)
   129 #define _PR_ADD_TO_IOQ(_pq, _cpu)	PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
   130 #define _PR_FD_READ_SET(_cpu)		((_cpu)->md.md_unix.fd_read_set)
   131 #define _PR_FD_READ_CNT(_cpu)		((_cpu)->md.md_unix.fd_read_cnt)
   132 #define _PR_FD_WRITE_SET(_cpu)		((_cpu)->md.md_unix.fd_write_set)
   133 #define _PR_FD_WRITE_CNT(_cpu)		((_cpu)->md.md_unix.fd_write_cnt)
   134 #define _PR_FD_EXCEPTION_SET(_cpu)	((_cpu)->md.md_unix.fd_exception_set)
   135 #define _PR_FD_EXCEPTION_CNT(_cpu)	((_cpu)->md.md_unix.fd_exception_cnt)
   136 #define _PR_IOQ_TIMEOUT(_cpu)		((_cpu)->md.md_unix.ioq_timeout)
   137 #define _PR_IOQ_MAX_OSFD(_cpu)		((_cpu)->md.md_unix.ioq_max_osfd)
   138 #define _PR_IOQ_OSFD_CNT(_cpu)		((_cpu)->md.md_unix.ioq_osfd_cnt)
   139 #define _PR_IOQ_POLLFDS(_cpu)		((_cpu)->md.md_unix.ioq_pollfds)
   140 #define _PR_IOQ_POLLFDS_SIZE(_cpu)	((_cpu)->md.md_unix.ioq_pollfds_size)
   142 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu)	32
   144 struct _MDCPU {
   145 	struct _MDCPU_Unix md_unix;
   146 };
   148 #define _MD_INIT_LOCKS()
   149 #define _MD_NEW_LOCK(lock)		PR_SUCCESS
   150 #define _MD_FREE_LOCK(lock)
   151 #define _MD_LOCK(lock)
   152 #define _MD_UNLOCK(lock)
   153 #define _MD_INIT_IO()
   154 #define _MD_IOQ_LOCK()
   155 #define _MD_IOQ_UNLOCK()
   157 #define _MD_INTERVAL_USE_GTOD
   158 #define _MD_EARLY_INIT			_MD_EarlyInit
   159 #define _MD_FINAL_INIT			_PR_UnixInit
   160 #define _MD_INIT_RUNNING_CPU(cpu)	_MD_unix_init_running_cpu(cpu)
   161 #define _MD_INIT_THREAD			_MD_InitializeThread
   162 #define _MD_EXIT_THREAD(thread)
   163 #define	_MD_SUSPEND_THREAD(thread)
   164 #define	_MD_RESUME_THREAD(thread)
   165 #define _MD_CLEAN_THREAD(_thread)
   167 /*
   168 ** We wrapped the select() call.  _MD_SELECT refers to the built-in,
   169 ** unwrapped version.
   170 */
   171 #include <sys/time.h>
   172 #include <sys/types.h>
   173 #include <sys/select.h>
   174 #define _MD_SELECT		select
   176 #endif /* nspr_riscos_defs_h___ */

mercurial