aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ifuzz
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-11 17:09:04 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-12 08:22:44 +0200
commitc1147c8df73eb61bc9d66e6628e0369e21f28670 (patch)
tree1f5f75bf13a32941025c134fdd236fb137cf3181 /pkg/ifuzz
parent0faffd0438df859fb66236085ac3992735900d26 (diff)
all: fix comments format
Fix capitalization, dots at the end and two spaces after a period. Update #1876
Diffstat (limited to 'pkg/ifuzz')
-rw-r--r--pkg/ifuzz/gen/gen.go2
-rw-r--r--pkg/ifuzz/ifuzz.go16
-rw-r--r--pkg/ifuzz/pseudo.go14
3 files changed, 16 insertions, 16 deletions
diff --git a/pkg/ifuzz/gen/gen.go b/pkg/ifuzz/gen/gen.go
index 224010a1c..2bbd69109 100644
--- a/pkg/ifuzz/gen/gen.go
+++ b/pkg/ifuzz/gen/gen.go
@@ -343,7 +343,7 @@ func parsePattern(insn *ifuzz.Insn, vals []string) error {
case v == "SE_IMM8()":
addImm(insn, 1)
- // Modes
+ // Modes.
case v == "mode64":
insn.Mode &= 1 << ifuzz.ModeLong64
case v == "not64":
diff --git a/pkg/ifuzz/ifuzz.go b/pkg/ifuzz/ifuzz.go
index 2d51e0340..5d6269926 100644
--- a/pkg/ifuzz/ifuzz.go
+++ b/pkg/ifuzz/ifuzz.go
@@ -140,37 +140,37 @@ func Mutate(cfg *Config, r *rand.Rand, text []byte) []byte {
retry = false
switch x := r.Intn(100); {
case x < 10 && len(insns) != 0:
- // delete instruction
+ // Delete instruction.
i := r.Intn(len(insns))
copy(insns[i:], insns[i+1:])
insns = insns[:len(insns)-1]
case x < 40 && len(insns) != 0:
- // replace instruction with another
+ // Replace instruction with another.
insn := randInsn(cfg, r)
text1 := insn.Encode(cfg, r)
i := r.Intn(len(insns))
insns[i] = text1
case x < 70 && len(insns) != 0:
- // mutate instruction
+ // Mutate instruction.
i := r.Intn(len(insns))
text1 := insns[i]
for stop := false; !stop || len(text1) == 0; stop = r.Intn(2) == 0 {
switch x := r.Intn(100); {
case x < 5 && len(text1) != 0:
- // delete byte
+ // Delete byte.
pos := r.Intn(len(text1))
copy(text1[pos:], text1[pos+1:])
text1 = text1[:len(text1)-1]
case x < 40 && len(text1) != 0:
- // replace a byte
+ // Replace a byte.
pos := r.Intn(len(text1))
text1[pos] = byte(r.Intn(256))
case x < 70 && len(text1) != 0:
- // flip a bit
+ // Flip a bit.
pos := r.Intn(len(text1))
text1[pos] ^= 1 << byte(r.Intn(8))
default:
- // insert a byte
+ // Insert a byte.
pos := r.Intn(len(text1) + 1)
text1 = append(text1, 0)
copy(text1[pos+1:], text1[pos:])
@@ -179,7 +179,7 @@ func Mutate(cfg *Config, r *rand.Rand, text []byte) []byte {
}
insns[i] = text1
case len(insns) < cfg.Len:
- // insert a new instruction
+ // Insert a new instruction.
insn := randInsn(cfg, r)
text1 := insn.Encode(cfg, r)
i := r.Intn(len(insns) + 1)
diff --git a/pkg/ifuzz/pseudo.go b/pkg/ifuzz/pseudo.go
index 306725d2e..e9903f909 100644
--- a/pkg/ifuzz/pseudo.go
+++ b/pkg/ifuzz/pseudo.go
@@ -162,7 +162,7 @@ func initPseudo() {
}
reg := uint8(r.Intn(6))
gen.mov16(regAX, sel)
- gen.byte(0x8e, 0xc0|(reg<<3)) // mov %ax, %seg
+ gen.byte(0x8e, 0xc0|(reg<<3)) // MOV %ax, %seg
return gen.text
},
})
@@ -421,10 +421,10 @@ func (gen *generator) xor32(reg int, v uint32) {
func (gen *generator) readCR(cr uint8) {
if cr < 8 {
- // mov %crN, %eax/%rax
+ // MOV %crN, %eax/%rax
gen.byte(0x0f, 0x20, 0xc0|cr<<3)
} else if cr < 16 {
- // mov %crN, %eax/%rax
+ // MOV %crN, %eax/%rax
gen.byte(0x44, 0x0f, 0x20, 0xc0|(cr-8)<<3)
} else {
panic("bad cr")
@@ -433,10 +433,10 @@ func (gen *generator) readCR(cr uint8) {
func (gen *generator) writeCR(cr uint8) {
if cr < 8 {
- // mov %eax/%rax, %crN
+ // MOV %eax/%rax, %crN
gen.byte(0x0f, 0x22, 0xc0|cr<<3)
} else if cr < 16 {
- // mov %eax/%rax, %crN
+ // MOV %eax/%rax, %crN
gen.byte(0x44, 0x0f, 0x22, 0xc0|(cr-8)<<3)
} else {
panic("bad cr")
@@ -447,7 +447,7 @@ func (gen *generator) readDR(dr uint8) {
if dr >= 8 {
panic("bad dr")
}
- // mov %drN, %eax/%rax
+ // MOV %drN, %eax/%rax
gen.byte(0x0f, 0x21, 0xc0|dr<<3)
}
@@ -455,7 +455,7 @@ func (gen *generator) writeDR(dr uint8) {
if dr >= 8 {
panic("bad dr")
}
- // mov %eax/%rax, %drN
+ // MOV %eax/%rax, %drN
gen.byte(0x0f, 0x23, 0xc0|dr<<3)
}