Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(677)

Side by Side Diff: gecko-sdk/include/md/_netbsd.h

Issue 20346: Version 1.8 of gecko-sdk. Downloaded from here:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gecko-sdk/include/md/_nec.h ('k') | gecko-sdk/include/md/_nextstep.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /*
3 * The contents of this file are subject to the Mozilla Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/MPL/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is the Netscape Portable Runtime (NSPR).
14 *
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 1998-2000 Netscape Communications Corporation. All
18 * Rights Reserved.
19 *
20 * Contributor(s):
21 *
22 * Alternatively, the contents of this file may be used under the
23 * terms of the GNU General Public License Version 2 or later (the
24 * "GPL"), in which case the provisions of the GPL are applicable
25 * instead of those above. If you wish to allow use of your
26 * version of this file only under the terms of the GPL and not to
27 * allow others to use your version of this file under the MPL,
28 * indicate your decision by deleting the provisions above and
29 * replace them with the notice and other provisions required by
30 * the GPL. If you do not delete the provisions above, a recipient
31 * may use your version of this file under either the MPL or the
32 * GPL.
33 */
34
35 #ifndef nspr_netbsd_defs_h___
36 #define nspr_netbsd_defs_h___
37
38 #include <sys/syscall.h>
39 #include <sys/param.h> /* for __NetBSD_Version__ */
40
41 #define PR_LINKER_ARCH "netbsd"
42 #define _PR_SI_SYSNAME "NetBSD"
43 #if defined(__i386__)
44 #define _PR_SI_ARCHITECTURE "x86"
45 #elif defined(__alpha__)
46 #define _PR_SI_ARCHITECTURE "alpha"
47 #elif defined(__m68k__)
48 #define _PR_SI_ARCHITECTURE "m68k"
49 #elif defined(__powerpc__)
50 #define _PR_SI_ARCHITECTURE "powerpc"
51 #elif defined(__sparc_v9__)
52 #define _PR_SI_ARCHITECTURE "sparc64"
53 #elif defined(__sparc__)
54 #define _PR_SI_ARCHITECTURE "sparc"
55 #elif defined(__mips__)
56 #define _PR_SI_ARCHITECTURE "mips"
57 #elif defined(__arm32__) || defined(__arm__) || defined(__armel__) \
58 || defined(__armeb__)
59 #define _PR_SI_ARCHITECTURE "arm"
60 #endif
61
62 #if defined(__ELF__)
63 #define PR_DLL_SUFFIX ".so"
64 #else
65 #define PR_DLL_SUFFIX ".so.1.0"
66 #endif
67
68 #define _PR_VMBASE 0x30000000
69 #define _PR_STACK_VMBASE 0x50000000
70 #define _MD_DEFAULT_STACK_SIZE 65536L
71 #define _MD_MMAP_FLAGS MAP_PRIVATE
72
73 #undef HAVE_STACK_GROWING_UP
74 #define HAVE_DLL
75 #define USE_DLFCN
76 #define _PR_HAVE_SOCKADDR_LEN
77 #define _PR_NO_LARGE_FILES
78 #define _PR_STAT_HAS_ST_ATIMESPEC
79 #define _PR_POLL_AVAILABLE
80 #define _PR_USE_POLL
81 #define _PR_HAVE_SYSV_SEMAPHORES
82 #define PR_HAVE_SYSV_NAMED_SHARED_MEMORY
83
84 #if __NetBSD_Version__ >= 105000000
85 #define _PR_INET6
86 #define _PR_HAVE_INET_NTOP
87 #define _PR_HAVE_GETHOSTBYNAME2
88 #define _PR_HAVE_GETADDRINFO
89 #define _PR_INET6_PROBE
90 #endif
91
92 #if __NetBSD_Version__ >= 106370000
93 /* NetBSD 1.6ZK */
94 #define _PR_HAVE_GETPROTO_R
95 #define _PR_HAVE_GETPROTO_R_INT
96 #endif
97
98 #define USE_SETJMP
99
100 #ifndef _PR_PTHREADS
101 #include <setjmp.h>
102
103 #define PR_CONTEXT_TYPE sigjmp_buf
104
105 #define CONTEXT(_th) ((_th)->md.context)
106
107 /*
108 ** Initialize a thread context to run "_main()" when started
109 */
110 #ifdef __i386__
111 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
112 { \
113 sigsetjmp(CONTEXT(_thread), 1); \
114 CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
115 CONTEXT(_thread)[0] = (int) _main; \
116 *status = PR_TRUE; \
117 }
118 #define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
119 #endif
120 #ifdef __sparc_v9__
121 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
122 { \
123 sigsetjmp(CONTEXT(_thread), 1); \
124 CONTEXT(_thread)[1] = (unsigned char*) ((_sp) - 176 - 0x7ff); \
125 CONTEXT(_thread)[2] = (long) _main; \
126 CONTEXT(_thread)[3] = (long) _main + 4; \
127 *status = PR_TRUE; \
128 }
129 #define _MD_GET_SP(_thread) (CONTEXT(_thread)[2]+0x7ff)
130 #elif defined(__sparc__)
131 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
132 { \
133 sigsetjmp(CONTEXT(_thread), 1); \
134 CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
135 CONTEXT(_thread)[3] = (int) _main; \
136 CONTEXT(_thread)[4] = (int) _main + 4; \
137 *status = PR_TRUE; \
138 }
139 #define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
140 #endif
141 #ifdef __powerpc__
142 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
143 { \
144 sigsetjmp(CONTEXT(_thread), 1); \
145 CONTEXT(_thread)[3] = (unsigned char*) ((_sp) - 128); \
146 CONTEXT(_thread)[4] = (int) _main; \
147 *status = PR_TRUE; \
148 }
149 #define _MD_GET_SP(_thread) CONTEXT(_thread)[3]
150 #endif
151 #ifdef __m68k__
152 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
153 { \
154 sigsetjmp(CONTEXT(_thread), 1); \
155 CONTEXT(_thread)[2] = (unsigned char*) ((_sp) - 128); \
156 CONTEXT(_thread)[5] = (int) _main; \
157 *status = PR_TRUE; \
158 }
159 #define _MD_GET_SP(_thread) CONTEXT(_thread)[2]
160 #endif
161 #ifdef __mips__
162 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
163 { \
164 sigsetjmp(CONTEXT(_thread), 1); \
165 CONTEXT(_thread)[32] = (unsigned char*) ((_sp) - 128); \
166 CONTEXT(_thread)[2] = (int) _main; \
167 CONTEXT(_thread)[28] = (int) _main; \
168 *status = PR_TRUE; \
169 }
170 #define _MD_GET_SP(_thread) CONTEXT(_thread)[32]
171 #endif
172 #if defined(__arm32__) || defined(__arm__) || defined(__armel__) \
173 || defined(__armeb__)
174 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
175 { \
176 sigsetjmp(CONTEXT(_thread), 1); \
177 CONTEXT(_thread)[23] = (unsigned char*) ((_sp) - 128); \
178 CONTEXT(_thread)[24] = (int) _main; \
179 *status = PR_TRUE; \
180 }
181 #define _MD_GET_SP(_thread) CONTEXT(_thread)[23]
182 #endif
183 #ifdef __alpha__
184 #define _MD_INIT_CONTEXT(_thread, _sp, _main, status) \
185 { \
186 sigsetjmp(CONTEXT(_thread), 1); \
187 CONTEXT(_thread)[34] = (unsigned char*) ((_sp) - 128); \
188 CONTEXT(_thread)[2] = (long) _main; \
189 CONTEXT(_thread)[30] = (long) _main; \
190 CONTEXT(_thread)[31] = (long) _main; \
191 *status = PR_TRUE; \
192 }
193 #define _MD_GET_SP(_thread) CONTEXT(_thread)[34]
194 #endif
195 #ifndef _MD_INIT_CONTEXT
196 #error "Need to define _MD_INIT_CONTEXT for this platform"
197 #endif
198
199 #define PR_NUM_GCREGS _JBLEN
200
201 #define _MD_SWITCH_CONTEXT(_thread) \
202 if (!sigsetjmp(CONTEXT(_thread), 1)) { \
203 (_thread)->md.errcode = errno; \
204 _PR_Schedule(); \
205 }
206
207 /*
208 ** Restore a thread context, saved by _MD_SWITCH_CONTEXT
209 */
210 #define _MD_RESTORE_CONTEXT(_thread) \
211 { \
212 errno = (_thread)->md.errcode; \
213 _MD_SET_CURRENT_THREAD(_thread); \
214 siglongjmp(CONTEXT(_thread), 1); \
215 }
216
217 /* Machine-dependent (MD) data structures */
218
219 struct _MDThread {
220 PR_CONTEXT_TYPE context;
221 int id;
222 int errcode;
223 };
224
225 struct _MDThreadStack {
226 PRInt8 notused;
227 };
228
229 struct _MDLock {
230 PRInt8 notused;
231 };
232
233 struct _MDSemaphore {
234 PRInt8 notused;
235 };
236
237 struct _MDCVar {
238 PRInt8 notused;
239 };
240
241 struct _MDSegment {
242 PRInt8 notused;
243 };
244
245 /*
246 * md-specific cpu structure field
247 */
248 #define _PR_MD_MAX_OSFD FD_SETSIZE
249
250 struct _MDCPU_Unix {
251 PRCList ioQ;
252 PRUint32 ioq_timeout;
253 PRInt32 ioq_max_osfd;
254 PRInt32 ioq_osfd_cnt;
255 #ifndef _PR_USE_POLL
256 fd_set fd_read_set, fd_write_set, fd_exception_set;
257 PRInt16 fd_read_cnt[_PR_MD_MAX_OSFD],fd_write_cnt[_PR_MD_MAX_OSFD],
258 fd_exception_cnt[_PR_MD_MAX_OSFD];
259 #else
260 struct pollfd *ioq_pollfds;
261 int ioq_pollfds_size;
262 #endif /* _PR_USE_POLL */
263 };
264
265 #define _PR_IOQ(_cpu) ((_cpu)->md.md_unix.ioQ)
266 #define _PR_ADD_TO_IOQ(_pq, _cpu) PR_APPEND_LINK(&_pq.links, &_PR_IOQ(_cpu))
267 #define _PR_FD_READ_SET(_cpu) ((_cpu)->md.md_unix.fd_read_set)
268 #define _PR_FD_READ_CNT(_cpu) ((_cpu)->md.md_unix.fd_read_cnt)
269 #define _PR_FD_WRITE_SET(_cpu) ((_cpu)->md.md_unix.fd_write_set)
270 #define _PR_FD_WRITE_CNT(_cpu) ((_cpu)->md.md_unix.fd_write_cnt)
271 #define _PR_FD_EXCEPTION_SET(_cpu) ((_cpu)->md.md_unix.fd_exception_set)
272 #define _PR_FD_EXCEPTION_CNT(_cpu) ((_cpu)->md.md_unix.fd_exception_cnt)
273 #define _PR_IOQ_TIMEOUT(_cpu) ((_cpu)->md.md_unix.ioq_timeout)
274 #define _PR_IOQ_MAX_OSFD(_cpu) ((_cpu)->md.md_unix.ioq_max_osfd)
275 #define _PR_IOQ_OSFD_CNT(_cpu) ((_cpu)->md.md_unix.ioq_osfd_cnt)
276 #define _PR_IOQ_POLLFDS(_cpu) ((_cpu)->md.md_unix.ioq_pollfds)
277 #define _PR_IOQ_POLLFDS_SIZE(_cpu) ((_cpu)->md.md_unix.ioq_pollfds_size)
278
279 #define _PR_IOQ_MIN_POLLFDS_SIZE(_cpu) 32
280
281 struct _MDCPU {
282 struct _MDCPU_Unix md_unix;
283 };
284
285 #define _MD_INIT_LOCKS()
286 #define _MD_NEW_LOCK(lock) PR_SUCCESS
287 #define _MD_FREE_LOCK(lock)
288 #define _MD_LOCK(lock)
289 #define _MD_UNLOCK(lock)
290 #define _MD_INIT_IO()
291 #define _MD_IOQ_LOCK()
292 #define _MD_IOQ_UNLOCK()
293
294 #define _MD_INIT_RUNNING_CPU(cpu) _MD_unix_init_running_cpu(cpu)
295 #define _MD_INIT_THREAD _MD_InitializeThread
296 #define _MD_EXIT_THREAD(thread)
297 #define _MD_SUSPEND_THREAD(thread) _MD_suspend_thread
298 #define _MD_RESUME_THREAD(thread) _MD_resume_thread
299 #define _MD_CLEAN_THREAD(_thread)
300
301 #endif /* ! _PR_PTHREADS */
302
303 #define _MD_EARLY_INIT _MD_EarlyInit
304 #define _MD_FINAL_INIT _PR_UnixInit
305 #define _MD_GET_INTERVAL _PR_UNIX_GetInterval
306 #define _MD_INTERVAL_PER_SEC _PR_UNIX_TicksPerSecond
307
308 /*
309 * We wrapped the select() call. _MD_SELECT refers to the built-in,
310 * unwrapped version.
311 */
312 #define _MD_SELECT(nfds,r,w,e,tv) syscall(SYS_select,nfds,r,w,e,tv)
313 #if defined(_PR_POLL_AVAILABLE)
314 #include <poll.h>
315 #define _MD_POLL(fds,nfds,timeout) syscall(SYS_poll,fds,nfds,timeout)
316 #endif
317
318 #if NetBSD1_3 == 1L
319 typedef unsigned int nfds_t;
320 #endif
321
322 #endif /* nspr_netbsd_defs_h___ */
OLDNEW
« no previous file with comments | « gecko-sdk/include/md/_nec.h ('k') | gecko-sdk/include/md/_nextstep.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698