Cleaner assembly formatting string, syscall length checking
This commit is contained in:
parent
fbef2ef765
commit
99b9c7533d
1 changed files with 7 additions and 2 deletions
|
@ -1,13 +1,18 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
template = """.global {name}
|
template = """
|
||||||
|
.global {name}
|
||||||
{name}:
|
{name}:
|
||||||
li a7, SYS_{name}
|
li a7, SYS_{name}
|
||||||
ecall
|
ecall
|
||||||
ret"""
|
ret
|
||||||
|
""".strip()
|
||||||
|
|
||||||
|
|
||||||
def genstub(syscall: str):
|
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)
|
return template.format(name=syscall)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue