From b6d4fb698c04b1953580c6ba10f293bc893014a3 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Tue, 1 Feb 2022 00:39:15 -0800 Subject: [PATCH] [kernel] Support handle tag directly on syscalls The "handle" tag on syscall parameters causes syscall_verify.cpp to pass the resulting object as a obj::handle* instead of directly as an object pointer. Now the handle tag is supported directly on the syscall itself as well, causing the "self" object to be passed as a handle pointer. --- src/kernel/syscall_verify.cpp.cog | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/kernel/syscall_verify.cpp.cog b/src/kernel/syscall_verify.cpp.cog index d5357bd..80cecd8 100644 --- a/src/kernel/syscall_verify.cpp.cog +++ b/src/kernel/syscall_verify.cpp.cog @@ -94,12 +94,16 @@ for id, scope, method in syscalls.methods: elif not method.static: argdefs.append(("j6_handle_t", "self")) - cxxargdefs.append(f"obj::{scope.cname} *self") - args.append("self_obj") - type = f"obj::{scope.cname} *" + if "handle" in method.options: + args.append("self_handle") + cxxargdefs.append(f"obj::handle *self_handle") + else: + args.append("self_obj") + cxxargdefs.append(f"obj::{scope.cname} *self") + objparams.append((f"obj::{scope.cname} *", "self")) + handles.append((scope.cname, "self", get_caps(method.options, scope))) - objparams.append((type, "self")) for param in method.params: needs_obj = param.type.needs_object(param.options)