[kernel] Track capability reference counts

First pass at reference-counting capabilities.
This commit is contained in:
Justin C. Miller
2023-01-14 15:40:18 -08:00
parent 7150e11ed0
commit e93f48e2f7
6 changed files with 94 additions and 14 deletions

View File

@@ -184,10 +184,22 @@ for id, scope, method in syscalls.methods:
cog.outl()
if "noreturn" in method.options:
if handles:
cog.outl(f""" static_assert(false, "Cannot define a `noreturn` syscall that holds handles.");""")
cog.outl(f""" {name}({", ".join(args)});""")
else:
cog.outl(f""" profiler<syscall_profiles, {id}> profile {{"{name}"}};""")
cog.outl(f""" return {name}({", ".join(args)});""")
cog.outl(" j6_status_t _retval;")
cog.outl(" {")
cog.outl(f""" profiler<syscall_profiles, {id}> profile {{"{name}"}};""")
cog.outl(f""" _retval = {name}({", ".join(args)});""")
cog.outl(" }\n")
for type, arg, caps in handles:
cog.outl(f" release_handle({arg});")
cog.outl(f""" return _retval;""")
cog.outl("}")
cog.outl("\n")
]]]*/