|
6 | 6 | import argparse, pathlib |
7 | 7 | from io import BytesIO |
8 | 8 |
|
| 9 | +def volumespec(s): |
| 10 | + return tuple(s.split(":", 2)) |
| 11 | + |
9 | 12 | parser = argparse.ArgumentParser(description='Run a Mach-O payload under the hypervisor') |
10 | 13 | parser.add_argument('-s', '--symbols', type=pathlib.Path) |
11 | 14 | parser.add_argument('-m', '--script', type=pathlib.Path, action='append', default=[]) |
|
18 | 21 | parser.add_argument('-r', '--raw', action="store_true") |
19 | 22 | parser.add_argument('-E', '--entry-point', action="store", type=int, help="Entry point for the raw image", default=0x800) |
20 | 23 | parser.add_argument('-a', '--append-payload', type=pathlib.Path, action="append", default=[]) |
| 24 | +parser.add_argument('-v', '--volume', type=volumespec, action='append', |
| 25 | + help='Attach a 9P virtio device for file export to the guest. The argument is a host path to the ' |
| 26 | + 'exported tree, joined by colon (\':\') with a tag under which the tree will be advertised ' |
| 27 | + 'on the guest side.') |
21 | 28 | parser.add_argument('payload', type=pathlib.Path) |
22 | 29 | parser.add_argument('boot_args', default=[], nargs="*") |
23 | 30 | args = parser.parse_args() |
|
27 | 34 | from m1n1.utils import * |
28 | 35 | from m1n1.shell import run_shell |
29 | 36 | from m1n1.hv import HV |
| 37 | +from m1n1.hv.virtio import Virtio9PTransport |
30 | 38 | from m1n1.hw.pmu import PMU |
31 | 39 |
|
32 | 40 | iface = UartInterface() |
|
55 | 63 | if args.debug_xnu: |
56 | 64 | hv.adt["chosen"].debug_enabled = 1 |
57 | 65 |
|
| 66 | +if args.volume: |
| 67 | + for path, tag in args.volume: |
| 68 | + hv.attach_virtio(Virtio9PTransport(root=path, tag=tag)) |
| 69 | + |
58 | 70 | if args.logfile: |
59 | 71 | hv.set_logfile(args.logfile.open("w")) |
60 | 72 |
|
|
0 commit comments