-
Notifications
You must be signed in to change notification settings - Fork 0
/
instruction_table.go
48 lines (40 loc) · 1017 Bytes
/
instruction_table.go
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
package asmdb
import (
_ "embed"
"log"
"github.com/goccy/go-yaml"
)
//go:embed x86reference.yml
var x86referenceYml string
var x86Ref x86Reference
type x86Reference struct {
Instructions []Instruction
}
type Operand struct {
Destination struct {
Str string `yaml:"operand_s"`
Address string `yaml:"a,omitempty"`
Type string `yaml:"t,omitempty"`
} `yaml:"dst,omitempty"`
Source struct {
Str string `yaml:"operand_s"`
Address string `yaml:"a,omitempty"`
Type string `yaml:"t,omitempty"`
} `yaml:"src,omitempty"`
}
type Instruction struct {
Mnemonic string `yaml:"mnem"`
Opcode string `yaml:"opcd"`
Operand1 *Operand `yaml:"op1,omitempty"`
Operand2 *Operand `yaml:"op2,omitempty"`
Proc string `yaml:"proc"`
Description string `yaml:"desc,omitempty"`
}
func init() {
if err := yaml.Unmarshal([]byte(x86referenceYml), &x86Ref.Instructions); err != nil {
log.Fatalf("error: %v", err)
}
}
func X86Reference() *x86Reference {
return &x86Ref
}