__osSetCause __osSetCause (function)

__osGetCause, __osSetCause, __osGetCompare, __osSetCompare, __osGetConfig, __osSetConfig, __osGetSR, __osSetSR, __osGetFpcCsr, __osSetFpcCsr

Internal routine to access to multiple MIPS R4300 registers

Syntax

#include <ultra64.h>     /* ultra64.h */

#include <os_internal.h>
u32 __osGetCause(void);
void __osSetCause(u32 value);
u32 __osGetCompare(void);
void __osSetCompare(u32 value);
u32 __osGetConfig(void);
void __osSetConfig(u32 value);
u32 __osGetSR(void);
void __osSetSR(u32 value);
u32 __osGetFpcCsr(void);
u32 __osSetFpcCsr(u32 value);

Description

The Nintendo 64 operating system contains numerous internal routines that provide access to various important MIPS R4300 registers. To reduce potential duplicate effort from developers, these routines are described in this article. Developers should use the "Set" routines with extreme caution because they can interfere with the operations of the N64 operating system. These routines were designed for internal use only, so their names all have a double underscore (__) prefix notation. For more information on the use of the R4300 registers, please refer to the MIPS R4300 User's Manual and the header file R4300.h, which contains various bit definitions that can be used with the R4300 registers.

The __osGetCause routine returns the current value of the MIPS R4300 Cause register that describes the cause of the most recent exception. Its counterpart __osSetCause simply sets this register to the new value.

The __osGetCompare routine returns the value of the R4300 Compare register. __osSetCompare simply sets this register to the new value. Developers are discouraged from using __osSetCompare because the Compare register is used by the timer functions osSetTimer and osStopTimer.

The __osGetConfig routine returns the current value of the R4300 Configuration register. Its counterpart __osSetConfig simply sets this register to the new value.

The __osGetSR routine returns the current value of the R4300 Status register. Its counterpart __osSetSR simply sets this register to the new value. When creating a thread, osCreateThread enables the kernel mode, all interrupts, and exception level in the thread's Status register, which becomes the R4300 Status register during a thread context switch.

The __osGetFpcCsr routine returns the current value of the R4300 floating-point control/status register. Its counterpart __osSetFpcCsr simply returns the current value of this register before setting it to the new value. Upon system initialization and the creation of a thread, this floating-point control/status is enabled to flush all denormalized numbers to zero and to cause an invalid operation exception when Not a Numbers (NaNs) are generated. These 2 bits are respectively defined as FPCSR_FS and FPCSR_EV in R4300.h.

See Also

__osGetTLBASID

Revision History

1999/04/30 Changed format