aboutsummaryrefslogtreecommitdiff
path: root/script/gen-inject-asm.sh
blob: eacbbad52f8613a1b4f85cc9ad73ce8b4a1e8ab6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh
cat <<END
/* Generated by script/gen-inject-asm.sh.  The relevant source is in-tree (make
 * out/darwin-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