From 99b9c7533d32051770c9c32a763c457e617ee554 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Tue, 21 Jan 2025 23:53:56 +0100 Subject: [PATCH 1/2] 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) From 0b46382a56f9df765dc507c17af6ae7ec7670bfc Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Tue, 21 Jan 2025 23:54:00 +0100 Subject: [PATCH 2/2] Formatting --- user/usys.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/user/usys.py b/user/usys.py index 45dea8f..677c5b8 100755 --- a/user/usys.py +++ b/user/usys.py @@ -60,7 +60,9 @@ with open("kernel/syscall.h", "r") as sfile: missing_in_header_calls = calls - header_calls if missing_in_calls: - print("#These items are in header_calls but not in calls:", missing_in_calls) + print( + "#These items are in header_calls but not in calls:", missing_in_calls + ) if missing_in_header_calls: print( "#These items are in calls but not in header_calls:",