import pathlib
+
+ARCH = {
+ "powerpc": "ppc",
+ "powerpc64": "ppc64",
+ "ppc64le": "ppc64",
+ "i686": "i386",
+ "x86_64": "amd64",
+ "x64": "amd64",
+ "arm64": "aarch64",
+ "aarch64_be": "aarch64",
+ "armv8b": "aarch64",
+ "armv8l": "aarch64",
+}
+
+
class Syscall:
def __init__(self, entry, guest, host, parameters):
if not isinstance(entry, str):
if logger is None:
logger = lambda *args, **kwargs: None
+ guest = ARCH.get(guest, guest)
+ host = ARCH.get(host, host)
+
def i386(sysnums):
yield from sysnums["x86-32"]["i386"].items()
import re
+from . import ARCH
from . import Dispatcher
from . import UnknownSyscall
self.print("}")
-
def main():
main_parser = argparse.ArgumentParser("lscmg",
description="Linux system calls mapping generator")
ecall_parser = main_subparsers.add_parser("ecall")
ecall_parser.add_argument("guest",
help="guest architecture",
- choices=("riscv64", "ppc", "ppc64"))
+ type=lambda arch: ARCH.get(arch, arch))
ecall_parser.add_argument("host",
help="amd64 architecture",
- choices=("amd64", "arm", "aarch64"))
+ type=lambda arch: ARCH.get(arch, arch))
ecall_parser.set_defaults(generate=ECallGenerator())
arguments = dict(vars(main_parser.parse_args()))