Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: PowerPC System Software /
Chapter 2 - Mixed Mode Manager / Mixed Mode Manager Reference
Mixed Mode Manager Routines / Calling Routines via Universal Procedure Pointers


CallOSTrapUniversalProc

You can call the CallOSTrapUniversalProc function to call the routine associated with a universal procedure pointer, following Operating System register saving and restoring conventions. You're likely to need to use this function only if you need to patch an Operating System trap.

long CallOSTrapUniversalProc (UniversalProcPtr theProcPtr, 
                              ProcInfoType theProcInfo, ...);
theProcPtr
A universal procedure pointer.
theProcInfo
The procedure information associated with the routine specified by the theProcPtr parameter.
DESCRIPTION
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.

SPECIAL CONSIDERATIONS
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 theProcInfo parameter correctly specifies the calling conventions of the trap. In particular, do not specify either C or Pascal calling conventions.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996