1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# SPDX-License-Identifier: MIT
from construct import *
from enum import IntEnum
from ..utils import *
__all__ = [
"MMIOTraceFlags", "EvtMMIOTrace", "EvtIRQTrace", "HV_EVENT",
"VMProxyHookData", "TraceMode",
]
class MMIOTraceFlags(Register32):
ATTR = 31, 24
CPU = 23, 16
SH = 15, 14
WIDTH = 4, 0
WRITE = 5
MULTI = 6
EvtMMIOTrace = Struct(
"flags" / RegAdapter(MMIOTraceFlags),
"reserved" / Int32ul,
"pc" / Hex(Int64ul),
"addr" / Hex(Int64ul),
"data" / Hex(Int64ul),
)
EvtIRQTrace = Struct(
"flags" / Int32ul,
"type" / Hex(Int16ul),
"num" / Int16ul,
)
class HV_EVENT(IntEnum):
HOOK_VM = 1
VTIMER = 2
USER_INTERRUPT = 3
WDT_BARK = 4
CPU_SWITCH = 5
VIRTIO = 6
VMProxyHookData = Struct(
"flags" / RegAdapter(MMIOTraceFlags),
"id" / Int32ul,
"addr" / Hex(Int64ul),
"data" / Array(8, Hex(Int64ul)),
)
class TraceMode(IntEnum):
'''
Different types of Tracing '''
OFF = 0
BYPASS = 1
ASYNC = 2
UNBUF = 3
WSYNC = 4
SYNC = 5
HOOK = 6
RESERVED = 7
|