Important: The information in this document is obsolete and should not be used for new development.
DriverInstallReserveMem
You can use theDriverInstallReserveMem
function to create a device control entry and install it in the unit table.
pascal OSErr DriverInstallReserveMem(Ptr drvrPtr, short refNum);
drvrPtr
- A pointer to the device driver.
refNum
- The driver reference number.
DESCRIPTION
TheDriverInstallReserveMem
function is equivalent to theDriverInstall
function, except that it calls the Memory ManagerReserveMem
function to compact the heap before allocating memory for the device control entry (DCE).After calling the
ReserveMem
function, theDriverInstallReserveMem
function allocates a DCE in the system heap and installs a handle to this DCE in the unit table location specified by therefNum
parameter. You pass a pointer to the device driver in thedrvrPtr
parameter.In addition, this function copies the
refNum
parameter to thedCtlRefNum
field of the DCE, sets thedRAMBased
flag in thedCtlFlags
field, and clears all the other fields.SPECIAL CONSIDERATIONS
TheDriverInstallReserveMem
function does not load the driver resource into memory, copy the flags from the driver header to thedCtlFlags
field, or open the driver. You can write code to perform these tasks, or use theOpenDriver
,OpenSlot
, orPBOpen
functions instead.The
DriverInstallReserveMem
function allocates memory; you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro for theDriverInstallReserveMem
function is_DrvrInstall
(0xA03D). You must set bit 10 of the trap word to signal the Device Manager to call theReserveMem
function before allocating memory for the DCE.You place a pointer to the device driver in register A0, and the driver reference number in register D0. When
_DrvrInstall
returns, register D0 contains the result code.
Registers on entry A0 A pointer to the device driver D0 The driver reference number
Registers on exit D0 Result code RESULT CODES
noErr 0 No error badUnitErr -21 Driver reference number does not match unit table