From f37ad136f6f3c26c6c2d56d5fc480a0a55ce24f5 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 20 Nov 2020 18:40:43 +0100 Subject: pkg/ifuzz/x86: don't use X86 suffix for types x86.InsnSetX86 is excessive. Everything in x86 package is x86-ish already. --- pkg/ifuzz/powerpc/powerpc.go | 10 +++++----- pkg/ifuzz/powerpc/pseudo.go | 4 ++-- pkg/ifuzz/x86/decode.go | 4 ++-- pkg/ifuzz/x86/pseudo.go | 2 +- pkg/ifuzz/x86/x86.go | 6 +++--- 5 files changed, 13 insertions(+), 13 deletions(-) (limited to 'pkg/ifuzz') 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<