Changes between Initial Version and Version 1 of Ticket #36, comment 4


Ignore:
Timestamp:
Jan 12, 2017, 8:23:47 PM (8 years ago)
Author:
erdmann

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36, comment 4

    initial v1  
    554) Yes you can call VDHCreateThread in a driver. You just need to be aware of one thing:[[BR]]
    66VDHCreateThread needs to be called from a 32-bit code segment and it needs DS and ES being set to the flat Ring0 data selector (DOS32FLATDS) when it is invoked. Nonetheless, a VDD and therefore also VDHCreateThread expects to use a 16-bit stack segment. However, DEVICE= and BASEDEV= type drivers will already execute with a 16-bit stack being active. Therefore, everything is just fine from a stack point of view.[[BR]]
    7 5) The routine invoked by VDHCreateThread needs to follow the FAR32 PASCAL calling convention. In particular this means that it has to return with a FAR32 return !![[BR]]
     75) The routine invoked by VDHCreateThread needs to follow the FAR32 PASCAL calling convention. In particular this means that it has to return with a FAR32 return !! It would also need to remove all parameters from the stack on return, however this is irrelevant in this case as the thread function takes no argument.[[BR]]
    88You also need to be aware that when the thread routine is invoked, a 16-bit stack will be active. Therefore, if you intend to execute/call 32-bit code in that thread you need to thunk to a 32-bit stack (via KernThunkStackTo32) at the beginning and thunk back to 16-bit (via KernThunkStackTo16) at the end of the thread routine.