diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2020-09-21 16:46:57 -0400 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:23 -0400 |
commit | 304adba717b30df17b4db3c76993a649c3efec0e (patch) | |
tree | a2563a18f25a919b4fa6f1e6af6754f92a1ee3d7 /ujit_asm.c | |
parent | c20066b24cf1c1c235d1f9402b7986b5085cad53 (diff) |
Add location hint to code block mmap call
Diffstat (limited to 'ujit_asm.c')
-rw-r--r-- | ujit_asm.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/ujit_asm.c b/ujit_asm.c index 6e12abe513..c5e508fddb 100644 --- a/ujit_asm.c +++ b/ujit_asm.c @@ -117,7 +117,7 @@ void cb_init(codeblock_t* cb, size_t mem_size) { // Map the memory as executable cb->mem_block = (uint8_t*)mmap( - NULL, + &cb_init, mem_size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, @@ -1084,14 +1084,12 @@ void jmp_rm(codeblock_t* cb, x86opnd_t opnd) } /* -/// Opcode for direct jump with relative 8-bit offset -const ubyte JMP_REL8_OPCODE = 0xEB; -*/ - -/* /// jmp - Jump with relative 8-bit offset void jmp8(CodeBlock cb, int8_t offset) { + /// Opcode for direct jump with relative 8-bit offset + const ubyte JMP_REL8_OPCODE = 0xEB; + cb.writeASM("jmp", ((offset > 0)? "+":"-") ~ to!string(offset)); cb.writeByte(JMP_REL8_OPCODE); cb.writeByte(offset); |