[kernel] Add test mode, controlled by manifest

The manifest can now supply a list of boot flags, including "test".
Those get turned into the bootproto::args::flags field by the
bootloader. The kernel takes those and uses the test flag to control
enabling syscalls with the new "test" attribute, like the new
test_finish syscall, which lets automated tests call back to the kernel
to shut down the system.
This commit is contained in:
Justin C. Miller
2022-02-03 19:45:46 -08:00
parent 401e662f0b
commit 0e80c19d3d
12 changed files with 59 additions and 11 deletions

View File

@@ -66,7 +66,7 @@ syscall_invalid(uint64_t call)
}
void
syscall_initialize()
syscall_initialize(bool enable_test)
{
memset(&syscall_registry, 0, sizeof(syscall_registry));
@@ -77,8 +77,17 @@ syscall_initialize()
else:
name = method.name
cog.outl(f"syscall_registry[{id}] = reinterpret_cast<uintptr_t>(syscalls::_syscall_verify_{name});")
cog.outl(f"""log::debug(logs::syscall, "Enabling syscall {id:02x} as {name}");""")
indent = ""
if "test" in method.options:
cog.outl("if (enable_test) {")
indent = " "
cog.outl(f"{indent}syscall_registry[{id}] = reinterpret_cast<uintptr_t>(syscalls::_syscall_verify_{name});")
cog.outl(f"""{indent}log::debug(logs::syscall, "Enabling syscall {id:02x} as {name}");""")
if "test" in method.options:
cog.outl("}")
cog.outl("")
]]]*/
//[[[end]]]