Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Blinker 5.10 Online Reference - <b> doslockseg()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DosLockSeg()
------------------------------------------------------------------------------
 Purpose:
 Lock a segment in memory to prevent it being swapped out by the Blinker
 DOS extender's VM system.

 Syntax:
 USHORT BLXAPI DosLockSeg(SEL selector);

 Parameters:
 selector  The selector to be locked.

 Returns:
 None.

 Description:
 DosLockSeg() locks the memory associated with the selector parameter in
 memory, preventing it from being swapped out to disk. This function should
 be used to lock hardware interrupt handlers into memory, as it may not be
 possible to call DOS to reload the segment at the time the interrupt occurs.
 Locking a selector causes the segment to be loaded into memory.

 DosLockSeg() should also be used to lock selectors into memory before they
 are aliased using DosCreateDSAlias() or DosCreateCSAlias(). Segments that
 are to be aliased using these functions must be locked to prevent them from
 being swapped out and subsequently reloaded at a different linear base
 address, which would cause the alias selector to no longer point to the same
 memory region as the original alias.

 Example:
 #include <stdio.h>                                                          
 #include <blx286.h>                                                         
                                                                             
 void comminstall(void);                                                     
 void commhandler(void);                                                     
 void communinstall(void);                                                   
                                                                             
 void main(void)                                                             
 {                                                                           
 if (DosLockSeg(SELECTOROF(commhandler)) == 0)                               
    {                                                                        
    printf("Serial interrupt handler locked in memory\n");                   
    comminstall();    /* Hook serial comms interrupt */                      
    ...                                                                      
    communinstall();  /* Unhook comms interrupt */                           
    if (DosUnlockSeg(SELECTOROF(commhandler)) == 0)                          
       printf("Comms handler may now be swapped to disk\n");                 
    }                                                                        
 }                                                                           

See Also: DosUnlockSeg()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson