| 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/. */ |
| 5 |
|
| 6 |
#include "primpl.h" |
| 7 |
|
| 8 |
void _MD_EarlyInit(void) {} |
| 9 |
|
| 10 |
PRWord* _MD_HomeGCRegisters(PRThread* t, int isCurrent, int* np) { |
| 11 |
#ifndef _PR_PTHREADS |
| 12 |
if (isCurrent) { |
| 13 |
(void)setjmp(CONTEXT(t)); |
| 14 |
} |
| 15 |
*np = sizeof(CONTEXT(t)) / sizeof(PRWord); |
| 16 |
return (PRWord*)CONTEXT(t); |
| 17 |
#else |
| 18 |
*np = 0; |
| 19 |
return NULL; |
| 20 |
#endif |
| 21 |
} |
| 22 |
|
| 23 |
#ifdef _PR_PTHREADS |
| 24 |
|
| 25 |
void _MD_CleanupBeforeExit(void) {} |
| 26 |
|
| 27 |
#else /* ! _PR_PTHREADS */ |
| 28 |
|
| 29 |
void _MD_SET_PRIORITY(_MDThread* thread, PRUintn newPri) { return; } |
| 30 |
|
| 31 |
PRStatus _MD_InitializeThread(PRThread* thread) { |
| 32 |
/* |
| 33 |
* set the pointers to the stack-pointer and frame-pointer words in the |
| 34 |
* context structure; this is for debugging use. |
| 35 |
*/ |
| 36 |
thread->md.sp = _MD_GET_SP_PTR(thread); |
| 37 |
thread->md.fp = _MD_GET_FP_PTR(thread); |
| 38 |
return PR_SUCCESS; |
| 39 |
} |
| 40 |
|
| 41 |
PRStatus _MD_WAIT(PRThread* thread, PRIntervalTime ticks) { |
| 42 |
PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); |
| 43 |
_PR_MD_SWITCH_CONTEXT(thread); |
| 44 |
return PR_SUCCESS; |
| 45 |
} |
| 46 |
|
| 47 |
PRStatus _MD_WAKEUP_WAITER(PRThread* thread) { |
| 48 |
if (thread) { |
| 49 |
PR_ASSERT(!(thread->flags & _PR_GLOBAL_SCOPE)); |
| 50 |
} |
| 51 |
return PR_SUCCESS; |
| 52 |
} |
| 53 |
|
| 54 |
/* These functions should not be called for RISC OS */ |
| 55 |
void _MD_YIELD(void) { |
| 56 |
PR_NOT_REACHED("_MD_YIELD should not be called for RISC OS."); |
| 57 |
} |
| 58 |
|
| 59 |
PRStatus _MD_CREATE_THREAD(PRThread* thread, void (*start)(void*), |
| 60 |
PRThreadPriority priority, PRThreadScope scope, |
| 61 |
PRThreadState state, PRUint32 stackSize) { |
| 62 |
PR_NOT_REACHED("_MD_CREATE_THREAD should not be called for RISC OS."); |
| 63 |
return PR_FAILURE; |
| 64 |
} |
| 65 |
#endif /* ! _PR_PTHREADS */ |