Skip to content

Commit

Permalink
Add 32 bit support
Browse files Browse the repository at this point in the history
  • Loading branch information
bouk committed Mar 30, 2015
1 parent 340e807 commit 944b389
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,4 @@ func main() {
1. Monkey sometimes fails to patch a function if inlining is enabled. Try running your tests with inlining disabled, for example: `go test -gcflags=-l`. The same command line argument can also be used for build.
2. Monkey won't work on some security-oriented operating system that don't allow memory pages to be both write and execute at the same time. With the current approach there's not really a reliable fix for this.
3. Monkey is not threadsafe. Or any kind of safe
4. I've tested monkey on OSX 10.10.2 and Ubuntu 14.04. It should work on any unix-based 64-bits system.
4. I've tested monkey on OSX 10.10.2 and Ubuntu 14.04. It should work on any unix-based x86 or x86-64 system.
13 changes: 13 additions & 0 deletions monkey_unix_386.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package monkey

// Assembles a jump to a function value
func jmpToFunctionValue(to uintptr) []byte {
return []byte{
0xBA,
byte(to),
byte(to >> 8),
byte(to >> 16),
byte(to >> 24), // mov edx,to
0xFF, 0x22, // jmp DWORD PTR [edx]
}
}

0 comments on commit 944b389

Please sign in to comment.