| 1 | ; $Id: startup.asm,v 1.3 2001/05/13 19:50:33 sandervl Exp $
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 | ; 16 bits entrypoints for the PDD and thunks to call 32 bits code
|
|---|
| 5 | ;
|
|---|
| 6 | ; Copyright (C) 2000 Sander van Leeuwen
|
|---|
| 7 | ;
|
|---|
| 8 | ; Partly based on MWDD32 (32 bits OS/2 device driver and IFS support driver)
|
|---|
| 9 | ; Copyright (C) 1995, 1996 Matthieu WILLM
|
|---|
| 10 | ;
|
|---|
| 11 | ; This program is free software; you can redistribute it and/or modify
|
|---|
| 12 | ; it under the terms of the GNU General Public License as published by
|
|---|
| 13 | ; the Free Software Foundation; either version 2 of the License, or
|
|---|
| 14 | ; (at your option) any later version.
|
|---|
| 15 | ;
|
|---|
| 16 | ; This program is distributed in the hope that it will be useful,
|
|---|
| 17 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 19 | ; GNU General Public License for more details.
|
|---|
| 20 | ;
|
|---|
| 21 | ; You should have received a copy of the GNU General Public License
|
|---|
| 22 | ; along with this program; if not, write to the Free Software
|
|---|
| 23 | ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|---|
| 24 |
|
|---|
| 25 | .386p
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | INCL_DOS equ 1
|
|---|
| 29 | INCL_DOSERRORS equ 1
|
|---|
| 30 | include os2.inc
|
|---|
| 31 |
|
|---|
| 32 | include sbseg.inc
|
|---|
| 33 |
|
|---|
| 34 |
|
|---|
| 35 | HelpDevName equ 'CMPCI0$' ; for R0 callback
|
|---|
| 36 | MainDevName equ 'CMPCI2$' ; main device
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 | PADSTR MACRO Str, Len, Pad
|
|---|
| 40 | LOCAL @@1, @@2
|
|---|
| 41 | @@1 db Str
|
|---|
| 42 | @@2 equ $ - @@1
|
|---|
| 43 | IF Len GT @@2
|
|---|
| 44 | db (Len - @@2) Dup (Pad)
|
|---|
| 45 | ENDIF
|
|---|
| 46 | ENDM
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 | DevHlp_VirtToLin EQU 5Bh
|
|---|
| 50 | DevHlp_VMLock EQU 55h
|
|---|
| 51 |
|
|---|
| 52 | ; Status word masks
|
|---|
| 53 | STERR EQU 8000H ; Bit 15 - Error
|
|---|
| 54 | STINTER EQU 0400H ; Bit 10 - Interim character
|
|---|
| 55 | STBUI EQU 0200H ; Bit 9 - Busy
|
|---|
| 56 | STDON EQU 0100H ; Bit 8 - Done
|
|---|
| 57 | STECODE EQU 00FFH ; Error code
|
|---|
| 58 |
|
|---|
| 59 | ; Definition of the request packet header.
|
|---|
| 60 |
|
|---|
| 61 | reqPacket struc
|
|---|
| 62 | reqLenght db ?
|
|---|
| 63 | reqUnit db ?
|
|---|
| 64 | reqCommand db ?
|
|---|
| 65 | reqStatus dw ?
|
|---|
| 66 | reqFlags db ?
|
|---|
| 67 | db 3 dup (?) ; Reserved field
|
|---|
| 68 | reqLink dd ?
|
|---|
| 69 | reqPacket ends
|
|---|
| 70 |
|
|---|
| 71 | rpInitIn struc
|
|---|
| 72 | i_rph db size reqPacket dup (?)
|
|---|
| 73 | i_unit db ?
|
|---|
| 74 | i_devHelp dd ?
|
|---|
| 75 | i_initArgs dd ?
|
|---|
| 76 | i_driveNum db ?
|
|---|
| 77 | rpInitIn ends
|
|---|
| 78 |
|
|---|
| 79 | rpInitOut struc
|
|---|
| 80 | o_rph db size reqPacket dup (?)
|
|---|
| 81 | o_unit db ?
|
|---|
| 82 | o_codeend dw ?
|
|---|
| 83 | o_dataend dw ?
|
|---|
| 84 | o_bpbarray dd ?
|
|---|
| 85 | o_status dw ?
|
|---|
| 86 | rpInitOut ends
|
|---|
| 87 |
|
|---|
| 88 | BEGINCS16 EQU OFFSET CODE16:help_stub_strategy
|
|---|
| 89 | BEGINDS16 EQU OFFSET DATA16:help_header
|
|---|
| 90 |
|
|---|
| 91 | ;******************************************************************************
|
|---|
| 92 |
|
|---|
| 93 | DATA16 segment
|
|---|
| 94 | extrn DOS32FLATDS : abs ; ring 0 FLAT kernel data selector
|
|---|
| 95 | public __OffFinalDS16
|
|---|
| 96 | public help_header
|
|---|
| 97 | public sblive_header
|
|---|
| 98 | public _MSG_TABLE16
|
|---|
| 99 | public DevHelpInit
|
|---|
| 100 | public InitPktPtr
|
|---|
| 101 | public _MESSAGE_STR
|
|---|
| 102 |
|
|---|
| 103 | ;DEZE MOET ALS EERSTE blijven staan!!!!
|
|---|
| 104 | help_header dw (OFFSET sblive_header - BEGINDS16) ; Pointer to next driver
|
|---|
| 105 | dw SEG DATA16:sblive_header
|
|---|
| 106 | dw 1000100110000000b ; Device attributes
|
|---|
| 107 | ; ||||| +-+ ||||
|
|---|
| 108 | ; ||||| | | |||+------------------ STDIN
|
|---|
| 109 | ; ||||| | | ||+------------------- STDOUT
|
|---|
| 110 | ; ||||| | | |+-------------------- NULL
|
|---|
| 111 | ; ||||| | | +--------------------- CLOCK
|
|---|
| 112 | ; ||||| | |
|
|---|
| 113 | ; ||||| | +------------------------+ (001) OS/2
|
|---|
| 114 | ; ||||| | | (010) DosDevIOCtl2 + SHUTDOWN
|
|---|
| 115 | ; ||||| +--------------------------+ (011) Capability bit strip
|
|---|
| 116 | ; |||||
|
|---|
| 117 | ; ||||+----------------------------- OPEN/CLOSE (char) or Removable (blk)
|
|---|
| 118 | ; |||+------------------------------ Sharing support
|
|---|
| 119 | ; ||+------------------------------- IBM
|
|---|
| 120 | ; |+-------------------------------- IDC entry point
|
|---|
| 121 | ; +--------------------------------- char/block device driver
|
|---|
| 122 |
|
|---|
| 123 | dw (offset help_stub_strategy - BEGINCS16) ; Strategy routine entry point
|
|---|
| 124 | dw 0 ; IDC routine entry point
|
|---|
| 125 | PADSTR HelpDevName, 8, ' ' ; Device name
|
|---|
| 126 | db 8 dup (0) ; Reserved
|
|---|
| 127 | dw 0000000000010011b ; Level 3 device driver capabilities
|
|---|
| 128 | ; |||||
|
|---|
| 129 | ; ||||+------------------ DosDevIOCtl2 + Shutdown
|
|---|
| 130 | ; |||+------------------- More than 16 MB support
|
|---|
| 131 | ; ||+-------------------- Parallel port driver
|
|---|
| 132 | ; |+--------------------- Adapter device driver
|
|---|
| 133 | ; +---------------------- InitComplete
|
|---|
| 134 | dw 0000000000000000b
|
|---|
| 135 |
|
|---|
| 136 | sblive_header dd -1
|
|---|
| 137 | dw 1101100110000000b ; Device attributes
|
|---|
| 138 | ; ||||| +-+ ||||
|
|---|
| 139 | ; ||||| | | |||+------------------ STDIN
|
|---|
| 140 | ; ||||| | | ||+------------------- STDOUT
|
|---|
| 141 | ; ||||| | | |+-------------------- NULL
|
|---|
| 142 | ; ||||| | | +--------------------- CLOCK
|
|---|
| 143 | ; ||||| | |
|
|---|
| 144 | ; ||||| | +------------------------+ (001) OS/2
|
|---|
| 145 | ; ||||| | | (010) DosDevIOCtl2 + SHUTDOWN
|
|---|
| 146 | ; ||||| +--------------------------+ (011) Capability bit strip
|
|---|
| 147 | ; |||||
|
|---|
| 148 | ; ||||+----------------------------- OPEN/CLOSE (char) or Removable (blk)
|
|---|
| 149 | ; |||+------------------------------ Sharing support
|
|---|
| 150 | ; ||+------------------------------- IBM
|
|---|
| 151 | ; |+-------------------------------- IDC entry point
|
|---|
| 152 | ; +--------------------------------- char/block device driver
|
|---|
| 153 |
|
|---|
| 154 | dw (offset sblive_stub_strategy - BEGINCS16); Strategy routine entry point
|
|---|
| 155 | dw (offset sblive_stub_idc - BEGINCS16) ; IDC routine entry point
|
|---|
| 156 | PADSTR MainDevName, 8, ' ' ; Device name
|
|---|
| 157 | db 8 dup (0) ; Reserved
|
|---|
| 158 | dw 0000000000010011b ; Level 3 device driver capabilities
|
|---|
| 159 | ; |||||
|
|---|
| 160 | ; ||||+------------------ DosDevIOCtl2 + Shutdown
|
|---|
| 161 | ; |||+------------------- More than 16 MB support
|
|---|
| 162 | ; ||+-------------------- Parallel port driver
|
|---|
| 163 | ; |+--------------------- Adapter device driver
|
|---|
| 164 | ; +---------------------- InitComplete
|
|---|
| 165 | dw 0000000000000000b
|
|---|
| 166 |
|
|---|
| 167 | DevHelpInit dd 0 ; DevHelp entry
|
|---|
| 168 | InitPktPtr dd 0 ; pointer to INIT packet
|
|---|
| 169 | fOpen dw 0 ; signal for helper DD
|
|---|
| 170 |
|
|---|
| 171 | ; needed for rmcalls.lib
|
|---|
| 172 | ;_RM_Help0 dd 0
|
|---|
| 173 | ;_RM_Help1 dd 0
|
|---|
| 174 | ;_RM_Help3 dd 0
|
|---|
| 175 | ;_RMFlags dd 0
|
|---|
| 176 |
|
|---|
| 177 | _MSG_TABLE16 dw 0 ; message length
|
|---|
| 178 | dw (OFFSET _MESSAGE_STR - BEGINDS16) ; message far pointer
|
|---|
| 179 | dw SEG _MESSAGE_STR
|
|---|
| 180 |
|
|---|
| 181 | ;last byte in 16 bits data segment
|
|---|
| 182 | __OffFinalDS16 label byte
|
|---|
| 183 |
|
|---|
| 184 |
|
|---|
| 185 | ; these will not be used anymore after init ...
|
|---|
| 186 | FileName db HelpDevName, 0
|
|---|
| 187 | _MESSAGE_STR db 1024 dup (?)
|
|---|
| 188 |
|
|---|
| 189 |
|
|---|
| 190 | DATA16 ends
|
|---|
| 191 |
|
|---|
| 192 | ;******************************************************************************
|
|---|
| 193 |
|
|---|
| 194 | CODE16 segment
|
|---|
| 195 | assume cs:CODE16, ds:DATA16
|
|---|
| 196 |
|
|---|
| 197 | public __OffFinalCS16
|
|---|
| 198 |
|
|---|
| 199 | public help_stub_strategy
|
|---|
| 200 | public sblive_stub_strategy
|
|---|
| 201 | public sblive_stub_idc
|
|---|
| 202 | public thunk3216_devhelp
|
|---|
| 203 | public thunk3216_devhelp_modified_ds
|
|---|
| 204 | extrn DOSOPEN : far
|
|---|
| 205 | extrn DOSCLOSE : far
|
|---|
| 206 | extrn DOSWRITE : far
|
|---|
| 207 |
|
|---|
| 208 | ;------------------------------------------------------------------------------
|
|---|
| 209 |
|
|---|
| 210 | ;DEZE MOET ALS EERSTE blijven staan!!!!
|
|---|
| 211 |
|
|---|
| 212 | help_stub_strategy proc far
|
|---|
| 213 | mov al, byte ptr es:[bx].reqCommand
|
|---|
| 214 | or al, al ; init ??
|
|---|
| 215 | jne short @@help_cmd1
|
|---|
| 216 |
|
|---|
| 217 | ; store devhelp pointer
|
|---|
| 218 | mov eax, dword ptr es:[bx].i_devHelp
|
|---|
| 219 | mov dword ptr ds:(offset DevHelpInit - BEGINDS16), eax
|
|---|
| 220 |
|
|---|
| 221 | ; report code and data size
|
|---|
| 222 | mov word ptr es:[bx].o_codeend, (offset __OffFinalCS16 - BEGINCS16)
|
|---|
| 223 | mov word ptr es:[bx].o_dataend, (offset __OffFinalDS16 - BEGINDS16)
|
|---|
| 224 |
|
|---|
| 225 | @@help_ret_ok:
|
|---|
| 226 | mov ax, STDON
|
|---|
| 227 | jmp short @@help_ret
|
|---|
| 228 |
|
|---|
| 229 | @@help_cmd1:
|
|---|
| 230 | cmp al, 0dh ; open ??
|
|---|
| 231 | je short @@help_cmd2
|
|---|
| 232 | cmp al, 0eh ; close ??
|
|---|
| 233 | je short @@help_ret_ok
|
|---|
| 234 | mov ax, STDON + STERR + ERROR_I24_BAD_COMMAND
|
|---|
| 235 | jmp short @@help_ret
|
|---|
| 236 |
|
|---|
| 237 | @@help_cmd2:
|
|---|
| 238 | cmp ds:(offset fOpen - BEGINDS16), 0
|
|---|
| 239 | je short @@help_ret_ok ; not ours
|
|---|
| 240 | mov ds:(offset fOpen - BEGINDS16), 0
|
|---|
| 241 |
|
|---|
| 242 | push es
|
|---|
| 243 | push fs
|
|---|
| 244 | push ebx ; later weer nodig
|
|---|
| 245 | xor ebx, ebx
|
|---|
| 246 | lfs bx, ds:(offset InitPktPtr - BEGINDS16)
|
|---|
| 247 | call far ptr FLAT:STRATEGY_
|
|---|
| 248 | pop ebx ; oude bx ptr
|
|---|
| 249 | pop fs
|
|---|
| 250 | pop es
|
|---|
| 251 | @@help_ret:
|
|---|
| 252 | mov word ptr es:[bx].reqStatus, ax
|
|---|
| 253 | ret
|
|---|
| 254 | help_stub_strategy endp
|
|---|
| 255 |
|
|---|
| 256 | ;------------------------------------------------------------------------------
|
|---|
| 257 |
|
|---|
| 258 | sblive_stub_strategy proc far
|
|---|
| 259 | cmp byte ptr es:[bx].reqCommand, 0 ; init ?
|
|---|
| 260 | jne short @@sblive_cmd1
|
|---|
| 261 |
|
|---|
| 262 | inc word ptr ds:(fOpen - BEGINDS16) ; signal to helper: we are coming
|
|---|
| 263 | mov word ptr ds:(InitPktPtr - BEGINDS16 + 0), bx
|
|---|
| 264 | mov word ptr ds:(InitPktPtr - BEGINDS16 + 2), es
|
|---|
| 265 |
|
|---|
| 266 | call device_init ; result in AX
|
|---|
| 267 |
|
|---|
| 268 | ; les bx, ds:(offset InitPktPtr - BEGINDS16)
|
|---|
| 269 | mov word ptr es:[bx].o_codeend, (offset __OffFinalCS16 - BEGINCS16)
|
|---|
| 270 | mov word ptr es:[bx].o_dataend, (offset __OffFinalDS16 - BEGINDS16)
|
|---|
| 271 | jmp short @@sblive_ret
|
|---|
| 272 |
|
|---|
| 273 | @@sblive_cmd1:
|
|---|
| 274 | push es
|
|---|
| 275 | push fs
|
|---|
| 276 | push ebx
|
|---|
| 277 | mov ax, es
|
|---|
| 278 | mov fs, ax ; fs:ebx = req. packet
|
|---|
| 279 | movzx ebx, bx
|
|---|
| 280 | call far ptr FLAT:STRATEGY_ ; 32 bits strategy entry point
|
|---|
| 281 | pop ebx ; oude bx ptr
|
|---|
| 282 | pop fs
|
|---|
| 283 | pop es
|
|---|
| 284 | @@sblive_ret:
|
|---|
| 285 | mov word ptr es:[bx].reqStatus, ax ; status code
|
|---|
| 286 | ret
|
|---|
| 287 |
|
|---|
| 288 | sblive_stub_strategy endp
|
|---|
| 289 |
|
|---|
| 290 | ;------------------------------------------------------------------------------
|
|---|
| 291 |
|
|---|
| 292 | ; in: cx = cmd
|
|---|
| 293 | ; bx = lower 16 bits of ULONG parameter
|
|---|
| 294 | ; dx = upper 16 bits of ULONG parameter
|
|---|
| 295 | ; return value in dx:ax
|
|---|
| 296 |
|
|---|
| 297 | sblive_stub_idc proc far
|
|---|
| 298 | push bp
|
|---|
| 299 | mov bp, sp
|
|---|
| 300 | and sp, 0fffch ; align stack
|
|---|
| 301 | shl edx, 16 ; dx:bx -> edx
|
|---|
| 302 | movzx ecx, cx ; clear high part of ecx
|
|---|
| 303 | mov dx, bx ; dx:bx -> edx
|
|---|
| 304 | call far ptr FLAT:IDC_ ; 32 bits strategy entry point
|
|---|
| 305 | mov edx, eax ; eax -> dx:ax
|
|---|
| 306 | shr edx, 16 ; eax -> dx:ax
|
|---|
| 307 | leave
|
|---|
| 308 | retf
|
|---|
| 309 | sblive_stub_idc endp
|
|---|
| 310 |
|
|---|
| 311 | ;------------------------------------------------------------------------------
|
|---|
| 312 |
|
|---|
| 313 | ; Open helper device to trigger ring 0 callback
|
|---|
| 314 | ; After that, spit out messages, stored in buffer by 32 bit code
|
|---|
| 315 | ;
|
|---|
| 316 | ; returns: driver status code in AX
|
|---|
| 317 |
|
|---|
| 318 | device_init proc near
|
|---|
| 319 | enter 12, 0
|
|---|
| 320 | ; bp -> old bp
|
|---|
| 321 | ; bp - 2 -> FileHandle
|
|---|
| 322 | ; bp - 4 -> ActionTaken / BytesWritten
|
|---|
| 323 | ; bp - 6 -> return value
|
|---|
| 324 |
|
|---|
| 325 | mov word ptr [bp-6], STDON + STERR + ERROR_I24_GEN_FAILURE
|
|---|
| 326 |
|
|---|
| 327 | push seg DATA16 ; seg FileName
|
|---|
| 328 | push (offset FileName - BEGINDS16) ; ofs FileName
|
|---|
| 329 | push ss ; seg &FileHandle
|
|---|
| 330 | lea ax, [bp-2]
|
|---|
| 331 | push ax ; ofs &FileHandle
|
|---|
| 332 | push ss ; seg &ActionTaken
|
|---|
| 333 | lea ax, [bp-4]
|
|---|
| 334 | push ax ; ofs &ActionTaken
|
|---|
| 335 | push dword ptr 0 ; file size
|
|---|
| 336 | push 0 ; file attributes
|
|---|
| 337 | push OPEN_ACTION_FAIL_IF_NEW + OPEN_ACTION_OPEN_IF_EXISTS
|
|---|
| 338 | push OPEN_SHARE_DENYNONE + OPEN_ACCESS_READONLY
|
|---|
| 339 | push dword ptr 0 ; reserved
|
|---|
| 340 | call DOSOPEN ; open helper device to trigger
|
|---|
| 341 | or ax, ax
|
|---|
| 342 | jnz short @@open_error ; failed
|
|---|
| 343 |
|
|---|
| 344 | push word ptr [bp-2] ; FileHandle
|
|---|
| 345 | call DOSCLOSE ; close helper device
|
|---|
| 346 | mov word ptr [bp-6], STDON ; return O.K.
|
|---|
| 347 |
|
|---|
| 348 | @@open_error:
|
|---|
| 349 | mov ax, ds:(offset _MSG_TABLE16 - BEGINDS16) ; len
|
|---|
| 350 | or ax, ax
|
|---|
| 351 | jz @@open_ret ; no messages
|
|---|
| 352 |
|
|---|
| 353 | push 0001H ; stdout
|
|---|
| 354 | push DATA16 ; seg msg
|
|---|
| 355 | push (offset _MESSAGE_STR - BEGINDS16) ; ofs msg
|
|---|
| 356 | push ax ; len
|
|---|
| 357 | push ss ; seg BytesWritten
|
|---|
| 358 | lea ax, [bp-4]
|
|---|
| 359 | push ax ; ofs BytesWritten
|
|---|
| 360 | call DOSWRITE
|
|---|
| 361 |
|
|---|
| 362 | @@open_ret:
|
|---|
| 363 | mov ax, [bp-6] ; result
|
|---|
| 364 | leave
|
|---|
| 365 | ret
|
|---|
| 366 |
|
|---|
| 367 | device_init endp
|
|---|
| 368 |
|
|---|
| 369 | ;------------------------------------------------------------------------------
|
|---|
| 370 |
|
|---|
| 371 | ALIGN 2
|
|---|
| 372 | ;use devhlp pointer stored in 16 bits code segment
|
|---|
| 373 | thunk3216_devhelp:
|
|---|
| 374 | push ds
|
|---|
| 375 | push DATA16
|
|---|
| 376 | pop ds
|
|---|
| 377 | call dword ptr ds:(offset DevHelpInit - BEGINDS16)
|
|---|
| 378 | pop ds
|
|---|
| 379 | jmp far ptr FLAT:thunk1632_devhelp
|
|---|
| 380 |
|
|---|
| 381 | ;------------------------------------------------------------------------------
|
|---|
| 382 |
|
|---|
| 383 | ALIGN 2
|
|---|
| 384 | thunk3216_devhelp_modified_ds:
|
|---|
| 385 | push gs
|
|---|
| 386 | push DATA16
|
|---|
| 387 | pop gs
|
|---|
| 388 | call dword ptr gs:(offset DevHelpInit - BEGINDS16)
|
|---|
| 389 | pop gs
|
|---|
| 390 | jmp far ptr FLAT:thunk1632_devhelp
|
|---|
| 391 |
|
|---|
| 392 | ;------------------------------------------------------------------------------
|
|---|
| 393 |
|
|---|
| 394 | ;end of 16 bits code segment
|
|---|
| 395 |
|
|---|
| 396 | __OffFinalCS16 label byte
|
|---|
| 397 |
|
|---|
| 398 | CODE16 ends
|
|---|
| 399 |
|
|---|
| 400 | ;******************************************************************************
|
|---|
| 401 |
|
|---|
| 402 | CODE32 segment
|
|---|
| 403 | ASSUME CS:FLAT, DS:FLAT, ES:FLAT
|
|---|
| 404 |
|
|---|
| 405 | public __OffBeginCS32
|
|---|
| 406 | public __GETDS
|
|---|
| 407 | ; public thunk1632_devhelp
|
|---|
| 408 | ; public thunk1632_devhelp_modified_ds
|
|---|
| 409 | public DevHlp
|
|---|
| 410 | public DevHlp_ModifiedDS
|
|---|
| 411 | public STRATEGY_
|
|---|
| 412 | public IDC_
|
|---|
| 413 |
|
|---|
| 414 | extrn SBLIVE_STRATEGY : near
|
|---|
| 415 | extrn SBLIVE_IDC : near
|
|---|
| 416 | IFDEF KEE
|
|---|
| 417 | extrn KernThunkStackTo16 : near
|
|---|
| 418 | extrn KernThunkStackTo32 : near
|
|---|
| 419 | ENDIF
|
|---|
| 420 |
|
|---|
| 421 | ;------------------------------------------------------------------------------
|
|---|
| 422 |
|
|---|
| 423 | __OffBeginCS32 label byte ; 32 bit code segment starts here
|
|---|
| 424 |
|
|---|
| 425 | ;------------------------------------------------------------------------------
|
|---|
| 426 |
|
|---|
| 427 | ;Called by Watcom to set the DS
|
|---|
| 428 | __GETDS proc near
|
|---|
| 429 | push DOS32FLATDS
|
|---|
| 430 | pop ds
|
|---|
| 431 | ret
|
|---|
| 432 | __GETDS endp
|
|---|
| 433 |
|
|---|
| 434 | ;------------------------------------------------------------------------------
|
|---|
| 435 |
|
|---|
| 436 | DevHelpDebug proc near
|
|---|
| 437 | __wcpp_2_pure_error__:
|
|---|
| 438 | __wcpp_2_undef_vfun__:
|
|---|
| 439 | __wcpp_2_undefed_cdtor__:
|
|---|
| 440 | __wcpp_2_dtor_array_store__:
|
|---|
| 441 | int 3
|
|---|
| 442 | int 3
|
|---|
| 443 | ret
|
|---|
| 444 | DevHelpDebug endp
|
|---|
| 445 |
|
|---|
| 446 | ;------------------------------------------------------------------------------
|
|---|
| 447 |
|
|---|
| 448 | ALIGN 4
|
|---|
| 449 | DevHlp proc near
|
|---|
| 450 | IFDEF KEE
|
|---|
| 451 | push eax
|
|---|
| 452 | call KernThunkStackTo16
|
|---|
| 453 | pop eax ;trashed by KernThunkStackTo16
|
|---|
| 454 | ENDIF
|
|---|
| 455 | jmp far ptr CODE16:thunk3216_devhelp
|
|---|
| 456 | DevHlp endp
|
|---|
| 457 |
|
|---|
| 458 | ;------------------------------------------------------------------------------
|
|---|
| 459 |
|
|---|
| 460 | ALIGN 4
|
|---|
| 461 | DevHlp_ModifiedDS proc near
|
|---|
| 462 | IFDEF KEE
|
|---|
| 463 | push eax
|
|---|
| 464 | call KernThunkStackTo16
|
|---|
| 465 | pop eax ;trashed by KernThunkStackTo16
|
|---|
| 466 | ENDIF
|
|---|
| 467 | jmp far ptr CODE16:thunk3216_devhelp_modified_ds
|
|---|
| 468 | DevHlp_ModifiedDS endp
|
|---|
| 469 |
|
|---|
| 470 | ;------------------------------------------------------------------------------
|
|---|
| 471 |
|
|---|
| 472 | ALIGN 4
|
|---|
| 473 | thunk1632_devhelp:
|
|---|
| 474 | IFDEF KEE
|
|---|
| 475 | push eax
|
|---|
| 476 | push edx
|
|---|
| 477 | call KernThunkStackTo32
|
|---|
| 478 | pop edx ;trashed by KernThunkStackTo32
|
|---|
| 479 | pop eax ;trashed by KernThunkStackTo32
|
|---|
| 480 | ENDIF
|
|---|
| 481 | ret
|
|---|
| 482 |
|
|---|
| 483 | ;------------------------------------------------------------------------------
|
|---|
| 484 |
|
|---|
| 485 | ; in fs:ebx request packet
|
|---|
| 486 | ; return value in eax
|
|---|
| 487 |
|
|---|
| 488 | ALIGN 4
|
|---|
| 489 | STRATEGY_ proc far
|
|---|
| 490 | push ds
|
|---|
| 491 | push es
|
|---|
| 492 |
|
|---|
| 493 | mov eax, DOS32FLATDS
|
|---|
| 494 | mov ds, eax
|
|---|
| 495 | mov es, eax
|
|---|
| 496 | IFDEF KEE
|
|---|
| 497 | push stacksel
|
|---|
| 498 | push stackbase
|
|---|
| 499 |
|
|---|
| 500 | push edx
|
|---|
| 501 | mov stacksel, ss
|
|---|
| 502 | call KernThunkStackTo32
|
|---|
| 503 | mov stackbase, edx
|
|---|
| 504 | pop edx ;trashed by KernThunkStackTo32
|
|---|
| 505 |
|
|---|
| 506 | call SBLIVE_STRATEGY
|
|---|
| 507 |
|
|---|
| 508 | mov ecx, eax
|
|---|
| 509 | call KernThunkStackTo16
|
|---|
| 510 | mov eax, ecx
|
|---|
| 511 |
|
|---|
| 512 | pop stackbase
|
|---|
| 513 | pop stacksel
|
|---|
| 514 | ELSE
|
|---|
| 515 | call SBLIVE_STRATEGY
|
|---|
| 516 | ENDIF
|
|---|
| 517 |
|
|---|
| 518 | pop es
|
|---|
| 519 | pop ds
|
|---|
| 520 | retf
|
|---|
| 521 | STRATEGY_ endp
|
|---|
| 522 |
|
|---|
| 523 | ;------------------------------------------------------------------------------
|
|---|
| 524 |
|
|---|
| 525 | ; in: ecx = ULONG cmd
|
|---|
| 526 | ; edx = ULONG parameter
|
|---|
| 527 | ; return value in eax
|
|---|
| 528 |
|
|---|
| 529 | ALIGN 4
|
|---|
| 530 | IDC_ proc far
|
|---|
| 531 | push ds
|
|---|
| 532 | push es
|
|---|
| 533 |
|
|---|
| 534 | mov eax, DOS32FLATDS
|
|---|
| 535 | mov ds, eax
|
|---|
| 536 | mov es, eax
|
|---|
| 537 |
|
|---|
| 538 | IFDEF KEE
|
|---|
| 539 | push stacksel
|
|---|
| 540 | push stackbase
|
|---|
| 541 |
|
|---|
| 542 | push edx
|
|---|
| 543 | mov stacksel, ss
|
|---|
| 544 | call KernThunkStackTo32
|
|---|
| 545 | mov stackbase, edx
|
|---|
| 546 | pop edx ;trashed by KernThunkStackTo32
|
|---|
| 547 |
|
|---|
| 548 | call SBLIVE_IDC
|
|---|
| 549 |
|
|---|
| 550 | mov ecx, eax
|
|---|
| 551 | call KernThunkStackTo16
|
|---|
| 552 | mov eax, ecx
|
|---|
| 553 |
|
|---|
| 554 | pop stackbase
|
|---|
| 555 | pop stacksel
|
|---|
| 556 | ELSE
|
|---|
| 557 | call SBLIVE_IDC
|
|---|
| 558 | ENDIF
|
|---|
| 559 | pop es
|
|---|
| 560 | pop ds
|
|---|
| 561 | retf
|
|---|
| 562 | IDC_ endp
|
|---|
| 563 |
|
|---|
| 564 | CODE32 ends
|
|---|
| 565 |
|
|---|
| 566 | ;------------------------------------------------------------------------------
|
|---|
| 567 |
|
|---|
| 568 | DATA32 segment
|
|---|
| 569 | public __OffsetFinalCS16
|
|---|
| 570 | public __OffsetFinalDS16
|
|---|
| 571 | public __wcpp_2_pure_error__
|
|---|
| 572 | public __wcpp_2_undef_vfun__
|
|---|
| 573 | public __wcpp_2_undefed_cdtor__
|
|---|
| 574 | public __wcpp_2_dtor_array_store__
|
|---|
| 575 | public _MSG_TABLE32
|
|---|
| 576 | public __OffBeginDS32
|
|---|
| 577 | public stackbase
|
|---|
| 578 | public stacksel
|
|---|
| 579 |
|
|---|
| 580 | ; __OffBeginDS32 dd 0
|
|---|
| 581 | __OffBeginDS32 label byte ; 32 data sgment starts here
|
|---|
| 582 |
|
|---|
| 583 | stacksel dd 0
|
|---|
| 584 | stackbase dd 0
|
|---|
| 585 |
|
|---|
| 586 | __OffsetFinalCS16 dw (OFFSET CODE16:__OffFinalCS16 - BEGINCS16)
|
|---|
| 587 | __OffsetFinalDS16 dw (OFFSET DATA16:__OffFinalDS16 - BEGINDS16)
|
|---|
| 588 |
|
|---|
| 589 | _MSG_TABLE32 dw (OFFSET DATA16:_MSG_TABLE16 - BEGINDS16)
|
|---|
| 590 | dw SEG DATA16:_MSG_TABLE16
|
|---|
| 591 |
|
|---|
| 592 | DATA32 ends
|
|---|
| 593 |
|
|---|
| 594 | ;------------------------------------------------------------------------------
|
|---|
| 595 |
|
|---|
| 596 | end
|
|---|
| 597 |
|
|---|