Skip to content

Commit

Permalink
Merge pull request #134 from zhangguanzhang/fix-loong64
Browse files Browse the repository at this point in the history
Complete some go build tags and fix declaration on MacOS
  • Loading branch information
agiledragon authored May 22, 2023
2 parents d676bd2 + 786aad4 commit a95d20b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jmp_arm64.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build arm64
// +build arm64

package gomonkey

import "unsafe"
Expand All @@ -9,10 +12,10 @@ func buildJmpDirective(double uintptr) []byte {
d4d5 := double >> 32 & 0xFFFF
d6d7 := double >> 48 & 0xFFFF

res = append(res, movImm(0B10, 0, d0d1)...) // MOVZ x26, double[16:0]
res = append(res, movImm(0B11, 1, d2d3)...) // MOVK x26, double[32:16]
res = append(res, movImm(0B11, 2, d4d5)...) // MOVK x26, double[48:32]
res = append(res, movImm(0B11, 3, d6d7)...) // MOVK x26, double[64:48]
res = append(res, movImm(0b10, 0, d0d1)...) // MOVZ x26, double[16:0]
res = append(res, movImm(0b11, 1, d2d3)...) // MOVK x26, double[32:16]
res = append(res, movImm(0b11, 2, d4d5)...) // MOVK x26, double[48:32]
res = append(res, movImm(0b11, 3, d6d7)...) // MOVK x26, double[64:48]
res = append(res, []byte{0x4A, 0x03, 0x40, 0xF9}...) // LDR x10, [x26]
res = append(res, []byte{0x40, 0x01, 0x1F, 0xD6}...) // BR x10

Expand Down
3 changes: 3 additions & 0 deletions jmp_loong64.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
//go:build loong64
// +build loong64

package gomonkey

import "unsafe"
Expand Down

0 comments on commit a95d20b

Please sign in to comment.