;       SCCSID = @(#)errlog.inc	6.1 90/11/17
;      SCCSID = @(#)errlog.inc	1.7 90/03/09
; ****************************************************************************
; *                                                                          *
; *                       IBM/Microsoft Confidential                         *
; *                                                                          *
; *                 Copyright (c) IBM Corporation  1987, 1990                *
; *                 Copyright (c) Microsoft Corp.  1987, 1990                *
; *                           All Rights Reserved                            *
; *                                                                          *
; ****************************************************************************

;************************* START OF SPECIFICATIONS *****************
;
;     SOURCE FILE NAME: errlog.inc
;
;     DESCRIPTIVE NAME: Error Logging Kernel Component Include File
;
;     FUNCTION: This is the include file for Kernel Logging Facility
;
;************************** END OF SPECIFICATIONS ******************



;Flags for kernel log control
;LogStatus WORD defined in kernel HighData
;
;
;         xxxx xxxx xxxx xxx0         Error Logging not Initialized
;         xxxx xxxx xxxx xxx1         Error Logging initialized
;
;         xxxx xxxx xxxx xx0x         Error Log Daemon not initialized
;         xxxx xxxx xxxx xx1x         Error Log Daemon initialized
;

LF_LOGINITIAL        equ     0001H          ; Logging initialized
LF_DAEMONINITIAL     equ     0002H          ; Daemon Initialized

; Flags for buffer status
; This word is contained in the log buffer and contains information
; pertaining to the log buffer (see: elog_status).
;
;         xxxx xxxx xxxx xxx0         Log Buffer NOT corrupted during copy
;         xxxx xxxx xxxx xxx1         Log Buffer corrupted during copy
;
;         xxxx xxxx xxxx xx0x         Log buffer has not wrapped
;         xxxx xxxx xxxx xx1x         Log buffer has wrapped
;
;         xxxx xxxx xxxx x0xx         Do not clear buffer following copy
;         xxxx xxxx xxxx x1xx         Clear buffer following copy
;
;         xxxx xxxx xxxx 0xxx         Do not yield during logging
;         xxxx xxxx xxxx 1xxx         Yield during logging process
;
;         xxxx xxxx xxx0 xxxx         Logging Disabled
;         xxxx xxxx xxx1 xxxx         Logging Enabled
;
;         xxxx xxxx xx0x xxxx         Buffer Ready
;         xxxx xxxx xx1x xxxx         Buffer being updated process
;


LF_LOGBUFCORRUPTED   equ     0001H          ; Log buffer corrupted
LF_LOGBUFWRAPPED     equ     0002H          ; Log buffer wrapped
LF_LOGBUFCLEAR       equ     0004H          ; Clear following copy
LF_LOGYIELD          equ     0008H          ; Yield while logging
LF_LOGENABLED        equ     0010H          ; Logging enabled
LF_LOGUPDATE         equ     0020H          ; Buffer being updated



; Miscellaneous equates and structures related to error logging facility

LV_MAXPACKET            equ  1024           ; Maximum Packet size
LV_MINBUFFSIZE          equ   1             ; Min size of circular buffer
LV_MAXBUFFSIZE          equ  64             ; Max size of circular buffer
LV_SUSPENDLOG           equ  0*2            ; Suspend Logging
LV_RESUMELOG            equ  1*2            ; Resume Logging
LV_TIMEDATELEN          equ  ((size Elog_LogTime) + (size Elog_LogDate))
LV_PROCNAMELEN          equ  size Elog_LogProcName


; This is the structure used for the Error Log Circular buffer


elog_s  STRUC                              ; Error Log Buffer Structure
    elog_signature       db 'LF'           ; Signature
                         dd 0              ; Reserved
    elog_status          dw 0              ; Status of buffer (see above)
    elog_start_buffer    dw SIZE elog_s    ; offset start of Circular buffer
    elog_end_buffer      dw ?              ; offset end of Circular buffer
    elog_current_offst   dw SIZE elog_s    ; Next available byte in buffer

    ; This structure is followed by a circular buffer, which is
    ; up to 64K long, set up by LOG= in CONFIG.SYS

elog_s  ENDS

LV_BUFHEADERSIZE        equ SIZE elog_s    ; Size of kernel log buffer header


; This is the structure used for the first packet passed to the log facility

Elog_Packet1 STRUC
    Elog_NumberOfPackets  dw   ?           ; Number of packets to record
    Elog_LengthOfPacket1  dw   ?           ; Length of current packet
    Elog_PacketID1        dw   ?           ; Packet ID
    Elog_OriginatorName1  db   8 dup(?)    ; ASCII originator name
    Elog_Qualifier1       db   4 dup(?)    ; ASCII qualifier
    Elog_Reserved1        DD   ?           ; Reserved
    Elog_Status1          DD   ?           ; Status
    Elog_LogTime1         db   4 dup(?)    ; Time of event (kernel fills in)
    Elog_LogDate1         db   4 dup(?)    ; Date of event (kernel fills in)
    Elog_LogProcName1     db 260 dup(?)    ; Process Name
    Elog_LogData1         db   ?           ; Variable length log data
Elog_Packet1 ENDS

; This is the structure used for packets placed in the error log buffer

Elog_Packet STRUC
    Elog_LengthOfPacket   dw   ?           ; Length of current packet
    Elog_PacketID         dw   ?           ; Packet ID
    Elog_OriginatorName   db   8 dup(?)    ; ASCII originator name
    Elog_Qualifier        db   4 dup(?)    ; ASCII qualifier
    Elog_Reserved         DD   ?           ; Reserved
    Elog_Status           DD   ?           ; Status
    Elog_LogTime          db   4 dup(?)    ; Time of event (kernel fills in)
    Elog_LogDate          db   4 dup(?)    ; Date of event (kernel fills in)
    Elog_LogProcName      db 260 dup(?)    ; Process Name
    Elog_LogData          db   ?           ; Variable length log data
Elog_Packet ENDS

LV_PACKHEADERSIZE        equ (SIZE Elog_Packet) - 1  ; Size of Packet header

; Flags for ELog_Status Field
; This double word is contained in each log packet and contains information
; pertaining each packet.  Currentlty only the lower 3 bits of the double
; word are defined.
;
;         xxxx ......... xxx0         Header doesn't contatin process name
;         xxxx ......... xxx1         Header contains 256 bytes for proc name
;
;         xxxx ......... xx0x         Notify all registered subsytems
;         xxxx ......... xx1x         Notify no registered subsystems
;
;         xxxx ......... x0xx         Place data in log file
;         xxxx ......... x1xx         Do not log data to file
;
;


LF_LOGPROCESSNAME    equ     0001H          ; Put in Process Name
LF_LOGNONOTIFY       equ     0002H          ; Don't notify registered subsystem
LF_LOGNOLOG          equ     0004H          ; Don't log to file



; This structure is used to address the log system semaphore

Elog_Sem_Handle STRUC
    Elog_Sem_Low          dw ?              ; Low portion of semaphore
    Elog_Sem_High         dw ?              ; High portion of semaphore
Elog_Sem_Handle ENDS

; The following equates are used by LogEntry to keep track of the current
; log request

LF_YIELD             equ     0001h          ; OK to yield on this request
LF_KERNELENTRY       equ     0002h          ; This is a Kernel Entry
LF_PROCHEADER        equ     0004h          ; Record Contains Process Name
LF_INTTIME           equ     0008h          ; Interrupt Time Event

