⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 log.cod

📁 怎样在win2000下构造驱动程序znsoft_Serial2000_demo.ZIP
💻 COD
字号:
; Listing generated by Microsoft (R) Optimizing Compiler Version 12.00.9044.0 

	TITLE	F:\W2DDK\src\kernel\serial\log.c
	.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
_DATA	SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA	ENDS
CONST	SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST	ENDS
_BSS	SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS	ENDS
$$SYMBOLS	SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS	ENDS
$$TYPES	SEGMENT BYTE USE32 'DEBTYP'
$$TYPES	ENDS
_TLS	SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS	ENDS
;	COMDAT _RtlConvertLongToLargeInteger@4
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT _SerialDebugLogEntry@20
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT _SerialLogInit@0
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
;	COMDAT _SerialLogFree@0
_TEXT	SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT	ENDS
FLAT	GROUP _DATA, CONST, _BSS
	ASSUME	CS: FLAT, DS: FLAT, SS: FLAT
endif

INCLUDELIB LIBC
INCLUDELIB OLDNAMES

PUBLIC	_SerialLStart
PUBLIC	_LogMask
_DATA	SEGMENT
COMM	_LogSpinLock:DWORD
_DATA	ENDS
_BSS	SEGMENT
_SerialLStart DD 01H DUP (?)
_BSS	ENDS
_DATA	SEGMENT
COMM	_SerialLPtr:DWORD
COMM	_SerialLEnd:DWORD
_DATA	ENDS
_BSS	SEGMENT
_LogMask DD	01H DUP (?)
_BSS	ENDS
PUBLIC	_SerialDebugLogEntry@20
EXTRN	__imp__KeGetCurrentIrql@0:NEAR
EXTRN	__imp__RtlAssert@16:NEAR
EXTRN	__imp_@KefAcquireSpinLockAtDpcLevel@4:NEAR
EXTRN	__imp_@KefReleaseSpinLockFromDpcLevel@4:NEAR
EXTRN	__imp_@KfAcquireSpinLock@4:NEAR
EXTRN	__imp_@KfReleaseSpinLock@8:NEAR
;	COMDAT _SerialDebugLogEntry@20
; File f:\w2ddk\src\kernel\serial\log.c
_TEXT	SEGMENT
$SG14844 DB	'f:\w2ddk\src\kernel\serial\log.c', 00H
	ORG $+3
$SG14845 DB	'SerialLPtr >= SerialLStart', 00H
; Function compile flags: /Ogs
_Mask$ = 8
_Sig$ = 12
_Info1$ = 16
_Info2$ = 20
_Info3$ = 24
_rsig$ = 8
_SerialDebugLogEntry@20 PROC NEAR			; COMDAT

; 62   : {

  0003f	55		 push	 ebp
  00040	8b ec		 mov	 ebp, esp

; 63   :     KIRQL irql;
; 64   : 
; 65   : typedef union _SIG {
; 66   :     struct {
; 67   :         UCHAR Byte0;
; 68   :         UCHAR Byte1;
; 69   :         UCHAR Byte2;
; 70   :         UCHAR Byte3;
; 71   :     } b;
; 72   :     ULONG l;
; 73   : } SIG, *PSIG;
; 74   : 
; 75   :     SIG sig, rsig;
; 76   : 
; 77   : 
; 78   :     if (SerialLStart == 0) {

  00042	83 3d 00 00 00
	00 00		 cmp	 DWORD PTR _SerialLStart, 0
  00049	53		 push	 ebx
  0004a	56		 push	 esi
  0004b	0f 84 c1 00 00
	00		 je	 $L14847

; 79   :         return;
; 80   :     }
; 81   : 
; 82   :     if ((Mask & LogMask) == 0) {

  00051	a1 00 00 00 00	 mov	 eax, DWORD PTR _LogMask
  00056	85 45 08	 test	 DWORD PTR _Mask$[ebp], eax
  00059	0f 84 b3 00 00
	00		 je	 $L14847

; 83   :         return;
; 84   :     }
; 85   : 
; 86   :     irql = KeGetCurrentIrql();

  0005f	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeGetCurrentIrql@0
  00065	8a d8		 mov	 bl, al

; 87   : 
; 88   :     if (irql < DISPATCH_LEVEL) {
; 89   :         KeAcquireSpinLock(&LogSpinLock, &irql);

  00067	be 00 00 00 00	 mov	 esi, OFFSET FLAT:_LogSpinLock
  0006c	80 fb 02	 cmp	 bl, 2
  0006f	8b ce		 mov	 ecx, esi
  00071	73 0a		 jae	 SHORT $L14838
  00073	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KfAcquireSpinLock@4
  00079	8a d8		 mov	 bl, al

; 90   :     } else {

  0007b	eb 06		 jmp	 SHORT $L14839
$L14838:

; 91   :         KeAcquireSpinLockAtDpcLevel(&LogSpinLock);

  0007d	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KefAcquireSpinLockAtDpcLevel@4
$L14839:

; 92   :     }
; 93   : 
; 94   :     if (SerialLPtr > SerialLStart) {

  00083	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLPtr
  00088	3b 05 00 00 00
	00		 cmp	 eax, DWORD PTR _SerialLStart
  0008e	76 05		 jbe	 SHORT $L14840

; 95   :         SerialLPtr -= 1;    // Decrement to next entry

  00090	83 e8 10	 sub	 eax, 16			; 00000010H

; 96   :     } else {

  00093	eb 05		 jmp	 SHORT $L14876
$L14840:

; 97   :         SerialLPtr = SerialLEnd;

  00095	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLEnd
$L14876:

; 98   :     }
; 99   : 
; 100  :     sig.l = Sig;
; 101  :     rsig.b.Byte0 = sig.b.Byte3;

  0009a	8a 4d 0f	 mov	 cl, BYTE PTR _Sig$[ebp+3]
  0009d	a3 00 00 00 00	 mov	 DWORD PTR _SerialLPtr, eax
  000a2	88 4d 08	 mov	 BYTE PTR _rsig$[ebp], cl

; 102  :     rsig.b.Byte1 = sig.b.Byte2;

  000a5	8a 4d 0e	 mov	 cl, BYTE PTR _Sig$[ebp+2]
  000a8	88 4d 09	 mov	 BYTE PTR _rsig$[ebp+1], cl

; 103  :     rsig.b.Byte2 = sig.b.Byte1;

  000ab	8b 4d 0c	 mov	 ecx, DWORD PTR _Sig$[ebp]
  000ae	88 6d 0a	 mov	 BYTE PTR _rsig$[ebp+2], ch

; 104  :     rsig.b.Byte3 = sig.b.Byte0;

  000b1	88 4d 0b	 mov	 BYTE PTR _rsig$[ebp+3], cl

; 105  : 
; 106  :     SerialLPtr->le_sig = rsig.l;

  000b4	8b 4d 08	 mov	 ecx, DWORD PTR _rsig$[ebp]
  000b7	89 08		 mov	 DWORD PTR [eax], ecx

; 107  :     SerialLPtr->le_info1 = Info1;

  000b9	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLPtr
  000be	8b 4d 10	 mov	 ecx, DWORD PTR _Info1$[ebp]
  000c1	89 48 04	 mov	 DWORD PTR [eax+4], ecx

; 108  :     SerialLPtr->le_info2 = Info2;

  000c4	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLPtr
  000c9	8b 4d 14	 mov	 ecx, DWORD PTR _Info2$[ebp]
  000cc	89 48 08	 mov	 DWORD PTR [eax+8], ecx

; 109  :     SerialLPtr->le_info3 = Info3;

  000cf	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLPtr
  000d4	8b 4d 18	 mov	 ecx, DWORD PTR _Info3$[ebp]
  000d7	89 48 0c	 mov	 DWORD PTR [eax+12], ecx

; 110  : 
; 111  :     ASSERT(SerialLPtr >= SerialLStart);

  000da	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLPtr
  000df	3b 05 00 00 00
	00		 cmp	 eax, DWORD PTR _SerialLStart
  000e5	73 14		 jae	 SHORT $L14842
  000e7	6a 00		 push	 0
  000e9	6a 6f		 push	 111			; 0000006fH
  000eb	68 00 00 00 00	 push	 OFFSET FLAT:$SG14844
  000f0	68 00 00 00 00	 push	 OFFSET FLAT:$SG14845
  000f5	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__RtlAssert@16
$L14842:

; 112  : 
; 113  :     if (irql < DISPATCH_LEVEL) {

  000fb	80 fb 02	 cmp	 bl, 2

; 114  :         KeReleaseSpinLock(&LogSpinLock, irql);

  000fe	8b ce		 mov	 ecx, esi
  00100	73 0a		 jae	 SHORT $L14846
  00102	8a d3		 mov	 dl, bl
  00104	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KfReleaseSpinLock@8

; 115  :     } else {

  0010a	eb 06		 jmp	 SHORT $L14847
$L14846:

; 116  :         KeReleaseSpinLockFromDpcLevel(&LogSpinLock);

  0010c	ff 15 00 00 00
	00		 call	 DWORD PTR __imp_@KefReleaseSpinLockFromDpcLevel@4
$L14847:
  00112	5e		 pop	 esi
  00113	5b		 pop	 ebx

; 117  :     }
; 118  : 
; 119  :     return;
; 120  : }

  00114	5d		 pop	 ebp
  00115	c2 14 00	 ret	 20			; 00000014H
_SerialDebugLogEntry@20 ENDP
_TEXT	ENDS
PUBLIC	_SerialLogInit@0
EXTRN	__imp__KeInitializeSpinLock@4:NEAR
EXTRN	__imp__ExAllocatePoolWithTag@12:NEAR
EXTRN	_DbgBreakPoint@0:NEAR
; Function compile flags: /Ogs
;	COMDAT _SerialLogInit@0
_TEXT	SEGMENT
_SerialLogInit@0 PROC NEAR				; COMDAT

; 139  : #ifdef MAX_DEBUG
; 140  :     ULONG logSize = 4096*6;
; 141  : #else
; 142  :     ULONG logSize = 4096*3;
; 143  : #endif
; 144  : 
; 145  : 
; 146  :     KeInitializeSpinLock(&LogSpinLock);

  00000	68 00 00 00 00	 push	 OFFSET FLAT:_LogSpinLock
  00005	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__KeInitializeSpinLock@4

; 147  : 
; 148  :     SerialLStart = ExAllocatePoolWithTag(NonPagedPool, logSize, 'XMOC');

  0000b	68 43 4f 4d 58	 push	 1481461571		; 584d4f43H
  00010	68 00 30 00 00	 push	 12288			; 00003000H
  00015	6a 00		 push	 0
  00017	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExAllocatePoolWithTag@12

; 149  : 
; 150  :     if (SerialLStart) {

  0001d	85 c0		 test	 eax, eax
  0001f	a3 00 00 00 00	 mov	 DWORD PTR _SerialLStart, eax
  00024	74 10		 je	 SHORT $L14850

; 151  :         SerialLPtr = SerialLStart;

  00026	a3 00 00 00 00	 mov	 DWORD PTR _SerialLPtr, eax

; 152  : 
; 153  :         // Point the end (and first entry) 1 entry from the end of the segment
; 154  :         SerialLEnd = SerialLStart + (logSize / sizeof(struct SERIAL_LOG_ENTRY))
; 155  :             - 1;

  0002b	05 f0 2f 00 00	 add	 eax, 12272		; 00002ff0H
  00030	a3 00 00 00 00	 mov	 DWORD PTR _SerialLEnd, eax

; 159  : #endif
; 160  :     }
; 161  : 
; 162  :     return;
; 163  : }

  00035	c3		 ret	 0
$L14850:

; 156  :     } else {
; 157  : #if DBG
; 158  :         DbgBreakPoint ();

  00036	e9 00 00 00 00	 jmp	 _DbgBreakPoint@0
_SerialLogInit@0 ENDP
_TEXT	ENDS
PUBLIC	_SerialLogFree@0
EXTRN	__imp__ExFreePool@4:NEAR
; Function compile flags: /Ogs
;	COMDAT _SerialLogFree@0
_TEXT	SEGMENT
_SerialLogFree@0 PROC NEAR				; COMDAT

; 180  :     if (SerialLStart) {

  00000	a1 00 00 00 00	 mov	 eax, DWORD PTR _SerialLStart
  00005	85 c0		 test	 eax, eax
  00007	74 07		 je	 SHORT $L14854

; 181  :         ExFreePool(SerialLStart);

  00009	50		 push	 eax
  0000a	ff 15 00 00 00
	00		 call	 DWORD PTR __imp__ExFreePool@4
$L14854:

; 182  :     }
; 183  : 
; 184  :     return;
; 185  : }

  00010	c3		 ret	 0
_SerialLogFree@0 ENDP
_TEXT	ENDS
END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -