Compare commits

...

2 commits

Author SHA1 Message Date
Imbus
c8e3356a1d Typo in py 2025-01-15 13:28:20 +01:00
Imbus
c9665ce5bd Sanity checking when generating usys.S 2025-01-15 13:14:02 +01:00
2 changed files with 23 additions and 0 deletions

View file

@ -6,6 +6,9 @@ struct stat;
/**
* System calls
*
* Note that none of these calls are implemented in C. They are implemented in assembly in [usys.S](./usys.S). This file
* is in turn generated by the [usys.py](./usys.py) script during the build.
*/
/** Create a child process */

View file

@ -42,6 +42,26 @@ assembly = "\n\n".join(map(genstub, syscalls))
# TODO: Perhaps do some more specific assertions on the code here
assert len(assembly) > 0, "No assembly code generated. Something is fishy"
with open("kernel/syscall.h", "r") as sfile:
lines = list(filter(lambda x: x.startswith("#define"), sfile.readlines()))
header_calls = set([line.split()[1] for line in lines])
calls = set(["SYS_" + call for call in syscalls])
if header_calls == calls:
print("#All items match in both sets.")
else:
missing_in_calls = header_calls - calls
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)
if missing_in_header_calls:
print(
"#These items are in calls but not in header_calls:",
missing_in_header_calls,
)
print("# generated by usys.py - do not edit\n")
print('#include "kernel/syscall.h"\n')
print(assembly)