Skip to content

Commit

Permalink
s/cheri_cap_build/cheri_address_set/g
Browse files Browse the repository at this point in the history
After review comments from Laurie and Andrei. Thanks both!
  • Loading branch information
probablytom committed Nov 13, 2023
1 parent da50830 commit 3c39dc7
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions example_allocators/compartment_alloc/compartment_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ void *__capability malloc_compartment(size_t len, void *__capability compartment
compartment.bytes_allocated = new_allocated;

// We allocated some space!
// Create a capability pointing to it and return it.
// The capability is bounded by the data capability for this compartment.
allocated = cheri_cap_build((void *__capability) addr, (__uintcap_t) compartment.datacap);
allocated = cheri_address_set(
allocated, (long) addr); // not sure why this is necessary...cheri_cap_build should do this
// Create a capability pointing to it and return that.
// The capability inherits the metadata of data capability for this compartment.
allocated = cheri_address_set(compartment.datacap, (long) addr);
allocated = cheri_bounds_set_exact(allocated, rounded_length);

return allocated;
Expand Down

0 comments on commit 3c39dc7

Please sign in to comment.