summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2016-10-07 20:57:10 -0400
committerJune McEnroe <june@causal.agency>2016-10-07 20:57:10 -0400
commitf316fd8abc765510d40d6e17f83bb0611afa9558 (patch)
treeafb9115d0c6d4a08f0aa75710718cae5d873ca1a
parentAdd runtime functions to jrp (diff)
downloadsrc-f316fd8abc765510d40d6e17f83bb0611afa9558.tar.gz
src-f316fd8abc765510d40d6e17f83bb0611afa9558.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() {