| 1 | ; $Id: init.asm,v 1.1 2000-07-16 22:18:15 bird Exp $ | 
|---|
| 2 | ; | 
|---|
| 3 | ; Thunks to call stratgy entry points with init packets. | 
|---|
| 4 | ; | 
|---|
| 5 | ; Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@pmsc.no) | 
|---|
| 6 | ; | 
|---|
| 7 | ; Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 8 | ; | 
|---|
| 9 | .386 | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 | ; | 
|---|
| 13 | ; Include files | 
|---|
| 14 | ; | 
|---|
| 15 | include devsegdf.inc | 
|---|
| 16 | include os2.inc | 
|---|
| 17 |  | 
|---|
| 18 |  | 
|---|
| 19 | ; | 
|---|
| 20 | ; Exported symbols | 
|---|
| 21 | ; | 
|---|
| 22 | public  InitElf | 
|---|
| 23 | public  InitWin32k | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 | ; | 
|---|
| 27 | ; extrns | 
|---|
| 28 | ; | 
|---|
| 29 | extrn   _strategyAsm0:PROC | 
|---|
| 30 | extrn   _strategyAsm1:PROC | 
|---|
| 31 |  | 
|---|
| 32 | CODE32 SEGMENT | 
|---|
| 33 | ;; | 
|---|
| 34 | ; Initiates the $elf device driver. | 
|---|
| 35 | ; @cproto    ULONG _Optlink InitElf(PVOID pvPacket); | 
|---|
| 36 | ; @returns | 
|---|
| 37 | ; @param     (ss:)eax    pvPacket | 
|---|
| 38 | ;                   This parameter is pointer to a stack object which haven't | 
|---|
| 39 | ;                   had SSToDS() applied. This is done in this way because it | 
|---|
| 40 | ;                   lightens the job to make a far 16 bits pointer of it. | 
|---|
| 41 | ; @uses      eax, ecx, edx | 
|---|
| 42 | ; @sketch | 
|---|
| 43 | ; @status | 
|---|
| 44 | ; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no) | 
|---|
| 45 | ; @remark | 
|---|
| 46 | InitElf PROC NEAR | 
|---|
| 47 | ASSUME ds:FLAT, es:NOTHING, ss:NOTHING | 
|---|
| 48 | push    ebx | 
|---|
| 49 | push    ds | 
|---|
| 50 | push    es | 
|---|
| 51 | ; | 
|---|
| 52 | ; Make 16:16 ptr to packet pointed to by ss:eax | 
|---|
| 53 | ; | 
|---|
| 54 | mov     bx, ss | 
|---|
| 55 | mov     es, bx | 
|---|
| 56 | mov     bx, ax | 
|---|
| 57 |  | 
|---|
| 58 | ; | 
|---|
| 59 | ; Set ds to DATA16 | 
|---|
| 60 | ; | 
|---|
| 61 | mov     ax, seg DATA16 | 
|---|
| 62 | mov     ds, ax | 
|---|
| 63 |  | 
|---|
| 64 | ; | 
|---|
| 65 | ; Call stratgy entry point. | 
|---|
| 66 | ; | 
|---|
| 67 | jmp far ptr CODE16:Thunk16_InitElf | 
|---|
| 68 | Thunk32_InitElf:: | 
|---|
| 69 | movzx   eax, ax                     ; Cast USHORT to ULONG. | 
|---|
| 70 |  | 
|---|
| 71 | pop     es | 
|---|
| 72 | pop     ds | 
|---|
| 73 | pop     ebx | 
|---|
| 74 | ret | 
|---|
| 75 | InitElf ENDP | 
|---|
| 76 | CODE32 ENDS | 
|---|
| 77 |  | 
|---|
| 78 | CODE16 SEGMENT | 
|---|
| 79 | ; Call strategy entry point for $elf. | 
|---|
| 80 | Thunk16_InitElf:: | 
|---|
| 81 | call    far ptr CODE16:_strategyAsm0 | 
|---|
| 82 | jmp far ptr FLAT:Thunk32_InitElf | 
|---|
| 83 | CODE16 ENDS | 
|---|
| 84 |  | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | CODE32 SEGMENT | 
|---|
| 88 | ;; | 
|---|
| 89 | ; Initiates the $win32k device driver. | 
|---|
| 90 | ; @cproto    ULONG _Optlink InitWin32k(PVOID pvPacket); | 
|---|
| 91 | ; @returns | 
|---|
| 92 | ; @param     (ss:)eax    pvPacket | 
|---|
| 93 | ;                   This parameter is pointer to a stack object which haven't | 
|---|
| 94 | ;                   had SSToDS() applied. This is done in this way because it | 
|---|
| 95 | ;                   lightens the job to make a far 16 bits pointer of it. | 
|---|
| 96 | ; @uses      eax, ecx, edx | 
|---|
| 97 | ; @sketch | 
|---|
| 98 | ; @status | 
|---|
| 99 | ; @author    knut st. osmundsen (knut.stange.osmundsen@pmsc.no) | 
|---|
| 100 | ; @remark | 
|---|
| 101 | InitWin32k PROC NEAR | 
|---|
| 102 | ASSUME ds:FLAT, es:NOTHING, ss:NOTHING | 
|---|
| 103 | push    ebx | 
|---|
| 104 | push    ds | 
|---|
| 105 | push    es | 
|---|
| 106 | ; | 
|---|
| 107 | ; Make 16:16 ptr to packet pointed to by ss:eax | 
|---|
| 108 | ; | 
|---|
| 109 | mov     bx, ss | 
|---|
| 110 | mov     es, bx | 
|---|
| 111 | mov     bx, ax | 
|---|
| 112 |  | 
|---|
| 113 | ; | 
|---|
| 114 | ; Set ds to DATA16 | 
|---|
| 115 | ; | 
|---|
| 116 | mov     ax, seg DATA16 | 
|---|
| 117 | mov     ds, ax | 
|---|
| 118 |  | 
|---|
| 119 | ; | 
|---|
| 120 | ; Call stratgy entry point. | 
|---|
| 121 | ; | 
|---|
| 122 | jmp far ptr CODE16:Thunk16_InitWin32k | 
|---|
| 123 | Thunk32_InitWin32k:: | 
|---|
| 124 | movzx   eax, ax                     ; Cast USHORT to ULONG. | 
|---|
| 125 |  | 
|---|
| 126 | pop     es | 
|---|
| 127 | pop     ds | 
|---|
| 128 | pop     ebx | 
|---|
| 129 | ret | 
|---|
| 130 | InitWin32k ENDP | 
|---|
| 131 | CODE32 ENDS | 
|---|
| 132 |  | 
|---|
| 133 | CODE16 SEGMENT | 
|---|
| 134 | ; Call strategy entry point for $win32k. | 
|---|
| 135 | Thunk16_InitWin32k:: | 
|---|
| 136 | call    far ptr CODE16:_strategyAsm1 | 
|---|
| 137 | jmp far ptr FLAT:Thunk32_InitWin32k | 
|---|
| 138 |  | 
|---|
| 139 | CODE16 ENDS | 
|---|
| 140 |  | 
|---|
| 141 |  | 
|---|
| 142 | END | 
|---|