From 99b9c7533d32051770c9c32a763c457e617ee554 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Tue, 21 Jan 2025 23:53:56 +0100 Subject: [PATCH] Cleaner assembly formatting string, syscall length checking --- user/usys.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/user/usys.py b/user/usys.py index ad4e4c7..45dea8f 100755 --- a/user/usys.py +++ b/user/usys.py @@ -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)