00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#include "vdmp.h"
00023
00024
VOID
00025
VdmTraceEvent(
00026 USHORT Type,
00027 USHORT wData,
00028 USHORT lData,
00029 PKTRAP_FRAME TrapFrame
00030 );
00031
00032
#ifdef ALLOC_PRAGMA
00033
#pragma alloc_text(PAGE, VdmTraceEvent)
00034
#endif
00035
00036
VOID
00037 VdmTraceEvent(
00038 USHORT Type,
00039 USHORT wData,
00040 USHORT lData,
00041 PKTRAP_FRAME TrapFrame
00042 )
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 {
00058
PVDM_TIB VdmTib;
00059
NTSTATUS Status = STATUS_SUCCESS;
00060 KIRQL OldIrql;
00061 PVDM_TRACEENTRY pEntry;
00062 PVDM_TRACEINFO pInfo;
00063 LARGE_INTEGER CurTime, DiffTime;
00064
00065
00066
PAGED_CODE();
00067
#if 0
00068
00069
00070
00071
00072
#if 0
00073
00074
00075
00076
KeRaiseIrql(
APC_LEVEL, &OldIrql);
00077
00078
00079
00080
00081
try {
00082
#endif
00083
if ((*(ULONG *)(FIXED_NTVDMSTATE_LINEAR) & VDM_TRACE_HISTORY)) {
00084
00085
00086
00087
00088 VdmTib = NtCurrentTeb()->Vdm;
00089
00090
if (VdmTib->TraceInfo.pTraceTable) {
00091
00092 pEntry = &VdmTib->TraceInfo.pTraceTable[VdmTib->TraceInfo.CurrentEntry];
00093
00094 pEntry->Type = Type;
00095 pEntry->wData = wData;
00096 pEntry->lData = lData;
00097
00098
switch (VdmTib->TraceInfo.
Flags & VDMTI_TIMER_MODE) {
00099
case VDMTI_TIMER_TICK:
00100 CurTime.LowPart =
NtGetTickCount();
00101 pEntry->Time = CurTime.LowPart - VdmTib->TraceInfo.TimeStamp.LowPart;
00102 VdmTib->TraceInfo.TimeStamp.LowPart = CurTime.LowPart;
00103
break;
00104
00105
case VDMTI_TIMER_PERFCTR:
00106 pEntry->Time = 0;
00107
break;
00108
00109
case VDMTI_TIMER_STAT:
00110 pEntry->Time = 0;
00111
break;
00112
00113 }
00114
00115 pEntry->eax = TrapFrame->Eax;
00116 pEntry->ebx = TrapFrame->Ebx;
00117 pEntry->ecx = TrapFrame->Ecx;
00118 pEntry->edx = TrapFrame->Edx;
00119 pEntry->esi = TrapFrame->Esi;
00120 pEntry->edi = TrapFrame->Edi;
00121 pEntry->ebp = TrapFrame->Ebp;
00122 pEntry->esp = TrapFrame->HardwareEsp;
00123 pEntry->eip = TrapFrame->Eip;
00124 pEntry->eflags = TrapFrame->EFlags;
00125
00126 pEntry->cs = (
USHORT) TrapFrame->SegCs;
00127 pEntry->ds = (
USHORT) TrapFrame->SegDs;
00128 pEntry->es = (
USHORT) TrapFrame->SegEs;
00129 pEntry->fs = (
USHORT) TrapFrame->SegFs;
00130 pEntry->gs = (
USHORT) TrapFrame->SegGs;
00131 pEntry->ss = (
USHORT) TrapFrame->HardwareSegSs;
00132
00133
if (++VdmTib->TraceInfo.CurrentEntry >=
00134 (VdmTib->TraceInfo.NumPages*4096/
sizeof(VDM_TRACEENTRY))) {
00135 VdmTib->TraceInfo.CurrentEntry = 0;
00136 }
00137 }
00138 }
00139
00140
#if 0
00141
} except(
EXCEPTION_EXECUTE_HANDLER) {
00142
Status = GetExceptionCode();
00143 }
00144
00145
KeLowerIrql(OldIrql);
00146
#endif
00147
#endif
00148
}