aboutsummaryrefslogtreecommitdiff
path: root/script/gen-inject-asm.sh
diff options
context:
space:
mode:
authorcomex2015-01-21 01:51:55 -0500
committercomex2015-01-21 01:51:55 -0500
commit9109a492825f2d79bc28e0f54b2a83b494cc7a7e (patch)
tree25d3660b0adb733dbd0bd70d9ae2e8072d5466dc /script/gen-inject-asm.sh
parentpointless optimization (diff)
downloadsubstitute-9109a492825f2d79bc28e0f54b2a83b494cc7a7e.tar.gz
oops, forgot to add that
Diffstat (limited to '')
-rwxr-xr-xscript/gen-inject-asm.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/script/gen-inject-asm.sh b/script/gen-inject-asm.sh
new file mode 100755
index 0000000..962ecc6
--- /dev/null
+++ b/script/gen-inject-asm.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+echo <<END
+/* Generated by script/gen-inject-asm.sh. The relevant source is in-tree (make
+ * out/inject-asm.S), but this file has been checked in too, in case your C
+ * compiler doesn't support all of these architectures.
+ * This file contains code for 4 architectures in one text page; it's remapped
+ * into the target process and the appropriate thunk executed. Having ARM code
+ * here on x86 and whatnot is currently pointless (and use of that code is
+ * disabled in case any future Rosetta-like emulator breaks naive attempts to
+ * inject into foreign-architecture processes), but we need two architectures
+ * anyway, so the rest are included in case doing so is useful someday. */
+ .align 12
+.globl _inject_page_start
+_inject_page_start:
+END
+for i in x86_64 i386 arm arm64; do
+ echo ".align 2"
+ echo ".globl _inject_start_$i"
+ echo "_inject_start_$i:"
+ printf ".byte "
+ xxd -i < out/inject-asm-raw-$i.bin | xargs echo
+done