diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-11-20 19:28:53 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-11-21 08:46:20 +0100 |
| commit | 418476ecb925e5d58ba9c22928a4e37dc30909df (patch) | |
| tree | 702468b5ca1b0df89a83d861b18eaff9ae2237c5 /pkg/ifuzz/x86/encode.go | |
| parent | e1dea42221c13dabdf9d4938428f1ef91863b813 (diff) | |
pkg/ifuzz/iset: rename ifuzzimpl to iset
ifuzzimpl is too lenghty and too clumsy on my taste
(nm/vmimpl worked better b/c it's shorter and used less).
I've tried to come up with something shorter and nicer.
We could use "insn" as a common name for "instruction" in ifuzz,
but it's a commonly used name already so would cause lots of conflicts.
"iset" is somewhat descriptive, short and nice.
Diffstat (limited to 'pkg/ifuzz/x86/encode.go')
| -rw-r--r-- | pkg/ifuzz/x86/encode.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/pkg/ifuzz/x86/encode.go b/pkg/ifuzz/x86/encode.go index 9203d51c3..59b9a294a 100644 --- a/pkg/ifuzz/x86/encode.go +++ b/pkg/ifuzz/x86/encode.go @@ -10,11 +10,11 @@ package x86 import ( "math/rand" - "github.com/google/syzkaller/pkg/ifuzz/ifuzzimpl" + "github.com/google/syzkaller/pkg/ifuzz/iset" ) // nolint: gocyclo, nestif, gocognit, funlen -func (insn *Insn) Encode(cfg *ifuzzimpl.Config, r *rand.Rand) []byte { +func (insn *Insn) Encode(cfg *iset.Config, r *rand.Rand) []byte { if !cfg.IsCompatible(insn) { panic("instruction is not suitable for this mode") } @@ -24,11 +24,11 @@ func (insn *Insn) Encode(cfg *ifuzzimpl.Config, r *rand.Rand) []byte { var operSize, immSize, dispSize, addrSize int switch cfg.Mode { - case ifuzzimpl.ModeLong64: + case iset.ModeLong64: operSize, immSize, dispSize, addrSize = 4, 4, 4, 8 - case ifuzzimpl.ModeProt32: + case iset.ModeProt32: operSize, immSize, dispSize, addrSize = 4, 4, 4, 4 - case ifuzzimpl.ModeProt16, ifuzzimpl.ModeReal16: + case iset.ModeProt16, iset.ModeReal16: operSize, immSize, dispSize, addrSize = 2, 2, 2, 2 default: panic("bad mode") @@ -54,7 +54,7 @@ func (insn *Insn) Encode(cfg *ifuzzimpl.Config, r *rand.Rand) []byte { if !insn.No66Prefix { prefixes = append(prefixes, 0x66) // operand size } - if cfg.Mode == ifuzzimpl.ModeLong64 || !insn.Mem32 { + if cfg.Mode == iset.ModeLong64 || !insn.Mem32 { prefixes = append(prefixes, 0x67) // address size } if !insn.NoRepPrefix { @@ -71,7 +71,7 @@ func (insn *Insn) Encode(cfg *ifuzzimpl.Config, r *rand.Rand) []byte { // REX var rex byte - if cfg.Mode == ifuzzimpl.ModeLong64 && r.Intn(2) == 0 { + if cfg.Mode == iset.ModeLong64 && r.Intn(2) == 0 { // bit 0 - B // bit 1 - X // bit 2 - R @@ -119,7 +119,7 @@ func (insn *Insn) Encode(cfg *ifuzzimpl.Config, r *rand.Rand) []byte { code = append(code, insn.Vex) vexR = byte(1) vexX = byte(1) - if cfg.Mode == ifuzzimpl.ModeLong64 { + if cfg.Mode == iset.ModeLong64 { vexR = byte(r.Intn(2)) vexX = byte(r.Intn(2)) } @@ -147,7 +147,7 @@ func (insn *Insn) Encode(cfg *ifuzzimpl.Config, r *rand.Rand) []byte { code = append(code, vexR<<7|vexX<<6|vexB<<5|insn.VexMap) code = append(code, W<<7|vvvv<<3|L<<2|pp) // TODO: short encoding - if cfg.Mode != ifuzzimpl.ModeLong64 { + if cfg.Mode != iset.ModeLong64 { vvvv |= 8 } } |
