N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

## __osGetCurrFaultedThread
__osGetNextFaultedThread

Syntax

    #include <ultra64.h>
    #include <os_internal.h>
    OSThread * __osGetCurrFaultedThread(void);
    OSThread * __osGetNextFaultedThread(
       OSThread *last);

Explanation
The __osGetCurrFaultedThread and __osGetNextFaultedThread functions are internal routines that the N64 operating system uses to gain access to the faulted thread. The Nintendo 64 operating system contains internal routines to gain access to threads that have faulted due to various exceptions such as TLB misses. These routines were designed for internal use only, so their names have a double-underscore (__) prefix notation. Internally, there exists a thread queue containing all the active threads created in the system. This queue is used mainly by the rmon debugging program for debugging purpose.
Currently, when a thread hits a CPU exception such as a TLB exception on an instruction fetch, the exception handler saves all the appropriate registers to the thread context, stops the thread from execution, marks it for the debugger, sends a message to any registered thread waiting for the OS_EVENT_FAULT event, and dispatches the next runnable thread from the run queue. If the rmon debugging program is running, it registers to receives the OS_EVENT_FAULT event, receives the faulted message, sends the faulted thread context to the gload tool running on the host, and causes the gload tool to print the thread context (mainly registers) to the screen. If necessary, developers can use the routines below in a thread that registers for the OS_EVENT_FAULT to handle CPU faults. Please see the fault sample application to learn how to use these routines.
The __osGetCurrFaultedThread routine returns the most recently faulted thread or NULL, if there is no faulted thread.
Based on the last thread, __osGetNextFaultedThread returns the next faulted thread from the active thread queue. If last is NULL, this routine performs a sequential search from the beginning of the queue. If last is not NULL, it starts the search from the last thread. If no faulted thread is found, NULL is returned.
See Also
osInitialize
osCreateThread
osStartThread
osStopThread
osDestroyThread

Nintendo® Confidential Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.
Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated March 1998