Regular device drivers initialize at ring 3. Because at this time the FLAT code segment
is unreachable (ring 0), the driver cannot do a far call to its 32 bits initialization routine.
To achieve 32 bits initialization, a small 16 bits routine called at INIT time does the following&colon.
:ol compact.
:li.Opens the mwdd32$ device (mwdd32.sys)
:li.Sends IOCTL category 0xF0 function 0x42 to mwdd32$, with the following parameters &colon.
:sl compact.
:li.the FLAT pointer to the kernel's TKSSBase pointer.
:li.the FLAT pointer to a DevHelp32 structure
:li.the FLAT pointer to the 32 bits INIT routine
:li.the 16&colon.16 pointer to the INIT request packet.
:esl.
:li.mwdd32$ updates the TKSSBase value, so that our driver can use the :color fc=red bc=default.__StackToFlat():color fc=default bc=default. helper.
:li.mwdd32$ fills the DevHelp32 structure with pointers to 32 bits DevHelp and utility functions, so that our driver can use them.
:li.mwdd32$ calls back our 32 bits INIT routine at ring 0.
:li.Upon return from our 32 bits routine, mwdd32$ stores the return code in the IOCTL data packet.
:li.Upon return from the IOCTL call, the small 16 bits routine mentionned above retrieves the return code from the IOCTL data packet, and passes it back to the kernel.
Installable File System drivers initialize at ring 3. Because at this time the FLAT code segment
is unreachable (ring 0), the IFS cannot do a far call to its 32 bits initialization routine.
To achieve 32 bits initialization, a small 16 bits routine called at INIT time does the following&colon.
:ol compact.
:li.Opens the mwdd32$ device (mwdd32.sys)
:li.Sends IOCTL category 0xF0 function 0x41 to mwdd32$, with the following parameters &colon.
:sl compact.
:li.the FLAT pointer to the kernel's TKSSBase pointer.
:li.the FLAT pointer to a DevHelp32 structure
:li.the FLAT pointer to the 32 bits IFS INIT routine
:li.the 16&colon.16 pointer to the parameters passed to FS_INIT.
:esl.
:li.mwdd32$ updates the TKSSBase value, so that our driver can use the :color fc=red bc=default.__StackToFlat():color fc=default bc=default. helper.
:li.mwdd32$ fills the DevHelp32 structure with pointers to 32 bits DevHelp and utility functions, so that our driver can use them.
:li.mwdd32$ converts the 16&colon.16 pointer to FS_INIT parameters to 0&colon.32.
:li.mwdd32$ calls back our 32 bits IFS INIT routine at ring 0.
:li.Upon return from our 32 bits routine, mwdd32$ stores the return code in the IOCTL data packet.
:li.Upon return from the IOCTL call, the small 16 bits routine mentionned above retrieves the return code from the IOCTL data packet, and passes it back to the kernel.