MCPcopy Create free account
hub / github.com/dobin/SuperMega / assemble_lea

Function assemble_lea

pe/asmdisasm.py:19–25  ·  view source on GitHub ↗
(current_address: int, destination_address: int, reg: str)

Source from the content-addressed store, hash-verified

17ks = Ks(KS_ARCH_X86, KS_MODE_64)
18
19def assemble_lea(current_address: int, destination_address: int, reg: str) -> bytes:
20 #print("LEAH: 0x{:X} - 0x{:X} = 0x{:X}".format(
21 # current_address, destination_address, destination_address - current_address))
22 offset = destination_address - current_address
23 encoding, _ = ks.asm(f"lea {reg}, qword ptr ds:[{offset}]")
24 machine_code = bytes(encoding)
25 return machine_code
26
27
28def assemble_relative_call(current_address: int, destination_address: int) -> bytes:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected