summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2016-10-07 20:57:10 -0400
committerJune McEnroe <programble@gmail.com>2016-10-07 20:57:10 -0400
commitdd8dfb7f53840f727e2d0dbf1a06c69d13e877bb (patch)
tree2ed7b465260ddf23ab4b2d3947f4f085bf20f6fc
parentAdd runtime functions to jrp (diff)
downloadsrc-dd8dfb7f53840f727e2d0dbf1a06c69d13e877bb.tar.gz
src-dd8dfb7f53840f727e2d0dbf1a06c69d13e877bb.zip
Swap stacks in OP_CALL and wasteful OP_RELO in jrp
NEED MORE BYTES.
-rwxr-xr-x.bin/jrp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/.bin/jrp.c b/.bin/jrp.c
index b98f750d..20019245 100755
--- a/.bin/jrp.c
+++ b/.bin/jrp.c
@@ -16,7 +16,8 @@ typedef value *(*fptr)(value *);
 enum {
     OP_PROL = 0x90fc8948e5894855, // push ebp; mov rbp, rsp; mov rsp, rdi
     OP_EPIL = 0xc35dec8948e08948, // mov rax, rsp; mov rsp, rbp; pop rbp; ret
-    OP_CALL = 0x90666666d0ff5f58, // pop rax; pop rdi; call rax
+    OP_CALL = 0x90d0ffe587485f58, // pop rax; pop rdi; xchg rsp, rbp; call rax
+    OP_RELO = 0x9090666666e58748, // xchg rsp, rbp
     OP_PUSH = 0x0000000068906666, // push strict dword 0
     OP_HIGH = 0x00000000042444c7, // mov [rsp + 4], strict dword 0
     OP_DROP = 0x9066666608c48348, // add rsp, 8
@@ -75,6 +76,7 @@ static void rt_print_hex(value val) {
 #define JIT_CALL(p, fn) { \
     JIT_PUSH(p, fn); \
     *p++ = OP_CALL; \
+    *p++ = OP_RELO; \
 }
 
 int main() {