Commit 83e8ef65 authored by Josh Kunz's avatar Josh Kunz

Adds a reference from a cnode its cptr

        Rationale: When the `revoke` handler is called for a particular
        cspace, cnode, and object, the cptr associated with that cnode
        needs to be free'd so it can be re-used by other objects (given
        there are a relatively small number of cptrs in a cspace).
        We can discover the cptr_cache associated with a cspace by
        looking at the `cspace->owner` field (which we point at our
        cache), but we can't figure out from the cnode alone which
        pointer in that cache points to the given cnode. This
        information is known when the cnode is created, so I added a
        field to the cnode that contains this information.
parent d36af6bc
Pipeline #117 passed with stage
......@@ -164,6 +164,11 @@ void cap_destroy_cspace(struct cspace *cspace);
* (so we can easily get out of deadlocks while debugging)
int cap_cnode_verify(struct cspace *cspace, cptr_t cap);
* Return the cptr that points to this cnode.
cptr_t cap_cnode_cptr(struct cnode *cnode);
* For now, put debug macros in the user-accessible part; convenient.
......@@ -22,6 +22,7 @@ enum allocation_state {
struct cnode {
cptr_t cptr;
cap_mutex_t lock;
* cnode data
......@@ -450,6 +450,8 @@ int cap_cnode_verify(struct cspace *cspace, cptr_t c)
return ret;
cptr_t cap_cnode_cptr(struct cnode *cnode) { return cnode->cptr; }
int cap_insert(struct cspace *cspace, cptr_t c, void *object, cap_type_t type)
struct cnode *cnode;
......@@ -474,6 +476,7 @@ int cap_insert(struct cspace *cspace, cptr_t c, void *object, cap_type_t type)
cnode->cspace = cspace;
cnode->object = object;
cnode->type = type;
cnode->cptr = c;
* Set up cdt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment