[kernel] Let objects inherit caps from superclasses

The main point of this change is to allow "global" capabilities defined
on the base object type. The example here is the clone capability on all
objects, which governs the ability to clone a handle.

Related changes in this commit:
- Renamed `kobject` to `object` as far as the syscall interface is
  concerned. `kobject` is the cname, but j6_cap_kobject_clone feels
  clunky.
- The above change made me realize that the "object <type>" syntax for
  specifying object references was also clunky, so now it's "ref <type>"
- Having to add `.object` on everywhere to access objects in
  interface.exposes or object.super was cumbersome, so those properties
  now return object types directly, instead of ObjectRef.
- syscall_verify.cpp.cog now generates code to check capabilities on
  handles if they're specified in the definition, even when not passing
  an object to the implementation function.
This commit is contained in:
Justin C. Miller
2022-01-29 15:22:38 -08:00
parent bdae812274
commit cd037aca15
19 changed files with 101 additions and 70 deletions

View File

@@ -13,14 +13,14 @@ using namespace obj;
namespace syscalls {
j6_status_t
kobject_koid(kobject *self, j6_koid_t *koid)
object_koid(kobject *self, j6_koid_t *koid)
{
*koid = self->koid();
return j6_status_ok;
}
j6_status_t
kobject_wait(kobject *self, j6_signal_t mask, j6_signal_t *sigs)
object_wait(kobject *self, j6_signal_t mask, j6_signal_t *sigs)
{
j6_signal_t current = self->signals();
if ((current & mask) != 0) {
@@ -40,7 +40,7 @@ kobject_wait(kobject *self, j6_signal_t mask, j6_signal_t *sigs)
}
j6_status_t
kobject_wait_many(j6_handle_t * handles, size_t handles_count, uint64_t mask, j6_handle_t * woken, uint64_t * signals)
object_wait_many(j6_handle_t * handles, size_t handles_count, uint64_t mask, j6_handle_t * woken, uint64_t * signals)
{
util::vector<kobject*> objects {uint32_t(handles_count)};
@@ -90,7 +90,7 @@ kobject_wait_many(j6_handle_t * handles, size_t handles_count, uint64_t mask, j6
}
j6_status_t
kobject_signal(kobject *self, j6_signal_t signals)
object_signal(kobject *self, j6_signal_t signals)
{
if ((signals & j6_signal_user_mask) != signals)
return j6_err_invalid_arg;
@@ -100,7 +100,7 @@ kobject_signal(kobject *self, j6_signal_t signals)
}
j6_status_t
kobject_close(kobject *self)
object_close(kobject *self)
{
self->close();
return j6_status_ok;

View File

@@ -44,7 +44,7 @@ j6_status_t
process_give_handle(process *self, j6_handle_t target, j6_handle_t *received)
{
handle *target_handle = get_handle<kobject>(target);
j6_handle_t out = self->add_handle(target_handle->object, target_handle->caps);
j6_handle_t out = self->add_handle(target_handle->object, target_handle->caps());
if (received)
*received = out;