monkey_386.go 250 B

12345678910111213
  1. package monkey
  2. // Assembles a jump to a function value
  3. func jmpToFunctionValue(to uintptr) []byte {
  4. return []byte{
  5. 0xBA,
  6. byte(to),
  7. byte(to >> 8),
  8. byte(to >> 16),
  9. byte(to >> 24), // mov edx,to
  10. 0xFF, 0x22, // jmp DWORD PTR [edx]
  11. }
  12. }