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


Ignore:
Timestamp:
Jan 12, 2017, 7:24:52 PM (7 years ago)
Author:
erdmann
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36, comment 4

    v1 v2  
    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 !! 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]]
     75) The routine invoked by VDHCreateThread needs to be located in a 32-bit code segment and it 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.