;       SCCSID = @(#)mdinit.asm	6.2 91/02/27

        page 66, 132
        title  Monitor Dispatcher DvHlp Functions - Initialization
        subttl IBM Confidential
; ***************************************************************************
; *
; *                       IBM Confidential
; *
; *                 Copyright (c) IBM Corporation  1987, 1990
; *                           All Rights Reserved
; *
; ***************************************************************************

;/********************** START OF SPECIFICATIONS **************************
;/*
;/*  Source File Name: MONINIT.ASM
;/*
;/*  Descriptive Name: Monitor Dispatcher DevHlp routines - Part 1
;/*
;/*  Function:  Character Device Monitors provide a mechanism for
;/*     applications or subsystems to monitor all characters passing
;/*     through a device driver.  This mechanism allows any reg-
;/*     istered process to remove, insert or modify the information
;/*     passing through the device.
;/*
;/*     The Monitor Dispatcher DevHlp routines provide the services
;/*     for device drivers to support character stream monitoring.
;/*
;/*  Notes: These modules make up the Monitor Dispatcher DevHlps:
;/*
;/*     MDINIT.ASM  - Initialization routine
;/*     MDINTRF.ASM - Stub entries for devhlps in low mem
;/*     MDSUBA.ASM  - Common subroutines that must be assembler
;/*     MDLOCK.C    - dhw_Write and subroutines (interrupt-time routines)
;/*     MDSWAP1.C   - MD32IMONREAD, MD32IMONWRITE, and subroutines
;/*     MDSWAP2.C   - dhw_Create, dhw_Register, dhw_Deregister, and subroutines
;/*
;/*  Procedures Defined in this module:
;/*     MONINIT     - Initialize Monitor Dispatcher data
;/*
;/*  External References (other kernel components):
;/*
;/*************************************************************************


.386
        include mddvhlp.inc


        ;*****************************************************************
        ;*   DATA DEFINED IN EXTERNAL MODULE
        ;*****************************************************************
.386
_TEXT SEGMENT

      public _Head
      _Head HEADSTRUC <0,>

_TEXT ENDS

        ;*****************************************************************
        ;*   EXTERNAL REFERENCES
        ;*****************************************************************

EXTRN32 _KSEMCreate

         FARCODE INIT
INITCODE SEGMENT

        ASSUME DS:nothing,ES:nothing,SS:nothing
;/****************** START OF SPECIFICATIONS *******************
;/
;/ SUBROUTINE NAME:  MONINIT
;/
;/ DESCRIPTIVE NAME: Initialize data for Monitor Dispatcher
;/
;/ FUNCTION: Initialize global kernel data for Monitor Dispatcher
;/
;/ ENTRY POINT:  MONINIT
;/    LINKAGE:  FAR CALL
;/
;/ INPUT:  None
;/
;/ EXIT-NORMAL:  'C' carry flag clear
;/               AX = 0
;/
;/ EXIT-ERROR:   'C' carry flag set
;/               AX <> 0; = error
;/
;/ EFFECTS:  AX changed, Carry flag changed
;/
;/ INTERNAL REFERENCES:
;/
;/ EXTERNAL REFERENCES:
;/
;/****************** END OF SPECIFICATIONS *********************

Procedure   MONINIT
   EnterProc
.386
   mon_savemost_regs

   FlatContext <ES,DS>
   mov      eax, KRNL_MUTEXSEM
   lea      ebx, DS:_Head.HeadSemHandle
   CCALL32  _KSEMCreate,<ebx,eax>

.386
   mon_restoremost_regs
.286
   or       ax,ax   ;sets carry if necessary
   LeaveProc
   ret
EndProc MONINIT

INITCODE ENDS

         END
