github.com/agiledragon/gomonkey/v2@v2.11.1-0.20240427155748-d56c6823ec17/jmp_amd64.go (about)

     1  package gomonkey
     2  
     3  func buildJmpDirective(double uintptr) []byte {
     4      d0 := byte(double)
     5      d1 := byte(double >> 8)
     6      d2 := byte(double >> 16)
     7      d3 := byte(double >> 24)
     8      d4 := byte(double >> 32)
     9      d5 := byte(double >> 40)
    10      d6 := byte(double >> 48)
    11      d7 := byte(double >> 56)
    12  
    13      return []byte{
    14          0x48, 0xBA, d0, d1, d2, d3, d4, d5, d6, d7, // MOV rdx, double
    15          0xFF, 0x22,     // JMP [rdx]
    16      }
    17  }
    18