[142] | 1 | ; $Id: vddentry.asm 166 2001-03-22 18:13:01Z sandervl $
|
---|
| 2 |
|
---|
| 3 | .386
|
---|
| 4 | .seq
|
---|
| 5 |
|
---|
| 6 | _HEADER segment dword public use16 'DATA'
|
---|
| 7 | _HEADER ends
|
---|
| 8 |
|
---|
| 9 | _DATA segment dword public use16 'DATA'
|
---|
| 10 | _DATA ends
|
---|
| 11 |
|
---|
| 12 | CONST segment dword public use16 'DATA'
|
---|
| 13 | CONST ends
|
---|
| 14 |
|
---|
| 15 | CONST2 segment dword public use16 'DATA'
|
---|
| 16 | CONST2 ends
|
---|
| 17 |
|
---|
| 18 | _BSS segment dword public use16 'BSS'
|
---|
| 19 | _BSS ends
|
---|
| 20 |
|
---|
| 21 | _ENDDS segment dword public use16 'ENDDS'
|
---|
| 22 | _ENDDS ends
|
---|
| 23 |
|
---|
| 24 | _INITDATA segment dword public use16 'ENDDS'
|
---|
| 25 | _INITDATA ends
|
---|
| 26 |
|
---|
| 27 | _ENDINITDATA segment dword public use16 'ENDDS'
|
---|
| 28 | _ENDINITDATA ends
|
---|
| 29 |
|
---|
| 30 | _TEXT segment dword public use16 'CODE'
|
---|
| 31 | _TEXT ends
|
---|
| 32 |
|
---|
| 33 | RMCODE segment dword public use16 'CODE'
|
---|
| 34 | RMCODE ends
|
---|
| 35 |
|
---|
| 36 | _ENDCS segment dword public use16 'CODE'
|
---|
| 37 | _ENDCS ends
|
---|
| 38 |
|
---|
| 39 | _INITTEXT segment dword public use16 'CODE'
|
---|
| 40 | _INITTEXT ends
|
---|
| 41 |
|
---|
| 42 | DGROUP group _HEADER, CONST, CONST2, _DATA, _BSS, _ENDDS, _INITDATA, _ENDINITDATA
|
---|
| 43 | CGROUP group _TEXT, RMCODE, _ENDCS, _INITTEXT
|
---|
| 44 |
|
---|
| 45 |
|
---|
| 46 | _TEXT SEGMENT DWORD PUBLIC USE16 'CODE'
|
---|
| 47 | assume cs:cgroup, ds:dgroup
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | ; Route VDD IDC request to C code to implement
|
---|
| 51 | ; 16:16 entry from 16:32 caller
|
---|
| 52 | ;
|
---|
| 53 | ; Called from VDD using pascal calling conventions:
|
---|
| 54 | ; Parms pushed left to right, callee clears the stack
|
---|
| 55 | ;
|
---|
| 56 | ulFunc EQU DWORD PTR [bp+18] ; Pascal conventions push parms left to right
|
---|
| 57 | ul1 EQU DWORD PTR [bp+14] ; 8 bytes for 16:32 far return address
|
---|
| 58 | ul2 EQU DWORD PTR [bp+10] ; 2 bytes for save of callers stack frame ptr
|
---|
| 59 |
|
---|
| 60 | PUBLIC IDCENTRY_VDD
|
---|
| 61 | EXTERN IDCENTRY_VDD_C:near
|
---|
| 62 | IDCENTRY_VDD PROC FAR ; 16:16 entry from 16:32 ; VDD calls PDD
|
---|
| 63 | push bp
|
---|
| 64 | mov bp, sp
|
---|
| 65 | push ds
|
---|
| 66 | mov ax, seg _DATA
|
---|
| 67 | push ulFunc ; pascal calling convention
|
---|
| 68 | mov ds, ax
|
---|
| 69 | push ul1
|
---|
| 70 | push ul2
|
---|
| 71 | call IDCENTRY_VDD_C
|
---|
| 72 | shl edx, 16 ; Move DX:AX return value
|
---|
| 73 | and eax, 0000FFFFh ; into eax
|
---|
| 74 | pop ds
|
---|
| 75 | or eax, edx
|
---|
| 76 | leave
|
---|
| 77 | db 66h ; Force next instruction 32-bit
|
---|
| 78 | ret 12 ; 16:32 far return, pop parms
|
---|
| 79 | IDCENTRY_VDD ENDP
|
---|
| 80 |
|
---|
| 81 | pPacket EQU DWORD PTR [bp+10h] ; 8 bytes for 16:32 far return address
|
---|
| 82 | ulCmd EQU DWORD PTR [bp+0Ch] ; cdecl conventions push parms right to left
|
---|
| 83 |
|
---|
| 84 | PUBLIC _OSSIDC_ENTRY
|
---|
| 85 | EXTERN _OSSIDC_EntryPoint:near
|
---|
| 86 | _OSSIDC_ENTRY PROC FAR ; 16:16 entry from 16:32 ; called from 32 bits pdd
|
---|
| 87 | push ebp
|
---|
| 88 | mov bp, sp
|
---|
| 89 | push ds
|
---|
| 90 | mov ax, seg _DATA
|
---|
| 91 | push DWORD PTR [bp+10h] ; cdecl calling convention
|
---|
| 92 | mov ds, ax
|
---|
| 93 | push DWORD PTR [bp+0Ch]
|
---|
| 94 | call _OSSIDC_EntryPoint
|
---|
| 95 | add sp, 8
|
---|
| 96 | shl edx, 16 ; Move DX:AX return value
|
---|
| 97 | and eax, 0000FFFFh ; into eax
|
---|
| 98 | pop ds
|
---|
| 99 | or eax, edx
|
---|
| 100 | pop ebp
|
---|
| 101 | db 66h ; Force next instruction 32-bit
|
---|
| 102 | ret ; 16:32 far return
|
---|
| 103 | _OSSIDC_ENTRY ENDP
|
---|
| 104 |
|
---|
[166] | 105 | PUBLIC HookHandlerAsm_
|
---|
| 106 | EXTERN _HookHandler:near
|
---|
| 107 | HookHandlerAsm_ PROC FAR
|
---|
| 108 | push eax
|
---|
| 109 | call _HookHandler
|
---|
| 110 | add sp, 4
|
---|
| 111 | retf
|
---|
| 112 | HookHandlerAsm_ ENDP
|
---|
| 113 |
|
---|
[151] | 114 | PUBLIC _inpd
|
---|
| 115 | _inpd proc near
|
---|
| 116 | in eax, dx
|
---|
| 117 | mov dx, ax
|
---|
| 118 | shr eax, 16
|
---|
| 119 | xchg ax, dx
|
---|
| 120 | ret
|
---|
| 121 | _inpd endp
|
---|
| 122 |
|
---|
| 123 | PUBLIC _outpd
|
---|
| 124 | _outpd proc near
|
---|
| 125 | mov ax, cx
|
---|
| 126 | shl eax, 16
|
---|
| 127 | mov ax, bx
|
---|
| 128 | out dx, eax
|
---|
| 129 | ret
|
---|
| 130 | _outpd endp
|
---|
| 131 |
|
---|
[142] | 132 | _TEXT ENDS
|
---|
| 133 |
|
---|
| 134 | END
|
---|