summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2016-10-05 23:19:11 -0400
committerJune McEnroe <programble@gmail.com>2016-10-05 23:19:11 -0400
commit5bb584ef1b3f5651d5b25e133ec8a397c617fe0f (patch)
treea13bc35379fa4372268cfc597aa9c547fc8870e3
parentUse long type in rpn (diff)
downloadsrc-5bb584ef1b3f5651d5b25e133ec8a397c617fe0f.tar.gz
src-5bb584ef1b3f5651d5b25e133ec8a397c617fe0f.zip
Begin JRP
-rwxr-xr-x.bin/jrp.c30
-rwxr-xr-xinstall.sh1
2 files changed, 31 insertions, 0 deletions
diff --git a/.bin/jrp.c b/.bin/jrp.c
new file mode 100755
index 00000000..615f8a97
--- /dev/null
+++ b/.bin/jrp.c
@@ -0,0 +1,30 @@
+#if 0
+exec cc -Wall -Wextra $@ -o $(dirname $0)/jrp $0
+#endif
+
+enum op {
+    OP_PROL = 0xfc8948e789495741, // push r15; mov r15, rsp; mov rsp, rdi
+    OP_EPIL = 0x5f41fc894ce08948, // mov rax, rsp; mov rsp, r15; pop r15
+    OP_RET  = 0x90666690666666c3, // ret
+    OP_CALL = 0x90666666d0ff5f58, // pop rax; pop rdi; call rax
+    OP_PUSH = 0x9066660000000068, // push strict dword 0
+    OP_DROP = 0x9066666608c48348, // add rsp, 8
+    OP_DUP  = 0x90906666662434ff, // push qword [rsp]
+    OP_SWAP = 0x9066666650515859, // pop rcx; pop rax; push rcx; push rax
+    OP_NEG  = 0x90666666241cf748, // neg qword [rsp]
+    OP_ADD  = 0x906666240c014859, // pop rcx; add [rsp], rcx
+    OP_SUB  = 0x906666240c294859, // pop rcx; sub [rsp], rcx
+    OP_MUL  = 0x9050c1af0f485859, // pop rcx; pop rax; imul rax, rcx; push rax
+    OP_DIV  = 0x50f9f74899485859, // pop rcx; pop rax; cqo; idiv rcx; push rax
+    OP_REM  = 0x52f9f74899485859, // pop rcx; pop rax; cqo; idiv rcx; push rdx
+    OP_NOT  = 0x906666662414f748, // not qword [rsp]
+    OP_AND  = 0x906666240c214859, // pop rcx; and [rsp], rcx
+    OP_OR   = 0x906666240c904859, // pop rcx; or [rsp], rcx
+    OP_XOR  = 0x906666240c314859, // pop rcx; xor [rsp], rcx
+    OP_SHL  = 0x9066662424d34859, // pop rcx; shl qword [rsp], cl
+    OP_SHR  = 0x906666242cd34859, // pop rcx; shr qword [rsp], cl
+};
+
+int main() {
+    return 0;
+}
diff --git a/install.sh b/install.sh
index 98b4de54..fd0010c2 100755
--- a/install.sh
+++ b/install.sh
@@ -21,6 +21,7 @@ link() {
   echo "$1"
 }
 
+link .bin/jrp.c
 link .bin/manpager
 link .bin/pbcopy
 link .bin/pbd.c