aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ifuzz
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-11-20 18:40:43 +0100
committerDmitry Vyukov <dvyukov@google.com>2020-11-21 08:46:20 +0100
commitf37ad136f6f3c26c6c2d56d5fc480a0a55ce24f5 (patch)
treee0bd9df85c52918d1f93baf55a7954310593ecf8 /pkg/ifuzz
parentbdaddecf580cf0c89652f1152061577f2aa7458f (diff)
pkg/ifuzz/x86: don't use X86 suffix for types
x86.InsnSetX86 is excessive. Everything in x86 package is x86-ish already.
Diffstat (limited to 'pkg/ifuzz')
-rw-r--r--pkg/ifuzz/powerpc/powerpc.go10
-rw-r--r--pkg/ifuzz/powerpc/pseudo.go4
-rw-r--r--pkg/ifuzz/x86/decode.go4
-rw-r--r--pkg/ifuzz/x86/pseudo.go2
-rw-r--r--pkg/ifuzz/x86/x86.go6
5 files changed, 13 insertions, 13 deletions
diff --git a/pkg/ifuzz/powerpc/powerpc.go b/pkg/ifuzz/powerpc/powerpc.go
index 5f8332510..4a79f75a9 100644
--- a/pkg/ifuzz/powerpc/powerpc.go
+++ b/pkg/ifuzz/powerpc/powerpc.go
@@ -38,17 +38,17 @@ type Insn struct {
generator func(cfg *ifuzzimpl.Config, r *rand.Rand) []byte
}
-type InsnSetPowerPC struct {
+type InsnSet struct {
Insns []*Insn
modeInsns [ifuzzimpl.ModeLast][ifuzzimpl.TypeLast][]ifuzzimpl.Insn
insnMap map[string]*Insn
}
-func (insnset *InsnSetPowerPC) GetInsns(mode ifuzzimpl.Mode, typ ifuzzimpl.Type) []ifuzzimpl.Insn {
+func (insnset *InsnSet) GetInsns(mode ifuzzimpl.Mode, typ ifuzzimpl.Type) []ifuzzimpl.Insn {
return insnset.modeInsns[mode][typ]
}
-func (insnset *InsnSetPowerPC) Decode(mode ifuzzimpl.Mode, text []byte) (int, error) {
+func (insnset *InsnSet) Decode(mode ifuzzimpl.Mode, text []byte) (int, error) {
if len(text) < 4 {
return 0, errors.New("must be at least 4 bytes")
}
@@ -61,7 +61,7 @@ func (insnset *InsnSetPowerPC) Decode(mode ifuzzimpl.Mode, text []byte) (int, er
return 0, fmt.Errorf("unrecognised instruction %08x", insn32)
}
-func (insnset *InsnSetPowerPC) DecodeExt(mode ifuzzimpl.Mode, text []byte) (int, error) {
+func (insnset *InsnSet) DecodeExt(mode ifuzzimpl.Mode, text []byte) (int, error) {
return 0, fmt.Errorf("no external decoder")
}
@@ -97,7 +97,7 @@ func Register(insns []*Insn) {
if len(insns) == 0 {
panic("no instructions")
}
- insnset := &InsnSetPowerPC{
+ insnset := &InsnSet{
Insns: insns,
insnMap: make(map[string]*Insn),
}
diff --git a/pkg/ifuzz/powerpc/pseudo.go b/pkg/ifuzz/powerpc/pseudo.go
index d9d1a0039..495e0f935 100644
--- a/pkg/ifuzz/powerpc/pseudo.go
+++ b/pkg/ifuzz/powerpc/pseudo.go
@@ -10,7 +10,7 @@ import (
)
// nolint:dupl
-func (insnset *InsnSetPowerPC) initPseudo() {
+func (insnset *InsnSet) initPseudo() {
insnset.Insns = append(insnset.Insns, &Insn{
Name: "PSEUDO_hypercall",
Priv: true,
@@ -50,7 +50,7 @@ type generator struct {
text []byte
}
-func makeGen(insnset *InsnSetPowerPC, cfg *ifuzzimpl.Config, r *rand.Rand) *generator {
+func makeGen(insnset *InsnSet, cfg *ifuzzimpl.Config, r *rand.Rand) *generator {
return &generator{
imap: insnset.insnMap,
mode: cfg.Mode,
diff --git a/pkg/ifuzz/x86/decode.go b/pkg/ifuzz/x86/decode.go
index e02a3a63f..a40643a6b 100644
--- a/pkg/ifuzz/x86/decode.go
+++ b/pkg/ifuzz/x86/decode.go
@@ -13,7 +13,7 @@ import (
// It can have falsely decode incorrect instructions,
// but should not fail to decode correct instructions.
// nolint: gocyclo, nestif, gocognit, funlen
-func (insnset *InsnSetX86) Decode(mode ifuzzimpl.Mode, text []byte) (int, error) {
+func (insnset *InsnSet) Decode(mode ifuzzimpl.Mode, text []byte) (int, error) {
if len(text) == 0 {
return 0, fmt.Errorf("zero-length instruction")
}
@@ -226,7 +226,7 @@ var (
}
)
-func (insnset *InsnSetX86) DecodeExt(mode ifuzzimpl.Mode, text []byte) (int, error) {
+func (insnset *InsnSet) DecodeExt(mode ifuzzimpl.Mode, text []byte) (int, error) {
if XedDecode != nil && text != nil && len(text) > 0 {
return XedDecode(mode, text)
}
diff --git a/pkg/ifuzz/x86/pseudo.go b/pkg/ifuzz/x86/pseudo.go
index 412b5813f..d5c66a2ab 100644
--- a/pkg/ifuzz/x86/pseudo.go
+++ b/pkg/ifuzz/x86/pseudo.go
@@ -10,7 +10,7 @@ import (
)
// nolint: funlen
-func (insnset *InsnSetX86) initPseudo() {
+func (insnset *InsnSet) initPseudo() {
insnset.Insns = append(insnset.Insns, &Insn{
Name: "PSEUDO_RDMSR",
Mode: 1<<ifuzzimpl.ModeLast - 1,
diff --git a/pkg/ifuzz/x86/x86.go b/pkg/ifuzz/x86/x86.go
index 7251d1f7b..1f882d193 100644
--- a/pkg/ifuzz/x86/x86.go
+++ b/pkg/ifuzz/x86/x86.go
@@ -47,7 +47,7 @@ type Insn struct {
generator func(cfg *ifuzzimpl.Config, r *rand.Rand) []byte // for pseudo instructions
}
-type InsnSetX86 struct {
+type InsnSet struct {
modeInsns [ifuzzimpl.ModeLast][ifuzzimpl.TypeLast][]ifuzzimpl.Insn
Insns []*Insn
}
@@ -56,7 +56,7 @@ func Register(insns []*Insn) {
if len(insns) == 0 {
panic("no instructions")
}
- insnset := &InsnSetX86{
+ insnset := &InsnSet{
Insns: insns,
}
insnset.initPseudo()
@@ -84,7 +84,7 @@ func Register(insns []*Insn) {
ifuzzimpl.Arches[ifuzzimpl.ArchX86] = insnset
}
-func (insnset *InsnSetX86) GetInsns(mode ifuzzimpl.Mode, typ ifuzzimpl.Type) []ifuzzimpl.Insn {
+func (insnset *InsnSet) GetInsns(mode ifuzzimpl.Mode, typ ifuzzimpl.Type) []ifuzzimpl.Insn {
return insnset.modeInsns[mode][typ]
}