Skip to content

Commit

Permalink
fix createArm64Nops bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pkujhd committed Sep 9, 2023
1 parent f2051b2 commit f249c6e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func createX86Amd64Nops(size int) []byte {
}

func createArm64Nops(size int) []byte {
if size%4 != 0 {
panic(fmt.Sprintf("can't make nop instruction if padding is not multiple of 4, got %d", size))
if size%sys.ArchARM.MinLC != 0 {
panic(fmt.Sprintf("can't make nop instruction if padding is not multiple of %d, got %d", sys.ArchARM.MinLC, size))
}
nops := make([]byte, size)
for i := 0; i < size/sys.ArchARM.MinLC; i += 4 {
for i := 0; i < size; i += sys.ArchARM.MinLC {
copy(nops[i:], arm64Nopcode)
}
return nops
Expand Down

0 comments on commit f249c6e

Please sign in to comment.