home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v5.zip / DDKX86 / SRC / DEV / DASD / OS2ASPI / ASPIVIRT.ASM < prev    next >
Encoding:
Assembly Source File  |  1995-04-14  |  4.8 KB  |  187 lines

  1. ;*DDK*************************************************************************/
  2. ;
  3. ; COPYRIGHT    Copyright (C) 1995 IBM Corporation
  4. ;
  5. ;    The following IBM OS/2 WARP source code is provided to you solely for
  6. ;    the purpose of assisting you in your development of OS/2 WARP device
  7. ;    drivers. You may use this code in accordance with the IBM License
  8. ;    Agreement provided in the IBM Device Driver Source Kit for OS/2. This
  9. ;    Copyright statement may not be removed.;
  10. ;*****************************************************************************/
  11. ;       SCCSID = src/dev/dasd/os2aspi/aspivirt.asm, aspi, r206 93/03/20
  12.  
  13.         page    ,132
  14.  
  15. ;/*****************************************************************************
  16. ;*
  17. ;* SOURCE FILE NAME = ASPIVIRT.ASM
  18. ;*
  19. ;* DESCRIPTIVE NAME = OS2ASPI.DMD - OS/2 ASPI Device Manager
  20. ;*
  21. ;*
  22. ;*
  23. ;* VERSION      V2.0
  24. ;*
  25. ;* DATE
  26. ;*
  27. ;* DESCRIPTION : ASPI Device Manager segment declarations
  28. ;*
  29. ;*
  30. ;* CHANGE ACTIVITY =
  31. ;*   DATE      FLAG        APAR   CHANGE DESCRIPTION
  32. ;*   --------  ----------  -----  --------------------------------------
  33. ;*   mm/dd/yy  @Vnnnnn     xxxxx  xxxxxxx
  34. ;*****************************************************************************/
  35.  
  36.         .386p
  37.  
  38.         include devhlp.inc
  39.         include devsym.inc
  40.         include iorbtype.inc
  41.  
  42.         include scsi.inc
  43.         include dhcalls.inc
  44.         include aspivirt.inc
  45.  
  46. _DATA   SEGMENT  WORD PUBLIC USE16 'DATA'
  47. extrn  _Device_Help:dword
  48. extrn  _VDDProc:word
  49. _DATA   ENDS
  50.  
  51. CONST   SEGMENT  WORD PUBLIC USE16 'CONST'
  52. CONST   ENDS
  53.  
  54. _BSS    SEGMENT  WORD PUBLIC USE16 'BSS'
  55. _BSS    ENDS
  56.  
  57. DGROUP  GROUP   CONST, _BSS, _DATA
  58.  
  59. Code    segment dword public USE16 'CODE'
  60.         assume  CS:Code,DS:DGROUP
  61.  
  62. extrn   _ASPISRBEntr:near
  63. extrn   _ASPIEntry:near
  64.  
  65.         PUBLIC  VirtualASPIEntry
  66. ;
  67. ;VOID _pascal _far VirtualASPIEntry (ULONG functionCode,PASPI_SRB_HEADER pSRB,
  68. ;                                    PVOID pOutBuf);
  69. VirtualASPIEntry       proc    far
  70.  
  71.         push    bp
  72.         mov     bp, sp
  73.  
  74.         push    ds
  75.         push    es
  76.         push    ebx
  77.         push    edi
  78.         push    esi
  79.  
  80.         mov     ax, DGROUP
  81.         mov     ds, ax
  82.  
  83.         mov     eax, dword ptr [bp] + 18
  84.  
  85.         cmp     eax, PDDCMD_SRB_REQUEST         ;ASPI request
  86.         je      StandardRequest
  87.  
  88.         cmp     eax, PDDCMD_VDD_INITIALIZE      ;initialization
  89.         je      VirtualEntryInit
  90.  
  91.         cmp     eax, PDDCMD_OS2_ASPI_PASSTHRU
  92.         je      OS2Request
  93.  
  94.         cmp     eax, PDDCMD_VDM_DESTROY_EVENT
  95.         je      OS2Request
  96.         jmp short VirtualASPIDone               ;invalid request
  97.  
  98. VirtualEntryInit:
  99.         ;Save the entry point of the VDD
  100.         mov     ax,[bp] + 14
  101.         mov     [_VDDProc]+4,ax
  102.         mov     ax,[bp] + 10
  103.         mov     [_VDDProc],ax
  104.         mov     ax,[bp] + 12
  105.         mov     [_VDDProc]+2,ax
  106.         jmp short VirtualASPIDone
  107.  
  108. OS2Request:
  109.         ;Submit an OS2 request that avoids the VDD queues
  110.         cmp     eax, PDDCMD_VDM_DESTROY_EVENT
  111.         je      RememberVDMDead
  112.  
  113.         mov     ax, 0
  114.         jmp short PassOS2SRBAddress
  115.  
  116. RememberVDMDead:
  117.         mov     ax, VDM_DESTROY_EVENT
  118.  
  119. PassOS2SRBAddress:
  120.         push    ax
  121.         mov     eax, [bp] + 14                  ;pass 16:16 address of SRB
  122.         push    eax
  123.         call    _ASPISRBEntr
  124.         add     sp, 6
  125.         jmp short VirtualASPIDone
  126.  
  127. StandardRequest:
  128.         ;Use the GDT selector allocated in the VDD
  129.         ;Pass a pointer to the SRB
  130.  
  131.         push    1
  132.         mov     eax, [bp] + 14                  ;pass 16:16 address of SRB
  133.         push    eax
  134.         call    _ASPISRBEntr
  135.         add     sp, 6
  136.  
  137. VirtualASPIDone:
  138.         pop     esi
  139.         pop     edi
  140.         pop     ebx
  141.         pop     es
  142.         pop     ds
  143.         pop     bp
  144.         db      066h
  145.         ret
  146.  
  147. VirtualASPIEntry       endp
  148.  
  149. ;
  150. ;VOID _CallVirtPostRoutine(PASPI_SRB_EXECUTE_IO pSRB)
  151. ;
  152.         PUBLIC  _CallVirtPostRoutine
  153. _CallVirtPostRoutine     proc    near
  154.  
  155.         push    bp
  156.         mov     bp, sp
  157.  
  158.         push    si
  159.         push    di
  160.  
  161.         ;Call the VDD (16:32)
  162.         xor     ebx, ebx
  163.         push    ebx                             ;pass function code
  164.  
  165.         ;Pass VIRTUAL address of SRB
  166.         mov     eax, dword ptr [bp + 4]         ;pass SRB pointer ()
  167.         push    eax
  168.  
  169.         ;Pass unused third parameter
  170.         push    ebx
  171.  
  172.         call    fword ptr [_VDDProc]            ;call the VDD Post routine
  173.                                                 ;the stack is automatically
  174.                                                 ;adjusted to remove all
  175.                                                 ;parameters passed!!
  176.         pop     di
  177.         pop     si
  178.         pop     bp
  179.         ret
  180.  
  181. _CallVirtPostRoutine     endp
  182.  
  183. Code    ends
  184.  
  185. end
  186.  
  187.