Cleaner assembly formatting string, syscall length checking

This commit is contained in:
Imbus 2025-01-21 23:53:56 +01:00
parent fbef2ef765
commit 99b9c7533d

View file

@ -1,13 +1,18 @@
#!/usr/bin/env python3
template = """.global {name}
template = """
.global {name}
{name}:
li a7, SYS_{name}
ecall
ret"""
ret
""".strip()
def genstub(syscall: str):
if not 3 >= len(syscall) <= 15:
raise ValueError("Syscall {} is too short/long!".format(syscall[:35]))
return template.format(name=syscall)