;       SCCSID = @(#)rasdevhl.asm       6.8 91/11/13
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************
PAGE    ,132
TITLE   RASDevHl - Devhlp RAS support routines
;***************************************************************************
;  Change History:
;  ptm      date  pgmr  comments
; ======= ======== === ==============================================
;B707702acw 09/11/89 acw Change ABIOSGetParms to trace out LID and Parm address
; 59714    930305 MikeD  Invalid RAS pre_invocation tracepoints defined
;***************************************************************************


; WARNING:  DO NOT use ArgVar, LocalVar, and EnterProc.  They depend
;           on being able to "Fiddle" with BP ...... These Procedures
;           all assume EBP points to the RAS DevHelp Table.



.xlist
.xcref
include devhlp.inc
include dosseg.inc
include basemaca.inc
include osmaca.inc
include devsym.inc
include rasmacro.inc
.cref
.list

        ModName rasdevhl
        CpuMode 386

IF RAS
        EXTRN   K_S_Systrace:near

Public  RASDevHelpDS,RASDevHelpDX

CONSTANTS SEGMENT

  RASDevHelpDS     dw 0         ; Device Driver DS
  RASDevHelpDX     dw 0         ; Device Driver DX

CONSTANTS ENDS

;       This is a summary of the RAS tracing for Devhlp's, pre and post
;       invocation.
;
;          +----------------------------------------------------------+
;          | Major Code  06  - Devhelps                               |
;          |   Pre-Invocation Trace Events                            |
;          +----------------------------------------------------------+
;          |                      |Minor|                             |
;          | Interface Name       | Code|   Parameters Passed         |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SchedClock    | 2C  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_DevDone       | 0B  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Yield         | 45  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_TCYield       | 35  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Block         | 09  |  event_id_low             W |
;          |                      |     |  event_id_high            W |
;          |                      |     |  timeout interval        DW |
;          |                      |     |  interruptible_flag       W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Run           | 2B  |  event_id_low             W |
;          |                      |     |  event_id_high            W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_ProcRun2      | 5D  |  event_id_low             W |
;          |                      |     |  event_id_high            W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SemRequest    | 2F  |  sem_handle_low           W |
;          |                      |     |  sem_handle_high          W |
;          |                      |     |  timeout value           DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SemClear      | 2D  |  sem_handle_low           W |
;          |                      |     |  sem_handle_high          W |
;          +----------------------------------------------------------+
;          | DevHlp_SemHandle     | 2E  |  sem_key_low              W |
;          |                      |     |  sem_key_high             W |
;          |                      |     |  usage flag               B |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PushReqPacket | 20  |  queue                    @ |
;          |                      |     |  request_packet           @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PullReqPacket | 1F  |  queue                    @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PullParticular| 1E  |  queue                    @ |
;          |                      |     |  request_packet           @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SortReqPacket | 34  |  queue                    @ |
;          |                      |     |  request_packet           @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_AllocReqPacket| 07  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_FreeReqPacket | 0F  |  request_packet           @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueInit     | 22  |  queue                    @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueFlush    | 21  |  queue                    @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueWrite    | 24  |  queue                    @ |
;          |                      |     |  character written        B |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueRead     | 23  |  queue                    @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Lock          | 14  |  segment_@                W |
;          |                      |     |  duration                 B |
;          |                      |     |  blockflag                B |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Unlock        | 37  |  lock_handle_low          W |
;          |                      |     |  lock_handle_high         W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PhysToVirt    | 1B  |  address to convert      DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_VirtToPhys    | 3C  |  address                 DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PhysToUVirt   | 1A  |  address_low              W |
;          |                      |     |  address_high             W |
;          |                      |     |  segment size             W |
;          |                      |     |  function code            W |
;          +----------------------------------------------------------+
;          | DevHlp_AllocPhys     | 06  |  size_low                 W |
;          |                      |     |  size_high                W |
;          |                      |     |  relative position        W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_FreePhys      | 0E  |  address_low              W |
;          |                      |     |  address_high             W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SetROMVector  | 32  |  none                     W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SetIRQ        | 31  |  IRQnum                   W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_UnSetIRQ      | 39  |  IRQnum                   W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SetTimer      | 33  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_ResetTimer    | 28  |  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_MonitorCreate | 16  |  Handle                   W |
;          |                      |     |  Final Buffer Seg:Off    DD |
;          |                      |     |  Notify Seg:Off          DD |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Register      | 26  |  monitor_handle           W |
;          |                      |     |  monitor_PID              W |
;          |                      |     |  placement flag           W |
;          |                      |     |  output buffer            W |
;          |                      |     |  Monitor buffer seg:inputDD |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_DeRegister    | 0A  |  monitor_handle           W |
;          |                      |     |  monitor_PID              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_MonWrite      | 18  |  data record             DW |
;          |                      |     |  count                    W |
;          |                      |     |  monitor handle           W |
;          |                      |     |  wait_flag                W |
;          |                      |     |  timeout_high (millsec)   W |
;          |                      |     |  timeout_low  (millsec)   W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_MonFlush      | 17  |  monitor_handle           W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_GetDOSVar     | 11  |  variable index           B |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SendEvent     | 30  |  event                    B |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_ROMCritSection| 2A  |  enter_exit flag          W |
;          +----------------------------------------------------------+
;          | DevHlp_EOI           | 0C  |  IRQNum                   W |
;          +----------------------------------------------------------+
;          | Minor Codes 12,0D,01,02,10    in ABIOSRAS.ASM(IBM Unique)|
;          +----------------------+-----+-----------------------------+
;          | DevHlp_UnPhysToVirt  | 38  |  none.                      |
;          +----------------------------------------------------------+
;          | DevHlp_TickCount     | 36  |  tick counts              W |
;          +----------------------------------------------------------+
;          | DevHlp_AllocGDTSelector|05 |  pSelectorArray           @ |
;          |                        |   |  Number of GDT selectors  W |
;          +----------------------------------------------------------+
;          | DevHlp_PhysToGDTSelector|19|  Address                 DW |
;          |                         |  |  Size                     W |
;          |                         |  |  Selector                 W |
;          +----------------------------------------------------------+
;          | DevHlp_PhysToGDTSel  | 51  |  Address                 DW |
;          |                      |     |  Size                    DW |
;          |                      |     |  Access                   W |
;          |                      |     |  Selector                 W |
;          +----------------------------------------------------------+
;          | DevHlp_RealToProt    | 25  |  Device Header            @ |
;          +----------------------------------------------------------+
;          | DevHlp_ProtToReal    | 1D  |  Device Header            @ |
;          +----------------------------------------------------------+
;          | DevHlp_VerifyAccess  | 3A  |  Target Sel. or Seg.      W |
;          |                      |     |  Memlength                W |
;          |                      |     |  Mem_Offset               W |
;          |                      |     |  Type of Access           W |
;          +----------------------------------------------------------+
;          | DevHlp_RAS           | 04  |  not traced                 |
;          +----------------------------------------------------------+
;          | DevHlp_ABIOSGetParms | 03  |  LID                      W | 7702acw
;          |                      |     |  Parms address            @ | 7702acw
;          +----------------------------------------------------------+
;          | DevHlp_AttachDD      | 08  |  none.                      |
;          +----------------------------------------------------------+
;          | DevHlp_InternalError | 13  |  none.                      |
;          +----------------------------------------------------------+
;          | dvh2c                | 7FFF|  none.                      |
;          +----------------------------------------------------------+
;          | Profile kernel       | 1C  |  none.                      |
;          +----------------------------------------------------------+
;          | DevHlp_RegisterStackUsage| 27  |  none.                  |
;          +----------------------------------------------------------+
;          | DevHlp_LogEntry      | 15  |  not traced                 |
;          +----------------------------------------------------------+
;          | DevHlp_GetDescInfo   | 4C  |  Selector                 W |
;          +----------------------------------------------------------+
;          | DevHlp_FreeGDTSelector|49  |  Selector                 W |
;          +----------------------------------------------------------+
;          | DevHlp_VMLock        | 41  |  Action flags            DW |
;          |                      |     |  Linear address           F |
;          |                      |     |  Length                  DW |
;          |                      |     |  pPageList                F |
;          |                      |     |  pLockHandle              F |
;          +----------------------------------------------------------+
;          | DevHlp_VMUnlock      | 43  |  LockHandle             3DW |
;          +----------------------------------------------------------+
;          | DevHlp_VMAlloc       | 3D  |  Flags                   DW |
;          |                      |     |  Size                    DW |
;          |                      |     |  PhysAddr                 F |
;          +----------------------------------------------------------+
;          | DevHlp_VMFree        | 3E  |  Linear address           F |
;          +----------------------------------------------------------+
;          | DevHlp_VMProcessToGlobal|42|  Action flags            DW |
;          |                         |  |  Linear address           F |
;          |                         |  |  Length                  DW |
;          +----------------------------------------------------------+
;          | DevHlp_VMGlobalToProcess|3F|  Action flags            DW |
;          |                         |  |  Linear address           F |
;          |                         |  |  Length                  DW |
;          +----------------------------------------------------------+
;          | DevHlp_VirtToLin     | 4A  |  Selector                 W |
;          |                      |     |  Offset                  DW |
;          +----------------------------------------------------------+
;          | DevHlp_LinToGDTSelector| 4B|  Selector                 W |
;          |                        |   |  Linear address           F |
;          |                        |   |  Size                    DW |
;          +----------------------------------------------------------+
;          | DevHlp_LinToPageList | 4D  |  Linear address           F |
;          |                      |     |  Size                    DW |
;          |                      |     |  pPageList                F |
;          +----------------------------------------------------------+
;          | DevHlp_PageListToLin | 4E  |  Size                    DW |
;          |                      |     |  pPageList                F |
;          +----------------------------------------------------------+
;          | DevHlp_PageListToGDTSelector|4F| Selector              W |
;          |                             |  | Size                 DW |
;          |                             |  | Access               DW |
;          |                             |  | pPageList             F |
;          +----------------------------------------------------------+
;          | RAS_Save_Message     | 50  |  not traced                 |
;          +----------------------------------------------------------+
;          | RAS_VideoPause       | 52  |  not traced                 |
;          +----------------------------------------------------------+
;          | DevHlp_VMSetMem      | 56  |  Action flags            DW |
;          |                      |     |  Linear Address           F |
;          |                      |     |  Size                    DW |
;          +----------------------------------------------------------+
;          | DevHlp_OpenEventSem  | 57  |  sem_handle              DW |
;          +----------------------------------------------------------+
;          | DevHlp_CloseEventSem | 58  |  sem_handle              DW |
;          +----------------------------------------------------------+
;          | DevHlp_PostEventSem  | 59  |  sem_handle              DW |
;          +----------------------------------------------------------+
;          | DevHlp_ResetEventSem | 5A  |  sem_handle              DW |
;          |                      |     |  post_count              DW |
;          +----------------------------------------------------------+
;          | DevHlp_RegisterKrnlExit |5F|  Selector of exit rtn     W | 78486
;          |                         |  |  flags                    W | 78486
;          |                         |  |  exit type                W | 78486
;          |                         |  |  offset of exit rtn       W | 78486
;          +----------------------------------------------------------+
;
;          3.10.2 Devhelps Post-Invocation Trace Events
;
;
;
;          +----------------------------------------------------------+
;          | Major Code  06  - Devhelps                               |
;          |   Post-Invocation Trace Events                           |
;          +----------------------------------------------------------+
;          |                      |Minor|                             |
;          | Interface Name       | Code|   Parameters Passed         |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SchedClock    | 802C|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_DevDone       | 800B|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Yield         | 8045|  return code.             W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_TCYield       | 8035|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Block         | 8009|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Run           | 802B|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SemRequest    | 802F|  return code.             W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SemClear      | 802D|  return code.             W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SemHandle     | 802E|  return code              W |
;          |                      |     |  semahandle              DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PushReqPacket | 8020|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PullReqPacket | 801F|  return code              W |
;          |                      |     |  request packet           @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PullParticular| 801E|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SortReqPacket | 8034|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_AllocReqPacket| 8007|  return code              W |
;          |                      |     |  request packet           @ |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_FreeReqPacket | 800F|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueInit     | 8022|  none.                      |
;          +----------------------------------------------------------+
;          | DevHlp_QueueFlush    | 8021|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueWrite    | 8024|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_QueueRead     | 8023|  return code              W |
;          |                      |     |  character read           B |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Lock          | 8014|  return code              W |
;          |                      |     |  lock handle             DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Unlock        | 8037|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PhysToVirt    | 801B|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_VirtToPhys    | 803C|  return code              W |
;          |                      |     |  physical address        DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_PhysToUVirt   | 801A|  return code              W |
;          |                      |     |  selector                 W |
;          |                      |     |  offset                   W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_AllocPhys     | 8006|  return code              W |
;          |                      |     |  physical address        DW |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_FreePhys      | 800E|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SetROMVector  | 8032|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SetIRQ        | 8031|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_UnSetIRQ      | 8039|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SetTimer      | 8033|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_ResetTimer    | 8028|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_MonitorCreate | 8016|  return code              W |
;          |                      |     |  chain handle             W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_Register      | 8026|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_DeRegister    | 800A|  return code              W |
;          |                      |     |  number of monitors       W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_MonWrite      | 8018|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_MonFlush      | 8017|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_GetDOSVar     | 8011|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_SendEvent     | 8030|  return code              W |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_ROMCritSection| 802A|  none.                      |
;          +----------------------+-----+-----------------------------+
;          | DevHlp_EOI           | 800C|  return code              W |
;          +----------------------------------------------------------+
;          | Minor Codes 8012,800D,8001,8002,8010 in ABIOSRAS.ASM(IBM Unique)|
;          +----------------------+-----+-----------------------------+
;          | DevHlp_UnPhysToVirt  | 8038|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_TickCount     | 8036|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_AllocGDTSelector|8005| return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_PhysToGDTSelector|8019|return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_PhysToGDTSel  | 8051|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_RealToProt    | 8025|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_ProtToReal    | 801D|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_VerifyAccess  | 803A|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_RAS           | 8004|  not traced                 |
;          +----------------------------------------------------------+
;          | DevHlp_ABIOSGetParms | 8003|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_AttachDD      | 8008|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_InternalError | 8013|  not traced                 |
;          +----------------------------------------------------------+
;          | dvh2c                | FFFF|  none.                      |
;          +----------------------------------------------------------+
;          | Profile kernel       | 801C|  none.                      |
;          +----------------------------------------------------------+
;          | DevHlp_RegisterStackUsage | 8027|  return code         W |
;          +----------------------------------------------------------+
;          | DevHlp_LogEntry      | 8015|  Not traced                 |
;          +----------------------------------------------------------+
;          | DevHlp_GetDescInfo   | 804C|  Return code              W |
;          |                      |     |  Attibute byte            B |
;          |                      |     |  Access byte              B |
;          |                      |     |  Phys. Address           DW |
;          |                      |     |  Descr. Limit            DW |
;          +----------------------------------------------------------+
;          | DevHlp_FreeGDTSelector|8049|  return code             DW |
;          +----------------------------------------------------------+
;          | DevHlp_VMLock        | 8041|  return code              W |
;          +----------------------------------------------------------+
;          | DevHlp_VMUnlock      | 8043|  return code             DW |
;          +----------------------------------------------------------+
;          | DevHlp_VMAlloc       | 803D|  return code             DW |
;          |                      |     |  PhysAddr                 F |
;          +----------------------------------------------------------+
;          | DevHlp_VMFree        | 803E|  return code             DW |
;          +----------------------------------------------------------+
;          | DevHlp_VMProcessToGlobal|8042| return code            DW |
;          |                         |    | Linear address         DW |
;          +----------------------------------------------------------+
;          | DevHlp_VMGlobalToProcess|803F| return code            DW |
;          |                         |    | Linear address         DW |
;          +----------------------------------------------------------+
;          | DevHlp_VirtToLin     | 804A|  return code             DW |
;          |                      |     |  linear address          DW |
;          +----------------------------------------------------------+
;          | DevHlp_LinToGDTSelector|804B| return code             DW |
;          +----------------------------------------------------------+
;          | DevHlp_LinToPageList | 804D|  return code             DW |
;          +----------------------------------------------------------+
;          | DevHlp_PageListToLin | 804E|  return code             DW |
;          |                      |     |  linear address          DW |
;          +----------------------------------------------------------+
;          | DevHlp_PageListToGDTSelector|804F| return code        DW |
;          +----------------------------------------------------------+
;          | RAS_Save_Message     | 8050  |  not traced               |
;          +----------------------------------------------------------+
;          | RAS_VideoPause       | 8052  |  not traced               |
;          +----------------------------------------------------------+
;          | DevHlp_VMSetMem      | 8056  | return code            DW |
;          +----------------------------------------------------------+
;          | DevHlp_OpenEventSem  | 8057  |  return code            W |
;          +----------------------------------------------------------+
;          | DevHlp_CloseEventSem | 8058  |  return code            W |
;          +----------------------------------------------------------+
;          | DevHlp_PostEventSem  | 8059  |  return code            W |
;          +----------------------------------------------------------+
;          | DevHlp_ResetEventSem | 805A  |  return code            W |
;          |                      |       |  post_count            DW |
;          +----------------------------------------------------------+
;          | DevHlp_RegisterKrnlExit|805F |return code              W | 78486
;          +----------------------------------------------------------+
;

        FARCODE HIGH4
RASLOCKCODE SEGMENT


;** RAS_Noparms - perform RAS pre-invocation tracing for devhlps
;                 with no parameters traced
;
;       Calls K_S_Systrace with appropriate major and minor codes
;
;       ENTRY:  (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_Noparms,near
Entry   RAS_SchedAddr
Entry   RAS_DevDone
Entry   RAS_Yield
Entry   RAS_dh_YieldTC
Entry   RAS_AllocReqPacket
Entry   RAS_dh_SetTimer
Entry   RAS_dh_ResetTimer

Entry   RAS_dh_AttachDD
Entry   RAS_dh_InternalError
Entry   RAS_dvh39

Entry   RAS_dh_UnPhysToVirt
Entry   RAS_dh_RegisterStackUsage
Entry   RAS_dh_SetROMVector
Entry   RAS_dh_DynamicAPI

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    ax                      ; save regs
        push    bx
        push    dx

        mov     al,RAS_MC_DEVHLP        ; Major code for devhlps
        xor     bx,bx                   ; (BX) = data length
        mov     dx,cs:[ebp].preminor     ; (DX) = minor code
        call    K_S_Systrace

        pop     dx
        pop     bx
        pop     ax
        ret
EndProc RAS_Noparms


;** RAS_AxBxparms - perform pre-invocation RAS tracing for devhlps
;                   with parms in AX:BX
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX:BX) = dword parameter for buffer
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBxparms,near
Entry   RAS_dh_DeRegister
Entry   RAS_ProcRun
Entry   RAS_ProcRun2
Entry   RAS_dh_SemClear
Entry   RAS_SegUnlockDM
Entry   RAS_FreePhysDM
Entry   RAS_dh_PhysToVirt

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    ds
        push    dx

        push    ax                      ; address high
        push    bx                      ; address low

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     bx
        pop     ax

        pop     dx
        pop     ds
        pop     si
        ret
EndProc RAS_AxBxparms

;** RAS_CxDiparms - perform pre-invocation RAS tracing for devhlps
;                   with parms in CX:DI
;
;   added for defect 59714
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CX:DI) = entry point
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CxDiparms,near
Entry   RAS_dh_RegisterTmrDD
Entry   RAS_dh_RegisterBeep

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    ds
        push    dx
        push    bx

        push    cx                      ; address high
        push    di                      ; address low

        mov     dx,cs:[ebp].preminor    ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     di
        pop     cx

        pop     bx
        pop     dx
        pop     ds
        pop     si
        ret
EndProc RAS_CxDiparms

;** RAS_BxCxparms - perform pre-invocation RAS tracing for devhlps
;                   with parms in BX & CX
;
;   added for defect 59714
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (BX) = beep frequency
;               (CX) = beep duration
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_BxCxparms,near
Entry   RAS_dh_Beep

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    ds
        push    dx

        push    cx                      ; beep duration
        push    bx                      ; beep frequency

        mov     dx,cs:[ebp].preminor    ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     bx
        pop     cx

        pop     dx
        pop     ds
        pop     si
        ret
EndProc RAS_BxCxparms


;** RAS_AxBxDhparms - perform RAS tracing for devhlps with AX:BX and
;                     DH as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX:BX) = event identifier
;               (DH)    = interruptibility flag
;               -- DX is really RASStackEDX
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBxDhparms,near
Entry   RAS_dh_SemHandle
Entry   RAS_AllocPhysDM

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX


        push    si
        push    dx
        push    ds

        shr     RASDevHelpDX,8          ; move interruptibility flag down
        push    RASDevHelpDX            ; interruptible flag
        push    ax                      ; event id high
        push    bx                      ; event id low

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        pop     ax
        add     sp,2                    ; remove RASDevHelpDS/DX parms

        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_AxBxDhparms

;** RAS_BxDhparms - perform RAS tracing for devhlps with BX and DH as parms
;
;   added for defect 59714
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (BX)    = absolute thread number
;               (DH)    = keyboard switch
;               -- DX is really RASStackEDX
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_BxDhparms,near
Entry   RAS_dh_ModifyPriority

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX


        push    si
        push    dx
        push    ds

        shr     RASDevHelpDX,8          ; move interruptibility flag down
        push    RASDevHelpDX            ; interruptible flag
        push    bx                      ; event id low

        mov     dx,cs:[ebp].preminor    ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        add     sp,2                    ; remove RASDevHelpDS/DX parms

        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_BxDhparms

;** RAS_EsDiCxparms - perform RAS tracing for devhlps with ES:DI and
;                     CX as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (ES:DI) = pSelectorArray
;               (CX)    = number of GDT selectors
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EsDiCxparms,near
Entry   RAS_dh_AllocGDTSelector

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    dx
        push    ds
        push    bx
        push    ax

        push    cx
        push    es
        push    di

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     di                      ; restore regs
        pop     es
        pop     cx

        pop     ax
        pop     bx
        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_EsDiCxparms

;** RAS_AxBxCxSiparms - perform RAS tracing for devhlps with AX:BX, SI and
;                       CX as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX:BX) = Address
;               (CX)    = Size
;               (SI)    = Selector
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBxCxSiparms,near
Entry   RAS_dh_PhysToGDTSelector
Entry   RAS_dh_RegisterKrnlExit

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx
        push    ds

        push    si
        push    cx
        push    ax
        push    bx

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        pop     ax
        pop     cx
        pop     si

        pop     ds
        pop     dx
        ret
EndProc RAS_AxBxCxSiparms

;** RAS_SiAxDiBxCxparms - perform RAS tracing for devhlps with
;                                 SI:AX, DI:BX and CX as parms
;
;   added for defect 59714
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (SI:AX) = Address, counter block
;               (DI:BX) = Address, text    block
;               (CX)    = Flags, 16 / 32 bit
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_SiAxDiBxCxparms,near
Entry   RAS_dh_RegisterPerfCtrs

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx
        push    ds

        push    cx
        push    di
        push    bx
        push    si
        push    ax

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,10                   ; 10 bytes of parms.
        call    K_S_Systrace

        pop     ax                      ; restore regs
        pop     si
        pop     bx
        pop     di
        pop     cx

        pop     ds
        pop     dx
        ret
EndProc RAS_SiAxDiBxCxparms

;** RAS_EsDiDsSiparms - perform RAS tracing for devhlps with
;                                      ES:DI, DS:SI as parms
;
;   added for defect 59714
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (ES:DI) = PDD entry point for VDD
;               (DS:SI) = PDD name
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EsDiDsSiparms,near
Entry   RAS_dh_RegisterPDD

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    bx
        push    dx
        push    ds

        push    ds
        push    si
        push    es
        push    di

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     di                      ; restore regs
        pop     es
        pop     si
        pop     ds

        pop     ds
        pop     dx
        pop     bx
        ret
EndProc RAS_EsDiDsSiparms

;** RAS_AxBxDiCxparms - perform RAS tracing for devhlps with AX:BX and
;                       DI:CX as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX:BX) = Address
;               (DI:CX) = Value
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBxDiCxparms,near
Entry   RAS_dh_SemRequest

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    dx
        push    ds

        push    di
        push    cx
        push    ax
        push    bx

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        pop     ax
        pop     cx
        pop     di

        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_AxBxDiCxparms

;** RAS_AxBxCxDhparms - perform RAS tracing for devhlps with AX:BX, DH and
;                       CX as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX:BX) = Address
;               (CX)    = Size
;               (DH)    = Function code
;               -- DX is really RASStackEDX
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBxCxDhparms,near
Entry   RAS_dh_PhysToUVirt

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX                    ; Device Driver DX

        push    si
        push    dx
        push    ds

        shr     RASDevHelpDX,8                  ; put DH in low byte, zero high
        push    RASDevHelpDX
        push    cx
        push    ax
        push    bx

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        pop     ax
        pop     cx
        add     sp,2                    ; skip RASDevHelpDS/DX parms

        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_AxBxCxDhparms

;** RAS_AxBxDiCxDhparms - perform RAS tracing for devhlps with AX:BX,
;                        DI:CX, and DH as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX:BX) = Address
;               (DI:CX) = Timeout Interval
;               (DH)    = Flag
;               -- DX is really RASStackEDX
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBxDiCxDhparms,near
Entry   RAS_ProcBlock

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX                    ; Device Driver DX

        push    si
        push    dx
        push    ds

        shr     RASDevHelpDX,8                  ; move DH into low byte
        push    RASDevHelpDX
        push    di
        push    cx
        push    ax
        push    bx

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,10                   ; 10 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        pop     ax
        pop     cx
        pop     di
        add     sp,2

        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_AxBxDiCxDhparms

;** RAS_DsBxAlparms - perform RAS tracing for devhlps with DS:BX and
;                     AL as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (DS:BX) = Queue
;               -- DS is really RASStackDS
;               (AL)    = Character byte
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_DsBxAlparms,near
Entry   RAS_QueueWrite

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS                    ; Device Driver DS

        push    si
        push    dx
        push    ds

        push    ax                              ; low byte has character in it
        push    RASDevHelpDS
        push    bx

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,5                   ; 5 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; restore regs
        add     sp,2                    ; skip RASDevHelpDS/DX parm
        pop     ax

        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_DsBxAlparms

;** RAS_AxBhBlparms - perform RAS tracing for devhlps with AX, Bh, and Bl
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX) = Segment
;               (BH) = Duration
;               (BL) = Flag
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxBhBlparms,near
Entry   RAS_SegLockDM

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    dx
        push    ds
        push    bx

        xchg    bh,bl                    ; exchange order for systrace
        push    bx
        push    ax

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     ax                      ; restore regs
        pop     bx

        pop     bx
        pop     ds
        pop     dx
        pop     si
        ret
EndProc RAS_AxBhBlparms


;** RAS_PushPullpartSortPacket - common RAS code for Push, Pull, Sort request packet devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (DS:SI) = pointer to queue
;               -- DS is really RASStackDS
;               (ES:BX) = pointer to request packet
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_PushPullpartSortPacket ,near
Entry   RAS_PushRequest
Entry   RAS_PullParticular
Entry   RAS_SortRequest

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    ax                      ; save some regs
        push    ds
        push    dx

        push    es
        push    bx                      ; push parms on the stack
        push    RASDevHelpDS            ; Device Driver DS
        push    si

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     si                      ; clear parms from the stack
        add     sp,2                    ; remove RASDevHelpDS/DX parms
        pop     bx
        pop     es

        pop     dx                      ; restore regs
        pop     ds
        pop     ax
        ret
EndProc RAS_PushPullpartSortPacket


;** RAS_DsSiparms - perform RAS tracing for devhlps with DS:SI parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (DS:SI) = pointer to queue
;               -- DS is really RASStackDS
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_DsSiparms,near
Entry   RAS_PullRequest
Entry   RAS_VirtToPhysDM
Entry   RAS_dh_RealToProt
Entry   RAS_dh_ProtToReal

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    ax
        push    bx
        push    dx
        push    ds

        push    RASDevHelpDS
        push    si                      ; push parms on stack

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     si                      ; clear parms
        add     sp,2                    ; skip RASDevHelpDS/DX parms

        pop     ds
        pop     dx                      ; restore regs
        pop     bx
        pop     ax
        ret
EndProc RAS_DsSiparms



;** RAS_EsBxparms - perform RAS tracing for devhlps with ES:BX parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (ES:BX) = tiled request packed
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EsBxparms,near
Entry   RAS_FreeReqPacket

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    ds
        push    ax
        push    dx                      ; save dx

        push    es
        push    bx                      ; push parms on stack

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; clear stack
        pop     es

        pop     dx                      ; restore dx
        pop     ax
        pop     ds
        pop     si
        ret
EndProc RAS_EsBxparms


;** RAS_QueueTrace - perform RAS tracing for Queue* functions devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (DS:BX) Points to the queue structure
;               -- DS is really RASStackDS
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_QueueTrace ,near
Entry   RAS_QueueInit
Entry   RAS_QueueFlush
Entry   RAS_QueueRead

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    si
        push    ax
        push    dx                      ; save dx
        push    ds

        push    RASDevHelpDS            ; Device Driver DS
        push    bx                      ; push parms on stack

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     bx                      ; clear stack
        add     sp,2                    ; skip RASDevHelpDS/DX parms

        pop     ds
        pop     dx                      ; restore dx
        pop     ax
        pop     si
        ret
EndProc RAS_QueueTrace


;** RAS_Axparms - perform RAS tracing for devhlps with AX parm
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (AX) = Segment or Selector (mode dependent)
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_Axparms,near
Entry   RAS_dh_MonFlush
Entry   RAS_dh_FreeGDTSelector
Entry   RAS_dh_GetDescInfo

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save some regs
        push    dx
        push    bx
        push    ds

        push    ax                      ; push seg/selector on stack

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     ax

        pop     ds
        pop     bx
        pop     dx                      ; restore dx
        pop     si
        ret
EndProc RAS_Axparms

;** RAS_Bxparms - perform RAS tracing for devhlps with BX parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (BX) = Interrupt or IRQ number
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_Bxparms,near
Entry   RAS_dh_SetIRQ
Entry   RAS_dh_UnSetIRQ
Entry   RAS_dh_TickCount

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    dx                      ; save dx
        push    ds
        push    ax

        push    bx                      ; Interrupt or IRQ Number

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     bx

        pop     ax
        pop     ds
        pop     dx                      ; restore dx
        pop     si
        ret
EndProc RAS_Bxparms


;** RAS_dh_MonWrite - perform RAS tracing for dh_MonWrite devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (DS:SI) = Data_record
;               -- DS is really RASStackDS
;               (CX)    = Count
;               (AX)    = Monitor_handle
;               (DH)    = Wait_flag
;               -- DX is really RASStackEDX
;               (DI)    = Timeout_high (milliseconds)
;               (BX)    = Timeout_low  (milliseconds)
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_MonWrite,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX

        push    bx                   ; Save all regs affected by trace call
        push    dx
        push    ds

        push    bx
        push    di
        shr     RASDevHelpDX,8       ; Put dh in low byte,zero high byte
        push    RASDevHelpDX
        push    ax
        push    cx
        push    RASDevHelpDS         ; Device Driver DS
        push    si

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,14                   ; 14 bytes of parms.
        call    K_S_Systrace

        pop     si
        add     sp,2                    ; skip RASDevHelpDS/DX parms
        pop     cx
        pop     ax
        add     sp,2                    ; skip RASDevHelpDS/DX parms
        pop     di
        pop     bx

        pop     ds
        pop     dx
        pop     bx

        ret
EndProc RAS_dh_MonWrite


;** RAS_dh_MonitorCreate - perform RAS tracing for dh_MonCreate devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (ES:SI) = Final_buffer_seg : Final_buffer_offset
;               (DS:DI) = Notify_seg : Notify_offset
;               -- DS is really RASStackDS
;               (AX)    = Handle
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_MonitorCreate,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    bx
        push    dx
        push    ds

        push    ax                      ; Place parameters on stack
        push    RASDevHelpDS
        push    di
        push    es
        push    si

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,10                   ; 10 bytes of parms.
        call    K_S_Systrace

        pop     si
        pop     es
        pop     di
        add     sp,2                    ; skip RASDevHelpDS/DX parms
        pop     ax

        pop     ds
        pop     dx                   ;Restore all regs affected by trace call
        pop     bx
        ret
EndProc RAS_dh_MonitorCreate


;** RAS_dh_Register - perform RAS tracing for dh_Register devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (ES)    = Monitor segment
;               (SI)    = Input_buffer
;               (DI)    = Output_buffer
;               (CX)    = Monitor_PID
;               (AX)    = Monitor_handle
;               (DH)    = Placement_flag
;               -- DX is really RASStackEDX
;               (BP)    = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags

Procedure RAS_dh_Register,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX

        push    bx                   ;Save all regs affected by trace call
        push    dx
        push    ds

        shr     RASDevHelpDX,8       ;put dh in low byte,zero out high byte
        push    RASDevHelpDX
        push    ax
        push    cx
        push    di
        push    si
        push    es

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     es
        pop     si
        pop     di
        pop     cx
        pop     ax
        add     sp,2                    ; skip RASDevHelpDS/DX parms

        pop     ds                   ;Restore all regs affected by trace call
        pop     dx
        pop     bx
        ret
EndProc RAS_dh_Register

;** RAS_Ahparms - perform RAS tracing for devhlps with AH parm
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (AH) = Event number
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_Ahparms,near
Entry   RAS_dh_SendEvent

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    dx                      ; save some regs
        push    bx
        push    ds
        push    ax

        movzx   ax,ah                   ;put AH in low byte,zero out high byte
        push    ax                      ; (AH) = event number

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     ax                      ; remove argument

        pop     ax                      ; restore ax

        pop     ds
        pop     bx
        pop     dx                      ; restore dx
        pop     si
        ret
EndProc RAS_Ahparms


;** RAS_dh_VerifyAccess - perform RAS tracing for dh_VerifyAccess devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (AX) = Target Selector or Segment
;               (CX) = Memlength
;               (DI) = Mem_Offset
;               (DH) = Type of Access
;               -- DX is really RASStackEDX
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_VerifyAccess,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX

        push    si
        push    dx                      ; save some regs
        push    bx
        push    ds

        shr     RASDevHelpDX,8          ;put dh in low byte,zero out high byte
        push    RASDevHelpDX
        push    di
        push    cx
        push    ax

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     cx
        pop     di
        add     sp,2                    ; skip RASDevHelpDS/DX parms

        pop     ds
        pop     bx
        pop     dx                      ; restore dx
        pop     si
        ret
EndProc RAS_dh_VerifyAccess

;** RAS_dh_VMLock - perform RAS tracing for dh_VMLock devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = flags, action to be taken
;               (EBX) = linear address
;               (ECX) = size
;               (EDI) = pointer to location to write array
;               (ESI) = pointer to location to write 64 bit lockhandle
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_VMLock,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    ds

        push    esi
        push    edi
        push    ecx
        push    ebx
        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,20                   ; 20 bytes of parms.
        call    K_S_Systrace

        pop     eax
        pop     ebx                     ; remove argument
        pop     ecx
        pop     edi
        pop     esi

        pop     ds
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_VMLock

;** RAS_dh_VMUnlock - perform RAS tracing for dh_VMUnlock devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (DS:ESI) = address to read lock handle
;               -- DS is really RASStackDS
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_VMUnlock,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    dx                      ; save some regs
        push    ax
        push    bx
        push    ds
        push    si

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

;        push    RASDevHelpDS             ; set up segment register
;        pop     ds
        FlatContext ds

        push    dword ptr ds:[esi]+8     ; put contents of address
        push    dword ptr ds:[esi]+4     ; onto stack for systrace to
        push    dword ptr ds:[esi]       ; put into buffer


        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        add     sp,12                   ; remove argument

        pop     si
        pop     ds
        pop     bx
        pop     ax
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_VMUnlock

;** RAS_dh_VMAlloc - perform RAS tracing for dh_VMAlloc devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = action flags
;               (ECX) = size of memory to be allocated
;               (EDI) = phys. address to be mapped
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_VMAlloc,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds
        push    bx

        push    edi
        push    ecx
        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument
        pop     ecx
        pop     edi

        pop     bx
        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_VMAlloc

;** RAS_EAXparms - perform RAS tracing for devhlps with EAX parm
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = linear address of memory object
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EAXparms,near
Entry   RAS_dh_VMFree
Entry   RAS_dh_FreeCtxHook
Entry   RAS_dh_OpenEventSem
Entry   RAS_dh_CloseEventSem
Entry   RAS_dh_PostEventSem

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds
        push    bx

        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument

        pop     bx
        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_EAXparms

;** RAS_EAXECXDHSIparms - perform RAS tracing for devhlps with EAX,
;                         ECX, DH, and SI as parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = Address
;               (ECX) = Size
;               (DH)  = Access
;               -- DX is really RASStackEDX
;               (SI)  = Selector
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EAXECXDHSIparms,near
Entry   RAS_dh_PhysToGDTSel

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX

        push    dx                      ; save some regs
        push    ds
        push    bx

        push    si
        shr     RASDevHelpDX,8          ; put DH in the low byte, zero high
        push    RASDevHelpDX
        push    ecx
        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument
        pop     ecx
        add     sp,2
        pop     si

        pop     bx
        pop     ds
        pop     dx                      ; restore dx
        ret
EndProc RAS_EAXECXDHSIparms

;** RAS_EAXEBXECXparms - perform RAS tracing for devhlps with EAX,EBX,ECX
;                        parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = action flags
;               (EBX) = linear address of region to be aliased
;               (ECX) = size of region to be aliased
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EAXEBXECXparms,near
Entry RAS_dh_VMProcessToGlobal
Entry RAS_dh_VMGlobalToProcess
Entry RAS_dh_ArmCtxHook
Entry RAS_dh_VMSetMem

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds

        push    ecx
        push    ebx
        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument
        pop     ebx
        pop     ecx

        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_EAXEBXECXparms

;** RAS_EAXEBXparms - perform RAS tracing for devhlps with EAX,EBX parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = action flags
;               (EBX) = linear address of region to be aliased
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EAXEBXparms,near
Entry RAS_dh_AllocateCtxHook

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds

        push    ebx
        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8  bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument
        pop     ebx

        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_EAXEBXparms

;** RAS_EAXEDIparms - perform RAS tracing for devhlps with EAX,EDI parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = semaphore handle
;               (EDI) = linear address of post count
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EAXEDIparms,near
Entry RAS_dh_ResetEventSem

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds
        push    bx

        mov     dx,ds
        FlatContext     ds,bx
        push    dword ptr [edi]
        push    eax
        mov     ds,dx

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument
        add     esp,4

        pop     bx
        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_EAXEDIparms

;** RAS_AxEsiparms - perform RAS tracing for devhlps with AX,ESI parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (AX) = selector
;               (ESI) = offset
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AxEsiparms,near
Entry   RAS_dh_VirtToLin

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    ds
        push    bx

        push    esi
        push    ax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     ax                      ; remove argument
        pop     esi

        pop     bx
        pop     ds
        pop     dx                      ; restore dx
        ret
EndProc RAS_AxEsiparms

;** RAS_dh_LinToGDTSelector - perform RAS tracing for dh_LinToGDTSelector devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (AX)  = selector
;               (EBX) = linear address
;               (ECX) = length
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_LinToGDTSelector,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds

        push    ecx
        push    ebx
        push    ax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,10                   ; 10 bytes of parms.
        call    K_S_Systrace

        pop     ax                      ; remove argument
        pop     ebx
        pop     ecx

        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_LinToGDTSelector

;** RAS_dh_LinToPageList - perform RAS tracing for dh_LinToPageList devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (EAX) = base linear address
;               (ECX) = count of bytes
;               (EDI) = pointer to return buffer
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_LinToPageList,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds
        push    bx

        push    edi
        push    ecx
        push    eax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     eax                     ; remove argument
        pop     ecx
        pop     edi

        pop     bx
        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_LinToPageList

;** RAS_dh_PageListToLin - perform RAS tracing for dh_PageListToLin devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (ECX) = sum of size of fields in PageList array
;               (EDI) = pointer to array
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_PageListToLin,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save some regs
        push    si
        push    ds
        push    ax
        push    bx

        push    edi
        push    ecx

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     ecx                     ; remove argument
        pop     edi

        pop     bx
        pop     ax
        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_PageListToLin

;** RAS_dh_PageListToGDTSelector - perform RAS tracing for
;                                  PageListToGDTSelector devhlp
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY   (AX) = selector to map
;               (ECX) = sum of the pl_cb fields
;               (DH) = descriptor privilege
;               -- DX is really RASStackEDX
;               (EDI) = pointer to array of structures
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_PageListToGDTSelector,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackEDX
        pop     RASDevHelpDX            ; Device Driver DX

        push    dx                      ; save some regs
        push    si
        push    ds
        push    bx

        push    edi
        shr     RASDevHelpDX,8
        push    RASDevHelpDX
        push    ecx
        push    ax

        mov     dx,cs:[ebp].preminor     ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     ax                      ; remove argument
        pop     ecx
        add     sp,2
        pop     edi

        pop     bx
        pop     ds
        pop     si
        pop     dx                      ; restore dx
        ret
EndProc RAS_dh_PageListToGDTSelector

;** RAS_NoTrace - do not perform RAS tracing for devhlps
;
;       Pretracing is not performed for this devhlp.
;
;       ENTRY   (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_NoTrace,near
Entry     RAS_dh_RAS
Entry     RAS_dh_LogEntry                      ; Error Logging not traced
Entry     RAS_dh_VideoPause
Entry     RAS_Save_Message

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING
        ret

EndProc RAS_NoTrace

;** RAS_dh_ABIOSGetParms - RAS code for ABIOSGetParms devhlp            7702acw
;                                                                       7702acw
;       Sets up parameters on the stack and calls K_S_Systrace          7702acw
;       to enter parameters into RAS circular buffer.                   7702acw
;                                                                       7702acw
;       ENTRY:  (AX)    = Logical ID                                    7702acw
;               (DS:SI) = pointer to ABIOS Parameter Area               7702acw
;               -- DS is really RASStackDS
;       EXIT:   none                                                    7702acw
;                                                                       7702acw
;       USES:   flags                                                   7702acw
Procedure RAS_dh_ABIOSGetParms ,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    word ptr ss:[esp].RASStackDS
        pop     RASDevHelpDS            ; Device Driver DS

        push    bx                      ; save some regs
        push    dx
        push    ds

        push    RASDevHelpDS
        push    si
        push    ax                      ; push parms on the stack

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     si                      ; clear parms from the stack
        add     sp,2                    ; skip RASDevHelpDS/DX parms

        pop     ds
        pop     dx                      ; restore regs
        pop     bx
        ret
EndProc RAS_dh_ABIOSGetParms

;** RAS_Alparms - RAS code for devhlps with AL parm
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AL)    = IRQ number
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_Alparms,near
Entry   RAS_dh_EOI
Entry   RAS_GetDOSVar
Entry   RAS_dh_ROMCritSection

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    bx                      ; save some regs
        push    ds
        push    si
        push    dx
        push    ax

        movzx   ax,al
        push    ax                      ; push parms on the stack

        mov     dx,cs:[ebp].preminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     ax

        pop     ax                      ; clear parms from stack
        pop     dx
        pop     si
        pop     ds
        pop     bx

        ret
EndProc RAS_Alparms



;******************* POST INVOCATION CALLS *******************

;** RAS_Noparms_post - perform RAS post-invocation tracing for devhlps
;                      with no parameters traced
;
;       Calls K_S_Systrace with appropriate major and minor codes
;
;       ENTRY:  (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_Noparms_post,near
Entry   RAS_SchedAddr_post
Entry   RAS_DevDone_post
Entry   RAS_dh_YieldTC_post
Entry   RAS_ProcBlock_post
Entry   RAS_ProcRun_post
Entry   RAS_ProcRun2_post
Entry   RAS_PushRequest_post
Entry   RAS_SortRequest_post
Entry   RAS_QueueInit_post
Entry   RAS_QueueFlush_post
Entry   RAS_FreePhysDM_post
Entry   RAS_dh_SetROMVector_post
Entry   RAS_dh_ROMCritSection_post

Entry   RAS_dvh39_post
Entry   RAS_dh_ModifyPriority_post
Entry   RAS_dh_DynamicAPI_post

Entry   RAS_dh_RegisterPDD_post               ; Defect 59714
Entry   RAS_dh_RegisterBeep_post              ; Defect 59714

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    ax
        push    bx
        push    dx

        mov     al,RAS_MC_DEVHLP        ; Major code for devhlps
        xor     bx,bx                   ; (BX) = data length
        mov     dx,cs:[ebp].postminor     ; (DX) = minor code
        call    K_S_Systrace

        pop     dx
        pop     bx
        pop     ax
        ret
EndProc RAS_Noparms_post


;** RAS_CFAxBxparms_post - perform RAS tracing for devhlps with parms in AX:BX
;                          and return code in CF (0 or 1)
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF)    = return code
;               (AX:BX) = dword parameter for buffer
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFAxBxparms_post,near
Entry   RAS_VirtToPhysDM_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    ds
        push    dx

        push    ax                      ; address high
        push    bx                      ; address low

        setc    al
        movzx   ax,al
        push    ax                      ; return code

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     bx
        pop     ax

        pop     dx
        pop     ds
        pop     si
        ret
EndProc RAS_CFAxBxparms_post

;** RAS_CFbasedAxBxparms_post - perform RAS tracing for devhlps with parms in
;                               AX:BX and return code in AX based upon CF
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF)    = return code
;               (AX:BX) = dword parameter for buffer
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFbasedAxBxparms_post,near
Entry   RAS_dh_SemHandle_post
Entry   RAS_SegLockDM_post
Entry   RAS_AllocPhysDM_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si
        push    ds
        push    dx

        push    ax                      ; address high
        push    bx                      ; address low

        jc      rf2                     ; if carry set, then push error code
        xor     ax,ax                   ; carry clear init. AX to zero
rf2:    push    ax                      ; push return code

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     bx
        pop     ax

        pop     dx
        pop     ds
        pop     si
        ret
EndProc RAS_CFbasedAxBxparms_post


;** RAS_CFEsBxparms_post - perform RAS tracing for devhlps with parms in ES:BX
;                        with return code in CF (0 or 1)
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF)    = return code (0 or 1)
;               (ES:BX) = dword parameter for buffer
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFEsBxparms_post,near
Entry   RAS_AllocReqPacket_post
Entry   RAS_PullRequest_post
Entry   RAS_dh_PhysToUVirt_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ax
        push    dx
        push    ds

        push    es                      ; addrs in (ES:BX)
        push    bx

        setc    al
        movzx   ax,al
        push    ax                      ; return code

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,6                    ; 6 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     bx                      ; clear parms
        pop     es

        pop     ds
        pop     dx                      ; restore regs
        pop     ax
        pop     si
        ret
EndProc RAS_CFEsBxparms_post

;** RAS_DiBxDiCxparms_post - perform RAS tracing for devhlps with
;                                          parms in DI:BX & DI:CX
;
;       added for defect 59714
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (DI:BX) = return code (0 or 1)
;               (DI:CX) = dword parameter for buffer
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_DiBxDiCxparms_post,near
Entry   RAS_dh_RegisterTmrDD_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ax
        push    dx
        push    ds

        push    di                      ; addrs in (DI:CX)
        push    cx

        push    di                      ; addrs in (DI:BX)
        push    bx

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     bx
        pop     di                      ; clear parms
        pop     cx
        pop     di                      ; clear parms

        pop     ds
        pop     dx                      ; restore regs
        pop     ax
        pop     si
        ret
EndProc RAS_DiBxDiCxparms_post


;** RAS_AXparms_post - perform RAS tracing for devhlps with parms in AX
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX) = Return code
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AXparms_post,near
Entry RAS_dh_Register_post
Entry RAS_dh_MonWrite_post
Entry RAS_dh_MonFlush_post
Entry RAS_dh_FreeGDTSelector_post

Entry RAS_dh_Beep_post                       ; defect 59714
Entry RAS_dh_RegisterPerfCtrs_post           ; defect 59714

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx

        push    ax

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     ax

        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_AXparms_post

;** RAS_CFAXparms_post - perform RAS tracing for devhlps with parms in AX
;                        with return code in CF (0 or 1)
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF) = Return code
;               (AX) = Error code or value based upon CF
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFAXparms_post,near
Entry   RAS_dh_MonitorCreate_post
Entry   RAS_dh_DeRegister_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx

        push    ax                      ; value or error code

        setc    al
        movzx   ax,al
        push    ax                      ; return code (0 or 1)

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     ax

        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_CFAXparms_post

;** RAS_CFAlparms_post - perform RAS tracing for devhlps with parms in Al
;                        with return code in CF (0 or 1)
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF) = Return code
;               (AL) = Byte read
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFAlparms_post,near
Entry   RAS_QueueRead_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx

        push    ax                      ; AL has byte in it

        setc    al
        movzx   ax,al
        push    ax                      ; return code (0 or 1)

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,3                    ; 3 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     ax

        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_CFAlparms_post


;** RAS_CFparms_post - perform RAS tracing for devhlps with parms in CF
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF) = Return code
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFparms_post,near
Entry   RAS_dh_RealToProt_post
Entry   RAS_dh_ProtToReal_post
Entry   RAS_dh_VerifyAccess_post
Entry   RAS_dh_AttachDD_post
Entry   RAS_dh_EOI_post
Entry   RAS_FreeReqPacket_post
Entry   RAS_GetDOSVar_post
Entry   RAS_dh_PhysToVirt_post
Entry   RAS_PullParticular_post
Entry   RAS_QueueWrite_post
Entry   RAS_dh_ResetTimer_post
Entry   RAS_dh_SetTimer_post
Entry   RAS_dh_SendEvent_post
Entry   RAS_dh_TickCount_post
Entry   RAS_SegUnlockDM_post
Entry   RAS_dh_SetIRQ_post
Entry   RAS_dh_UnSetIRQ_post
Entry   RAS_Yield_post
Entry   RAS_dh_UnPhysToVirt_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx
        push    ax

        setc    al
        movzx   ax,al
        push    ax

        mov     dx,cs:[ebp].postminor     ; (DX) = minor code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     ax

        pop     ax
        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_CFparms_post

;** RAS_EAXparms_post - perform RAS tracing for devhlps with parms in EAX
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (EAX) = Return code
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_EAXparms_post,near
Entry RAS_dh_VMLock_post
Entry RAS_dh_VMUnlock_post
Entry RAS_dh_VMFree_post
Entry RAS_dh_LinToGDTSelector_post
Entry RAS_dh_LinToPageList_post
Entry RAS_dh_PageListToGDTSelector_post
Entry RAS_dh_AllocateCtxHook_post
Entry RAS_dh_ArmCtxHook_post
Entry RAS_dh_FreeCtxHook_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx
        push    eax

        jc      rf0
        xor     eax,eax
rf0:    push    eax

        mov     dx,cs:[ebp].postminor    ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,4                    ; 4 bytes of parms.
        call    K_S_Systrace

        pop     eax

        pop     eax
        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_EAXparms_post

;** RAS_CFbasedEAXparms_post - perform RAS tracing for devhlps with parms in
;                              EAX with return code based on CF
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF)  = Return code
;               (EAX) = linear address
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFbasedEAXparms_post,near
Entry   RAS_dh_VMAlloc_post
Entry   RAS_dh_VMProcessToGlobal_post
Entry   RAS_dh_VMGlobalToProcess_post
Entry   RAS_dh_VirtToLin_post
Entry   RAS_dh_PageListToLin_post
Entry   RAS_dh_VMSetMem_post
Entry   RAS_dh_OpenEventSem_post
Entry   RAS_dh_CloseEventSem_post
Entry   RAS_dh_PostEventSem_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx

        push    eax                      ; push linear address

        jc      rf4
        xor     eax,eax
rf4:    push    eax                      ; return code

        mov     dx,cs:[ebp].postminor    ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,8                    ; 8 bytes of parms.
        call    K_S_Systrace

        pop     eax
        pop     eax

        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_CFbasedEAXparms_post


;** RAS_CFbasedEAXEDIparms_post - perform RAS tracing for devhlps with parms
;                                 in EAX and EDI with return code based on CF
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF)  = Return code
;               (EAX) = semaphore handle
;               (EDI) = address of post count
;               (BP)  = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_CFbasedEAXEDIparms_post,near
Entry   RAS_dh_ResetEventSem_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    dx

        mov     dx,ds
        FlatContext     ds,bx
        push    dword ptr [edi]         ; push dword of data at [edi]
        mov     ds,dx

        push    eax                     ; push semaphore handle

        jc      rf5
        xor     eax,eax
rf5:    push    eax                     ; return code

        mov     dx,cs:[ebp].postminor   ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     eax
        pop     eax
        add     esp,4

        pop     dx                      ; restore regs
        pop     bx
        pop     ds
        pop     si
        ret
EndProc RAS_CFbasedEAXEDIparms_post


;** RAS_AXCFbasedparms_post - perform RAS tracing for devhlps with AX parms
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (AX) = Return code
;               (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_AXCFbasedparms_post,near
Entry   RAS_dh_PhysToGDTSel_post
Entry   RAS_dh_AllocGDTSelector_post
Entry   RAS_dh_RegisterStackUsage_post
Entry   RAS_dh_SemClear_post
Entry   RAS_dh_SemRequest_post
Entry   RAS_dh_ABIOSGetParms_post
Entry   RAS_dh_PhysToGDTSelector_post
Entry   RAS_dh_RegisterKrnlExit_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    dx                      ; save regs
        push    ds
        push    bx
        push    ax
        push    si

        jc      rf1                     ; if carry set, then push error code
        xor     ax,ax                   ; carry clear, init. AX to zero
rf1:    push    ax                      ; push return code

        mov     dx,cs:[ebp].postminor    ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,2                    ; 2 bytes of parms.
        call    K_S_Systrace

        pop     ax

        pop     si
        pop     ax
        pop     bx                      ; restore regs
        pop     ds
        pop     dx
        ret
EndProc RAS_AXCFbasedparms_post

;** RAS_dh_GetDescInfo_post - perform RAS tracing for dh_GetDescInfo devhlps
;
;       Sets up parameters on the stack and calls K_S_Systrace
;       to enter parameters into RAS circular buffer.
;
;       ENTRY:  (CF)  = Return code
;               (AH)  = Attibute byte
;               (AL)  = Access byte
;               (ECX) = 32 bit addr. in descriptor
;               (EDX) = 32 bit limit of descriptor
;               (BP)  = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_dh_GetDescInfo_post,near

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        push    si                      ; save regs
        push    ds
        push    bx
        push    ax

        push    edx
        push    ecx
        xchg    ah,al                   ; switch bytes for systrace buffer
        push    ax
        setc    al
        movzx   ax,al
        push    ax

        mov     dx,cs:[ebp].postminor    ; (dx) = Minor Code

        mov     si,sp                   ; point to parameter frame on stack
        push    ss
        pop     ds                      ; (DS:SI) = structure on stack

        mov     al,RAS_MC_DEVHLP        ; (al) = Major Code
        mov     bx,12                   ; 12 bytes of parms.
        call    K_S_Systrace

        pop     ax
        pop     ax
        pop     ecx
        pop     edx

        pop     ax
        pop     bx                      ; restore regs
        pop     ds
        pop     si
        ret
EndProc RAS_dh_GetDescInfo_post

;** RAS_NoTrace_post - do not perform RAS tracing for devhlps
;
;       Postracing is not performed for this devhlp.
;
;       ENTRY   (BP) = Base of entry in DevhlpFuncDisp table in devhlp.asm
;       EXIT:   none
;
;       USES:   flags
Procedure RAS_NoTrace_post,near
Entry   RAS_dh_RAS_post
Entry   RAS_dh_InternalError_post
Entry   RAS_dh_LogEntry_post                    ; Error Logging not traced
Entry   RAS_dh_VideoPause_post
Entry   RAS_Save_Message_post

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING
        ret

EndProc RAS_NoTrace_post


;***    RASStubProc - Collection of non-traced devhlps.
;
;       Here is the list of stubbed out devhlp RAS procedures
;       The RASStub macro just emits a pair of labels.  All of
;       these entry points evaluate to a single return instruction.

RASStub macro  rout
        Entry   RAS_&rout
        Entry   RAS_&rout&_post
endm

Procedure RASStubProc

        ASSUME DS:DOSGROUP,ES:NOTHING,SS:NOTHING

        RASStub dh_RegisterFreq
        RASStub dh_ReallocSeg
        RASStub dh_RegisterDeviceClass
        RASStub dh_CreateInt13VDM
ifdef SECURITY                                                                      ;@SEC
        RASStub dh_KillProc                                               ;@SEC
        RASStub dh_QSysState                                              ;@SEC
endif                                                                     ;@SEC
        RASStub dvhe
        ret
EndProc RASStubProc

RASLOCKCODE ENDS

ENDIF

        END
