aboutsummaryrefslogtreecommitdiff
path: root/script/gen-inject-asm.sh
blob: 161bbe71a6d56870f65c55bde6dd6e2720117881 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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 14
.globl _inject_page_start
_inject_page_start:
END
outfile="$1"
shift
(for fn in "$@"; do
    echo ".align 2"
    echo ".globl _inject_start_$i"
    echo "_inject_start_$i:"
    printf  ".byte "
    xxd -i < "$fn" | xargs echo
done) > "$outfile"