![]() |
CallOSTrapUniversalProc |
||||
Header: | MixedMode.h | Carbon status: | Supported | |
Calls the routine associated with a universal procedure pointer, following Operating System register saving and restoring conventions. You are likely to need to use this function only if you need to patch an Operating System trap.
SInt32 CallOSTrapUniversalProc ( UniversalProcPtr theProcPtr, ProcInfoType procInfo, ProcInfoType theProcInfo, ... );
A universal procedure pointer.
The procedure information associated with the routine specified by the theProcPtr parameter.
A long that contains the result (if any) returned by the theProcPtr routine.
The CallOSTrapUniversalProc function executes the routine associated with the specified universal procedure pointer, following standard conventions for executing Operating System traps. Registers A1, A2, D1, and D2 are saved before the routine is executed and restored after its completion; in addition, register A0 is saved and restored, depending on the setting of the appropriate flag bit in the trap word. The trap number is put into register D1; you should make certain to record that fact in any procedure information you build yourself.
You pass CallOSTrapUniversalProc a universal procedure pointer (which may be either a 680x0 procedure pointer or the address of a routine descriptor), a set of procedure information, and a variable number of parameters that are passed to the routine. CallOSTrapUniversalProc returns a result of type long that contains the result (if any) returned by the called routine.
If the universal procedure pointer passed to CallOSTrapUniversalProc is the address of the routine descriptor, that routine descriptor must already exist before you call CallOSTrapUniversalProc. If you pass the address of an invalid routine descriptor to CallOSTrapUniversalProc, a system error will occur.
The CallOSTrapUniversalProc function is defined only for register-based Operating System traps. Make sure that the procedure information specified in the procInfo parameter correctly specifies the calling conventions of the trap. In particular, do not specify either C or Pascal calling conventions.
Supported in Carbon. Not available in CarbonLib, but available when InterfaceLib 7.1 or later is installed. Exported by InterfaceLib 7.1 and later.
© 2000 Apple Computer, Inc. (Last Updated 4/14/2000)