forked from mdarin/gapstone
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsanity_checks.go
More file actions
121 lines (112 loc) · 2.91 KB
/
Copy pathsanity_checks.go
File metadata and controls
121 lines (112 loc) · 2.91 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
Gapstone is a Go binding for the Capstone disassembly library.
For examples,try reading the *_test.go files.
Library Author: Nguyen Anh Quynh
Binding Author: Ben Nagy
License: BSD style - see LICENSE file for details
(c) 2013 COSEINC. All Rights Reserved.
THIS FILE WAS AUTO-GENERATED -- DO NOT EDIT!
Command: ./gensanity.py
Created at: 2025-04-25 09:07:33
*/
package gapstone
// WARN
// Maintain the expected version and sanity checks manually, so we can verify
// against the installed C lib. Not foolproof, but should save 90% of accidents
const expectedMaj = 5
const expectedMin = 0
type sanityCheck struct {
insMax int
regMax int
grpMax int
}
type sanityChecks map[int]sanityCheck
func (s *sanityChecks) Maj() int { return expectedMaj }
func (s *sanityChecks) Min() int { return expectedMin }
// WARN
// Remember the all the constants CONST are direct refs to C.CONST, so in
// combination with these we should be _fairly_ sure we're getting the
// disassembly capstone expects to provide.
// * <ARCH>_GRP_ENDING || <ARCH>_INS_ENDING || <ARCH>_REG_ENDING
var checks = sanityChecks{
CS_ARCH_ARM: sanityCheck{
regMax: ARM_REG_ENDING,
insMax: ARM_INS_ENDING,
grpMax: ARM_GRP_ENDING,
},
CS_ARCH_ARM64: sanityCheck{
regMax: ARM64_REG_ENDING,
insMax: ARM64_INS_ENDING,
grpMax: ARM64_GRP_ENDING,
},
CS_ARCH_BPF: sanityCheck{
regMax: BPF_REG_ENDING,
insMax: BPF_INS_ENDING,
grpMax: BPF_GRP_ENDING,
},
CS_ARCH_M680X: sanityCheck{
regMax: M680X_REG_ENDING,
insMax: M680X_INS_ENDING,
grpMax: M680X_GRP_ENDING,
},
CS_ARCH_M68K: sanityCheck{
regMax: M68K_REG_ENDING,
insMax: M68K_INS_ENDING,
grpMax: M68K_GRP_ENDING,
},
CS_ARCH_MIPS: sanityCheck{
regMax: MIPS_REG_ENDING,
insMax: MIPS_INS_ENDING,
grpMax: MIPS_GRP_ENDING,
},
CS_ARCH_MOS65XX: sanityCheck{
regMax: MOS65XX_REG_ENDING,
insMax: MOS65XX_INS_ENDING,
grpMax: MOS65XX_GRP_ENDING,
},
CS_ARCH_PPC: sanityCheck{
regMax: PPC_REG_ENDING,
insMax: PPC_INS_ENDING,
grpMax: PPC_GRP_ENDING,
},
CS_ARCH_RISCV: sanityCheck{
regMax: RISCV_REG_ENDING,
insMax: RISCV_INS_ENDING,
grpMax: RISCV_GRP_ENDING,
},
CS_ARCH_SH: sanityCheck{
regMax: SH_REG_ENDING,
insMax: SH_INS_ENDING,
grpMax: SH_GRP_ENDING,
},
CS_ARCH_SPARC: sanityCheck{
regMax: SPARC_REG_ENDING,
insMax: SPARC_INS_ENDING,
grpMax: SPARC_GRP_ENDING,
},
CS_ARCH_SYSZ: sanityCheck{
regMax: SYSZ_REG_ENDING,
insMax: SYSZ_INS_ENDING,
grpMax: SYSZ_GRP_ENDING,
},
CS_ARCH_TMS320C64X: sanityCheck{
regMax: TMS320C64X_REG_ENDING,
insMax: TMS320C64X_INS_ENDING,
grpMax: TMS320C64X_GRP_ENDING,
},
CS_ARCH_TRICORE: sanityCheck{
regMax: TRICORE_REG_ENDING,
insMax: TRICORE_INS_ENDING,
grpMax: TRICORE_GRP_ENDING,
},
CS_ARCH_X86: sanityCheck{
regMax: X86_REG_ENDING,
insMax: X86_INS_ENDING,
grpMax: X86_GRP_ENDING,
},
CS_ARCH_XCORE: sanityCheck{
regMax: XCORE_REG_ENDING,
insMax: XCORE_INS_ENDING,
grpMax: XCORE_GRP_ENDING,
},
}