summaryrefslogtreecommitdiff
path: root/viengoos
diff options
context:
space:
mode:
Diffstat (limited to 'viengoos')
-rw-r--r--viengoos/activity.c70
-rw-r--r--viengoos/activity.h22
-rw-r--r--viengoos/ager.c10
-rw-r--r--viengoos/cap.c106
-rw-r--r--viengoos/cap.h18
-rw-r--r--viengoos/memory.c14
-rw-r--r--viengoos/messenger.c48
-rw-r--r--viengoos/messenger.h14
-rw-r--r--viengoos/object.c296
-rw-r--r--viengoos/object.h88
-rw-r--r--viengoos/pager.c14
-rw-r--r--viengoos/server.c600
-rw-r--r--viengoos/t-activity.c40
-rw-r--r--viengoos/t-as.c188
-rw-r--r--viengoos/t-guard.c6
-rw-r--r--viengoos/thread.c64
-rw-r--r--viengoos/thread.h18
-rw-r--r--viengoos/viengoos.c2
18 files changed, 810 insertions, 808 deletions
diff --git a/viengoos/activity.c b/viengoos/activity.c
index 220b362..36e9096 100644
--- a/viengoos/activity.c
+++ b/viengoos/activity.c
@@ -35,11 +35,11 @@ void
activity_create (struct activity *parent,
struct activity *child)
{
- struct object *old_parent = cap_to_object (parent, &child->parent_cap);
+ struct object *old_parent = vg_cap_to_object (parent, &child->parent_cap);
if (old_parent)
/* CHILD is live. Destroy it first. */
{
- assert (object_type (old_parent) == cap_activity_control);
+ assert (object_type (old_parent) == vg_cap_activity_control);
activity_destroy (parent, child);
}
@@ -54,15 +54,15 @@ activity_create (struct activity *parent,
/* Connect to PARENT's activity list. */
child->sibling_next_cap = parent->children_cap;
- child->sibling_prev_cap.type = cap_void;
+ child->sibling_prev_cap.type = vg_cap_void;
parent->children_cap = object_to_cap ((struct object *) child);
- struct object *old_head = cap_to_object (parent, &child->sibling_next_cap);
+ struct object *old_head = vg_cap_to_object (parent, &child->sibling_next_cap);
if (old_head)
{
- assert (object_type (old_head) == cap_activity_control);
+ assert (object_type (old_head) == vg_cap_activity_control);
/* The old head's previous pointer should be NULL. */
- assert (! cap_to_object
+ assert (! vg_cap_to_object
(parent, &((struct activity *) old_head)->sibling_prev_cap));
((struct activity *) old_head)->sibling_prev_cap
@@ -78,8 +78,8 @@ activity_destroy (struct activity *activity, struct activity *victim)
debug (0, "Destroying activity " OBJECT_NAME_FMT,
OBJECT_NAME_PRINTF ((struct object *) victim));
- assert (object_type ((struct object *) activity) == cap_activity_control);
- assert (object_type ((struct object *) victim) == cap_activity_control);
+ assert (object_type ((struct object *) activity) == vg_cap_activity_control);
+ assert (object_type ((struct object *) victim) == vg_cap_activity_control);
profile_stats_dump ();
@@ -109,28 +109,28 @@ activity_destroy (struct activity *activity, struct activity *victim)
/* Destroy all folios allocated to this activity. */
struct object *o;
- while ((o = cap_to_object (activity, &victim->folios)))
+ while ((o = vg_cap_to_object (activity, &victim->folios)))
{
/* If O was destroyed, it should have been removed from its
respective activity's allocation list. */
assert (o);
struct object_desc *desc = object_to_object_desc (o);
- assert (desc->type == cap_folio);
+ assert (desc->type == vg_cap_folio);
folio_free (activity, (struct folio *) o);
}
/* Activities that are sub-activities of ACTIVITY are not
necessarily allocated out of storage allocated to ACTIVITY. */
- while ((o = cap_to_object (activity, &victim->children_cap)))
+ while ((o = vg_cap_to_object (activity, &victim->children_cap)))
{
/* If O was destroyed, it should have been removed from its
respective activity's allocation list. */
assert (o);
struct object_desc *desc = object_to_object_desc (o);
- assert (desc->type == cap_activity_control);
+ assert (desc->type == vg_cap_activity_control);
object_free (activity, o);
}
@@ -142,7 +142,7 @@ activity_destroy (struct activity *activity, struct activity *victim)
/* Make ACTIVE objects inactive. */
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
for (desc = activity_list_head (&victim->frames[i].active);
desc; desc = activity_list_next (desc))
@@ -154,19 +154,19 @@ activity_destroy (struct activity *activity, struct activity *victim)
assert (desc->policy.priority == i);
desc->age = 0;
- desc->policy.priority = OBJECT_PRIORITY_MIN;
+ desc->policy.priority = VG_OBJECT_PRIORITY_MIN;
desc->activity = victim->parent;
count ++;
}
activity_list_join
- (&victim->parent->frames[OBJECT_PRIORITY_MIN].inactive,
+ (&victim->parent->frames[VG_OBJECT_PRIORITY_MIN].inactive,
&victim->frames[i].active);
}
/* Move inactive objects to the head of VICTIM->PARENT's appropriate
inactive list (thereby making them the first eviction
candidates). */
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
for (desc = activity_list_head (&victim->frames[i].inactive);
desc; desc = activity_list_next (desc))
@@ -178,11 +178,11 @@ activity_destroy (struct activity *activity, struct activity *victim)
assert (desc->policy.priority == i);
desc->activity = victim->parent;
- desc->policy.priority = OBJECT_PRIORITY_MIN;
+ desc->policy.priority = VG_OBJECT_PRIORITY_MIN;
count ++;
}
activity_list_join
- (&victim->parent->frames[OBJECT_PRIORITY_MIN].inactive,
+ (&victim->parent->frames[VG_OBJECT_PRIORITY_MIN].inactive,
&victim->frames[i].inactive);
}
@@ -212,8 +212,8 @@ activity_destroy (struct activity *activity, struct activity *victim)
vdesc = object_to_object_desc ((struct object *) victim);
assertx (desc->activity == victim,
- OID_FMT " != " OID_FMT,
- OID_PRINTF (adesc->oid), OID_PRINTF (vdesc->oid));
+ VG_OID_FMT " != " VG_OID_FMT,
+ VG_OID_PRINTF (adesc->oid), VG_OID_PRINTF (vdesc->oid));
#endif
assert (list_node_attached (&desc->laundry_node));
assert (desc->dirty && !desc->policy.discardable);
@@ -243,18 +243,18 @@ activity_destroy (struct activity *activity, struct activity *victim)
/* Remove from parent's activity list. */
struct activity *parent = victim->parent;
assert ((struct object *) parent
- == cap_to_object (activity, &victim->parent_cap));
+ == vg_cap_to_object (activity, &victim->parent_cap));
- struct object *prev_object = cap_to_object (activity,
+ struct object *prev_object = vg_cap_to_object (activity,
&victim->sibling_prev_cap);
assert (! prev_object
- || object_to_object_desc (prev_object)->type == cap_activity_control);
+ || object_to_object_desc (prev_object)->type == vg_cap_activity_control);
struct activity *prev = (struct activity *) prev_object;
- struct object *next_object = cap_to_object (activity,
+ struct object *next_object = vg_cap_to_object (activity,
&victim->sibling_next_cap);
assert (! next_object
- || object_to_object_desc (next_object)->type == cap_activity_control);
+ || object_to_object_desc (next_object)->type == vg_cap_activity_control);
struct activity *next = (struct activity *) next_object;
if (prev)
@@ -262,7 +262,7 @@ activity_destroy (struct activity *activity, struct activity *victim)
else
/* VICTIM is the head of PARENT's child list. */
{
- assert (cap_to_object (activity, &parent->children_cap)
+ assert (vg_cap_to_object (activity, &parent->children_cap)
== (struct object *) victim);
parent->children_cap = victim->sibling_next_cap;
}
@@ -270,15 +270,15 @@ activity_destroy (struct activity *activity, struct activity *victim)
if (next)
next->sibling_prev_cap = victim->sibling_prev_cap;
- victim->sibling_next_cap.type = cap_void;
- victim->sibling_prev_cap.type = cap_void;
+ victim->sibling_next_cap.type = vg_cap_void;
+ victim->sibling_prev_cap.type = vg_cap_void;
}
void
activity_prepare (struct activity *principal, struct activity *activity)
{
/* Lookup parent. */
- activity->parent = (struct activity *) cap_to_object (principal,
+ activity->parent = (struct activity *) vg_cap_to_object (principal,
&activity->parent_cap);
assert (activity->parent);
@@ -309,7 +309,7 @@ activity_prepare (struct activity *principal, struct activity *activity)
#ifndef NDEBUG
activity_children_list_init (&activity->children, "activity->children");
- static const char *names[OBJECT_PRIORITY_LEVELS]
+ static const char *names[VG_OBJECT_PRIORITY_LEVELS]
= { "inactive-64", "inactive-63", "inactive-62", "inactive-61",
"inactive-60", "inactive-59", "inactive-58", "inactive-57",
"inactive-56", "inactive-55", "inactive-54", "inactive-53",
@@ -344,12 +344,12 @@ activity_prepare (struct activity *principal, struct activity *activity)
"inactive60", "inactive61", "inactive62", "inactive63" };
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
activity_list_init (&activity->frames[i].active,
- &names[i - OBJECT_PRIORITY_MIN][2]);
+ &names[i - VG_OBJECT_PRIORITY_MIN][2]);
activity_list_init (&activity->frames[i].inactive,
- names[i - OBJECT_PRIORITY_MIN]);
+ names[i - VG_OBJECT_PRIORITY_MIN]);
}
eviction_list_init (&activity->eviction_clean, "evict clean");
eviction_list_init (&activity->eviction_dirty, "evict dirty");
@@ -363,7 +363,7 @@ activity_deprepare (struct activity *principal, struct activity *victim)
paged out. */
assert (! activity_children_list_head (&victim->children));
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
assert (! activity_list_count (&victim->frames[i].active));
assert (! activity_list_count (&victim->frames[i].inactive));
@@ -441,7 +441,7 @@ do_activity_dump (struct activity *activity, int indent)
int inactive = 0;
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&activity->frames[i].active);
inactive += activity_list_count (&activity->frames[i].inactive);
diff --git a/viengoos/activity.h b/viengoos/activity.h
index 745486f..0bbb62d 100644
--- a/viengoos/activity.h
+++ b/viengoos/activity.h
@@ -38,18 +38,18 @@ struct activity
/* On-disk data. */
/* Parent activity. */
- struct cap parent_cap;
+ struct vg_cap parent_cap;
/* List of child activities (if any). Threaded via
SIBLING_NEXT. */
- struct cap children_cap;
+ struct vg_cap children_cap;
/* This activity's siblings. */
- struct cap sibling_next_cap;
- struct cap sibling_prev_cap;
+ struct vg_cap sibling_next_cap;
+ struct vg_cap sibling_prev_cap;
/* Head of the linked list of folios allocated to this activity. */
- struct cap folios;
+ struct vg_cap folios;
/* Policy. */
struct activity_policy policy;
@@ -77,12 +77,12 @@ struct activity
{
struct activity_list active;
struct activity_list inactive;
- } frames_[-OBJECT_PRIORITY_MIN];
+ } frames_[-VG_OBJECT_PRIORITY_MIN];
struct
{
struct activity_list active;
struct activity_list inactive;
- } frames[OBJECT_PRIORITY_MAX + 1];
+ } frames[VG_OBJECT_PRIORITY_MAX + 1];
/* Objects that are owned by this activity and have been selected
for eviction (DESC->EVICTION_CANDIDATE is true). These objects
@@ -248,22 +248,22 @@ activity_charge (struct activity *activity, int objects)
/* For each child of ACTIVITY, set to CHILD and execute code. The
caller may destroy CHILD, however, it may not destroy any siblings.
- Be careful of deadlock: this function calls cap_to_object, which
+ Be careful of deadlock: this function calls vg_cap_to_object, which
calls object_find, which may take LRU_LOCK. */
#define activity_for_each_child(__fec_activity, __fec_child, __fec_code) \
do { \
__fec_child \
- = (struct activity *) cap_to_object ((__fec_activity), \
+ = (struct activity *) vg_cap_to_object ((__fec_activity), \
&(__fec_activity)->children_cap); \
while (__fec_child) \
{ \
/* Grab the next child incase this child is destroyed. */ \
- struct cap __fec_next = __fec_child->sibling_next_cap; \
+ struct vg_cap __fec_next = __fec_child->sibling_next_cap; \
\
__fec_code; \
\
/* Fetch the next child. */ \
- __fec_child = (struct activity *) cap_to_object ((__fec_activity), \
+ __fec_child = (struct activity *) vg_cap_to_object ((__fec_activity), \
&__fec_next); \
if (! __fec_child) \
break; \
diff --git a/viengoos/ager.c b/viengoos/ager.c
index 1e08fec..d44eafc 100644
--- a/viengoos/ager.c
+++ b/viengoos/ager.c
@@ -482,8 +482,8 @@ ager_loop (void)
continue;
assertx (desc->activity,
- "OID: " OID_FMT " (%s), age: %d",
- OID_PRINTF (desc->oid), cap_type_string (desc->type),
+ "OID: " VG_OID_FMT " (%s), age: %d",
+ VG_OID_PRINTF (desc->oid), vg_cap_type_string (desc->type),
desc->age);
descs[count] = desc;
@@ -495,7 +495,7 @@ ager_loop (void)
/* We periodically unmap shared frames and mark them as
floating. See above for details. */
{
- if (desc->type == cap_page)
+ if (desc->type == vg_cap_page)
/* We only unmap the object if it is a page. No
other objects are actually mapped to users. */
{
@@ -551,7 +551,7 @@ ager_loop (void)
int j = 0;
l4_fpage_t unmap[count];
for (i = 0; i < count; i ++)
- if (descs[i]->shared && descs[i]->type == cap_page)
+ if (descs[i]->shared && descs[i]->type == vg_cap_page)
unmap[j ++]
= l4_fpage_add_rights (fpages[i],
L4_FPAGE_FULLY_ACCESSIBLE);
@@ -562,7 +562,7 @@ ager_loop (void)
/* Bitwise or the status bits. */
j = 0;
for (i = 0; i < count; i ++)
- if (descs[i]->shared && descs[i]->type == cap_page)
+ if (descs[i]->shared && descs[i]->type == vg_cap_page)
fpages[i] = l4_fpage_add_rights (fpages[i],
l4_rights (unmap[j ++]));
}
diff --git a/viengoos/cap.c b/viengoos/cap.c
index b765ae3..fcd92d8 100644
--- a/viengoos/cap.c
+++ b/viengoos/cap.c
@@ -27,21 +27,21 @@
#include "activity.h"
#include "thread.h"
-const int cap_type_num_slots[] = { [cap_void] = 0,
- [cap_page] = 0,
- [cap_rpage] = 0,
- [cap_cappage] = CAPPAGE_SLOTS,
- [cap_rcappage] = CAPPAGE_SLOTS,
- [cap_folio] = 0,
- [cap_activity] = 0,
- [cap_activity_control] = 0,
- [cap_thread] = THREAD_SLOTS };
+const int cap_type_num_slots[] = { [vg_cap_void] = 0,
+ [vg_cap_page] = 0,
+ [vg_cap_rpage] = 0,
+ [vg_cap_cappage] = VG_CAPPAGE_SLOTS,
+ [vg_cap_rcappage] = VG_CAPPAGE_SLOTS,
+ [vg_cap_folio] = 0,
+ [vg_cap_activity] = 0,
+ [vg_cap_activity_control] = 0,
+ [vg_cap_thread] = VG_THREAD_SLOTS };
static struct object *
-cap_to_object_internal (struct activity *activity, struct cap *cap,
+cap_to_object_internal (struct activity *activity, struct vg_cap *cap,
bool hard)
{
- if (cap->type == cap_void)
+ if (cap->type == vg_cap_void)
return NULL;
/* XXX: If CAP does not grant write access, then we need to flatten
@@ -49,10 +49,10 @@ cap_to_object_internal (struct activity *activity, struct cap *cap,
struct object *object;
if (hard)
{
- object = object_find (activity, cap->oid, CAP_POLICY_GET (*cap));
+ object = object_find (activity, cap->oid, VG_CAP_POLICY_GET (*cap));
}
else
- object = object_find_soft (activity, cap->oid, CAP_POLICY_GET (*cap));
+ object = object_find_soft (activity, cap->oid, VG_CAP_POLICY_GET (*cap));
if (! object)
return NULL;
@@ -62,54 +62,54 @@ cap_to_object_internal (struct activity *activity, struct cap *cap,
{
/* Clear the capability to save the effort of looking up the
object in the future. */
- cap->type = cap_void;
+ cap->type = vg_cap_void;
return NULL;
}
/* If the capability is valid, then the cap type and the object type
must be compatible. */
- assert (cap_types_compatible (cap->type, desc->type));
+ assert (vg_cap_types_compatible (cap->type, desc->type));
return object;
}
struct object *
-cap_to_object (struct activity *activity, struct cap *cap)
+vg_cap_to_object (struct activity *activity, struct vg_cap *cap)
{
return cap_to_object_internal (activity, cap, true);
}
struct object *
-cap_to_object_soft (struct activity *activity, struct cap *cap)
+cap_to_object_soft (struct activity *activity, struct vg_cap *cap)
{
return cap_to_object_internal (activity, cap, false);
}
void
-cap_shootdown (struct activity *activity, struct cap *root)
+cap_shootdown (struct activity *activity, struct vg_cap *root)
{
assert (activity);
/* XXX: A recursive function may not be the best idea here. We are
guaranteed, however, at most 63 nested calls. */
- void doit (struct cap *cap, int remaining)
+ void doit (struct vg_cap *cap, int remaining)
{
int i;
struct object *object;
- remaining -= CAP_GUARD_BITS (cap);
+ remaining -= VG_CAP_GUARD_BITS (cap);
switch (cap->type)
{
- case cap_page:
- case cap_rpage:
+ case vg_cap_page:
+ case vg_cap_rpage:
if (remaining < PAGESIZE_LOG2)
return;
/* If the object is not in memory, then it can't be
mapped. */
object = object_find_soft (activity, cap->oid,
- OBJECT_POLICY (cap->discardable,
+ VG_OBJECT_POLICY (cap->discardable,
cap->priority));
if (! object)
return;
@@ -119,36 +119,36 @@ cap_shootdown (struct activity *activity, struct cap *root)
{
/* Clear the capability to save the effort of looking up the
object in the future. */
- cap->type = cap_void;
+ cap->type = vg_cap_void;
return;
}
object_desc_unmap (desc);
return;
- case cap_cappage:
- case cap_rcappage:
- if (remaining < CAP_SUBPAGE_SIZE_LOG2 (cap) + PAGESIZE_LOG2)
+ case vg_cap_cappage:
+ case vg_cap_rcappage:
+ if (remaining < VG_CAP_SUBPAGE_SIZE_LOG2 (cap) + PAGESIZE_LOG2)
return;
- object = cap_to_object (activity, cap);
+ object = vg_cap_to_object (activity, cap);
if (! object)
return;
- remaining -= CAP_SUBPAGE_SIZE_LOG2 (cap);
+ remaining -= VG_CAP_SUBPAGE_SIZE_LOG2 (cap);
- for (i = 0; i < CAP_SUBPAGE_SIZE (cap); i ++)
+ for (i = 0; i < VG_CAP_SUBPAGE_SIZE (cap); i ++)
if (root->oid != object->caps[i].oid)
doit (&object->caps[i], remaining);
return;
- case cap_messenger:
- case cap_rmessenger:
+ case vg_cap_messenger:
+ case vg_cap_rmessenger:
if (remaining < VG_MESSENGER_SLOTS_LOG2 + PAGESIZE_LOG2)
return;
- object = cap_to_object (activity, cap);
+ object = vg_cap_to_object (activity, cap);
if (! object)
return;
@@ -160,50 +160,50 @@ cap_shootdown (struct activity *activity, struct cap *root)
return;
- case cap_thread:
- if (remaining < THREAD_SLOTS_LOG2 + PAGESIZE_LOG2)
+ case vg_cap_thread:
+ if (remaining < VG_THREAD_SLOTS_LOG2 + PAGESIZE_LOG2)
return;
- object = cap_to_object (activity, cap);
+ object = vg_cap_to_object (activity, cap);
if (! object)
return;
- remaining -= THREAD_SLOTS_LOG2;
+ remaining -= VG_THREAD_SLOTS_LOG2;
- for (i = 0; i < THREAD_SLOTS_LOG2; i ++)
+ for (i = 0; i < VG_THREAD_SLOTS_LOG2; i ++)
if (root->oid != object->caps[i].oid)
doit (&object->caps[i],
remaining
- + (i == THREAD_ASPACE_SLOT ? THREAD_SLOTS_LOG2 : 0));
+ + (i == VG_THREAD_ASPACE_SLOT ? VG_THREAD_SLOTS_LOG2 : 0));
return;
- case cap_folio:
- if (remaining < FOLIO_OBJECTS_LOG2 + PAGESIZE_LOG2)
+ case vg_cap_folio:
+ if (remaining < VG_FOLIO_OBJECTS_LOG2 + PAGESIZE_LOG2)
return;
- object = cap_to_object (activity, cap);
+ object = vg_cap_to_object (activity, cap);
if (! object)
return;
struct folio *folio = (struct folio *) object;
struct object_desc *fdesc = object_to_object_desc (object);
- oid_t foid = fdesc->oid;
+ vg_oid_t foid = fdesc->oid;
- remaining -= FOLIO_OBJECTS_LOG2;
+ remaining -= VG_FOLIO_OBJECTS_LOG2;
- for (i = 0; i < FOLIO_OBJECTS; i ++)
- if (folio_object_type (folio, i) == cap_page
- || folio_object_type (folio, i) == cap_rpage
- || folio_object_type (folio, i) == cap_cappage
- || folio_object_type (folio, i) == cap_rcappage)
+ for (i = 0; i < VG_FOLIO_OBJECTS; i ++)
+ if (vg_folio_object_type (folio, i) == vg_cap_page
+ || vg_folio_object_type (folio, i) == vg_cap_rpage
+ || vg_folio_object_type (folio, i) == vg_cap_cappage
+ || vg_folio_object_type (folio, i) == vg_cap_rcappage)
{
- struct cap cap;
+ struct vg_cap cap;
cap.version = folio_object_version (folio, i);
- cap.type = folio_object_type (folio, i);
- cap.addr_trans = CAP_ADDR_TRANS_VOID;
+ cap.type = vg_folio_object_type (folio, i);
+ cap.addr_trans = VG_CAP_ADDR_TRANS_VOID;
cap.oid = foid + 1 + i;
if (root->oid != cap.oid)
@@ -217,5 +217,5 @@ cap_shootdown (struct activity *activity, struct cap *root)
}
}
- doit (root, ADDR_BITS);
+ doit (root, VG_ADDR_BITS);
}
diff --git a/viengoos/cap.h b/viengoos/cap.h
index 609e4a1..d8da9a3 100644
--- a/viengoos/cap.h
+++ b/viengoos/cap.h
@@ -30,23 +30,25 @@ extern const int cap_type_num_slots[];
/* Set's the capability TARGET to point to the same object as the
capability SOURCE, however, preserves the guard in TARGET. */
static inline bool
-cap_set (struct activity *activity, struct cap *target, struct cap source)
+cap_set (struct activity *activity, struct vg_cap *target, struct vg_cap source)
{
/* This is kosher as we know the implementation of CAP_COPY. */
- return cap_copy (activity,
- ADDR_VOID, target, ADDR_VOID,
- ADDR_VOID, source, ADDR_VOID);
+ return vg_cap_copy (activity,
+ VG_ADDR_VOID, target, VG_ADDR_VOID,
+ VG_ADDR_VOID, source, VG_ADDR_VOID);
}
/* Invalidate all mappings that may depend on this object. */
-extern void cap_shootdown (struct activity *activity, struct cap *cap);
+extern void cap_shootdown (struct activity *activity, struct vg_cap *cap);
/* Return the object designated by CAP, if any. */
-struct object *cap_to_object (struct activity *activity, struct cap *cap);
+struct object *vg_cap_to_object (struct activity *activity,
+ struct vg_cap *cap);
-/* Like cap_to_object but only returns the object if it is in
+/* Like vg_cap_to_object but only returns the object if it is in
memory. */
-struct object *cap_to_object_soft (struct activity *activity, struct cap *cap);
+struct object *cap_to_object_soft (struct activity *activity,
+ struct vg_cap *cap);
diff --git a/viengoos/memory.c b/viengoos/memory.c
index 3f46ff4..54997ff 100644
--- a/viengoos/memory.c
+++ b/viengoos/memory.c
@@ -367,8 +367,8 @@ memory_frame_allocate (struct activity *activity)
struct object_desc *desc = available_list_head (&available);
while (desc)
{
- if (desc->type != cap_activity_control
- && desc->type != cap_thread)
+ if (desc->type != vg_cap_activity_control
+ && desc->type != vg_cap_thread)
/* We will detach DESC from AVAILALBE in
memory_object_destroy. */
break;
@@ -382,12 +382,12 @@ memory_frame_allocate (struct activity *activity)
assert (desc->eviction_candidate);
assert (desc->activity);
assert (object_type ((struct object *) desc->activity)
- == cap_activity_control);
+ == vg_cap_activity_control);
assert (! desc->dirty || desc->policy.discardable);
assert (! desc->mapped);
- debug (5, "Reusing OID " OID_FMT " (%s)",
- OID_PRINTF (desc->oid), cap_type_string (desc->type));
+ debug (5, "Reusing OID " VG_OID_FMT " (%s)",
+ VG_OID_PRINTF (desc->oid), vg_cap_type_string (desc->type));
struct object *object = object_desc_to_object (desc);
@@ -401,11 +401,11 @@ memory_frame_allocate (struct activity *activity)
ACTIVITY_STATS (desc->activity)->discarded ++;
}
- oid_t oid = desc->oid;
+ vg_oid_t oid = desc->oid;
memory_object_destroy (activity, object);
/* DESC is no longer valid. */
- assert (! object_find_soft (activity, oid, OBJECT_POLICY_DEFAULT));
+ assert (! object_find_soft (activity, oid, VG_OBJECT_POLICY_DEFAULT));
if (discarded)
/* Note that we discarded the page. */
diff --git a/viengoos/messenger.c b/viengoos/messenger.c
index 4e109a2..03bfb7e 100644
--- a/viengoos/messenger.c
+++ b/viengoos/messenger.c
@@ -44,9 +44,9 @@ messenger_load_internal (struct activity *activity,
struct vg_message *smessage,
bool may_block)
{
- assert (object_type ((struct object *) target) == cap_messenger);
+ assert (object_type ((struct object *) target) == vg_cap_messenger);
if (source)
- assert (object_type ((struct object *) source) == cap_messenger);
+ assert (object_type ((struct object *) source) == vg_cap_messenger);
if (source)
assert (! smessage);
@@ -97,16 +97,16 @@ messenger_load_internal (struct activity *activity,
void *tdata;
int data_count;
- addr_t *saddrs;
+ vg_addr_t *saddrs;
int saddr_count;
- addr_t *taddrs;
+ vg_addr_t *taddrs;
int taddr_count;
if (! source || source->out_of_band)
/* Source data is in a buffer. */
{
if (source)
- smessage = (struct vg_message *) cap_to_object (activity,
+ smessage = (struct vg_message *) vg_cap_to_object (activity,
&source->buffer);
else
assert (smessage);
@@ -143,7 +143,7 @@ messenger_load_internal (struct activity *activity,
if (target->out_of_band)
/* Target data is in a buffer. */
{
- tmessage = (struct vg_message *) cap_to_object (activity,
+ tmessage = (struct vg_message *) vg_cap_to_object (activity,
&target->buffer);
if (tmessage)
{
@@ -199,8 +199,8 @@ messenger_load_internal (struct activity *activity,
/* First get the target capability slot. */
bool twritable = true;
- struct cap *tcap = NULL;
- if (! ADDR_IS_VOID (taddrs[i]))
+ struct vg_cap *tcap = NULL;
+ if (! VG_ADDR_IS_VOID (taddrs[i]))
{
as_slot_lookup_rel_use (activity, &target->as_root, taddrs[i],
({
@@ -208,20 +208,20 @@ messenger_load_internal (struct activity *activity,
tcap = slot;
}));
if (! tcap || ! twritable)
- debug (0, DEBUG_BOLD ("Target " ADDR_FMT " does not designate "
+ debug (0, DEBUG_BOLD ("Target " VG_ADDR_FMT " does not designate "
"a %svalid slot!"),
- ADDR_PRINTF (taddrs[i]), twritable ? "writable " : "");
+ VG_ADDR_PRINTF (taddrs[i]), twritable ? "writable " : "");
}
if (likely (tcap && twritable))
/* We have a slot and it is writable. Look up the source
capability. */
{
- struct cap scap = CAP_VOID;
+ struct vg_cap scap = VG_CAP_VOID;
bool swritable = true;
if (source)
{
- if (! ADDR_IS_VOID (saddrs[i]))
+ if (! VG_ADDR_IS_VOID (saddrs[i]))
scap = as_cap_lookup_rel (activity,
&source->as_root, saddrs[i],
-1, &swritable);
@@ -230,28 +230,28 @@ messenger_load_internal (struct activity *activity,
/* This is a kernel provided buffer. In this case the
address is really a pointer to a capability. */
if ((uintptr_t) saddrs[i].raw)
- scap = * (struct cap *) (uintptr_t) saddrs[i].raw;
+ scap = * (struct vg_cap *) (uintptr_t) saddrs[i].raw;
if (! swritable)
- scap.type = cap_type_weaken (scap.type);
+ scap.type = vg_cap_type_weaken (scap.type);
/* Shoot down the capability. */
cap_shootdown (activity, tcap);
/* Preserve the address translator and policy. */
- struct cap_properties props = CAP_PROPERTIES_GET (*tcap);
+ struct vg_cap_properties props = VG_CAP_PROPERTIES_GET (*tcap);
*tcap = scap;
- CAP_PROPERTIES_SET (tcap, props);
+ VG_CAP_PROPERTIES_SET (tcap, props);
- debug (5, ADDR_FMT " <- " CAP_FMT,
- ADDR_PRINTF (taddrs[i]), CAP_PRINTF (tcap));
+ debug (5, VG_ADDR_FMT " <- " VG_CAP_FMT,
+ VG_ADDR_PRINTF (taddrs[i]), VG_CAP_PRINTF (tcap));
}
else
- taddrs[i] = ADDR_VOID;
+ taddrs[i] = VG_ADDR_VOID;
}
if (i < MAX (taddr_count, saddr_count) && target->out_of_band && taddrs)
/* Set the address of any non-transferred caps in the target to
- ADDR_VOID. */
+ VG_ADDR_VOID. */
memset (&taddrs[i], 0,
sizeof (taddrs[0]) * (MAX (taddr_count, saddr_count)) - i);
@@ -301,17 +301,17 @@ messenger_message_deliver (struct activity *activity,
assert (! messenger->wait_queue_p);
struct thread *thread
- = (struct thread *) cap_to_object (activity, &messenger->thread);
+ = (struct thread *) vg_cap_to_object (activity, &messenger->thread);
if (! thread)
{
debug (0, "Messenger has no thread to activate!");
return false;
}
- if (object_type ((struct object *) thread) != cap_thread)
+ if (object_type ((struct object *) thread) != vg_cap_thread)
{
- debug (0, "Messenger's thread cap does not designate a thread but a %s",
- cap_type_string (object_type ((struct object *) thread)));
+ debug (0, "Messenger's thread vg_cap does not designate a thread but a %s",
+ vg_cap_type_string (object_type ((struct object *) thread)));
return false;
}
diff --git a/viengoos/messenger.h b/viengoos/messenger.h
index 2ab669c..2ad0417 100644
--- a/viengoos/messenger.h
+++ b/viengoos/messenger.h
@@ -62,17 +62,17 @@ struct messenger
/* When this messenger is activated (that is, its contents are
delivered or it receives a message), THREAD is activated. This
is settable from user space. */
- struct cap thread;
+ struct vg_cap thread;
/* The root of the address space in which capability addresses
referenced in the message are resolved. */
- struct cap as_root;
+ struct vg_cap as_root;
/* The message buffer. */
- struct cap buffer;
+ struct vg_cap buffer;
/* The activity supplied by the sender of the message. */
- struct cap sender_activity;
+ struct vg_cap sender_activity;
/* Whether the data is inline or out of line. */
@@ -84,7 +84,7 @@ struct messenger
/* Inline data. */
uintptr_t inline_words[VG_MESSENGER_INLINE_WORDS];
- addr_t inline_caps[VG_MESSENGER_INLINE_CAPS];
+ vg_addr_t inline_caps[VG_MESSENGER_INLINE_CAPS];
/* The buffer's version. If USER_VERSION_MATCHING is true, a
@@ -142,8 +142,8 @@ struct messenger
{
/* We don't need versioning as we automatically collect on object
destruction. */
- oid_t next;
- oid_t prev;
+ vg_oid_t next;
+ vg_oid_t prev;
} wait_queue;
/* Whether the object is attached to a wait queue. (This is
diff --git a/viengoos/object.c b/viengoos/object.c
index 5d11edd..70f1812 100644
--- a/viengoos/object.c
+++ b/viengoos/object.c
@@ -66,8 +66,8 @@ object_init (void)
build_assert (sizeof (struct activity) <= PAGESIZE);
build_assert (sizeof (struct object) <= PAGESIZE);
build_assert (sizeof (struct thread) <= PAGESIZE);
- /* Assert that the size of a cap is a power of 2. */
- build_assert ((sizeof (struct cap) & (sizeof (struct cap) - 1)) == 0);
+ /* Assert that the size of a vg_cap is a power of 2. */
+ build_assert ((sizeof (struct vg_cap) & (sizeof (struct vg_cap) - 1)) == 0);
/* Allocate object hash. */
@@ -105,15 +105,15 @@ object_init (void)
correspond to the values storage on disk. */
static struct object *
memory_object_alloc (struct activity *activity,
- enum cap_type type,
- oid_t oid, l4_word_t version,
+ enum vg_cap_type type,
+ vg_oid_t oid, l4_word_t version,
struct object_policy policy)
{
- debug (5, "Allocating %llx(%d), %s", oid, version, cap_type_string (type));
+ debug (5, "Allocating %llx(%d), %s", oid, version, vg_cap_type_string (type));
assert (activity || ! root_activity);
- assert (type != cap_void);
- assert ((type == cap_folio) == ((oid % (FOLIO_OBJECTS + 1)) == 0));
+ assert (type != vg_cap_void);
+ assert ((type == vg_cap_folio) == ((oid % (VG_FOLIO_OBJECTS + 1)) == 0));
struct object *object = (struct object *) memory_frame_allocate (activity);
if (! object)
@@ -168,25 +168,25 @@ memory_object_destroy (struct activity *activity, struct object *object)
assert (desc->live);
- assertx (folio_object_type (objects_folio (activity, object),
- objects_folio_offset (object)) == desc->type,
- "(" OID_FMT ") %s != %s",
- OID_PRINTF (desc->oid),
- cap_type_string
- (folio_object_type (objects_folio (activity, object),
- objects_folio_offset (object))),
- cap_type_string (desc->type));
+ assertx (vg_folio_object_type (objects_folio (activity, object),
+ objects_folio_offset (object)) == desc->type,
+ "(" VG_OID_FMT ") %s != %s",
+ VG_OID_PRINTF (desc->oid),
+ vg_cap_type_string
+ (vg_folio_object_type (objects_folio (activity, object),
+ objects_folio_offset (object))),
+ vg_cap_type_string (desc->type));
debug (5, "Destroy %s at 0x%llx (object %d)",
- cap_type_string (desc->type), desc->oid,
+ vg_cap_type_string (desc->type), desc->oid,
((uintptr_t) desc - (uintptr_t) object_descs) / sizeof (*desc));
- struct cap cap = object_desc_to_cap (desc);
- cap_shootdown (activity, &cap);
+ struct vg_cap vg_cap = object_desc_to_cap (desc);
+ cap_shootdown (activity, &vg_cap);
object_desc_claim (NULL, desc, desc->policy, true);
- if (desc->type == cap_activity_control)
+ if (desc->type == vg_cap_activity_control)
{
struct activity *a = (struct activity *) object;
if (a->frames_total)
@@ -207,7 +207,7 @@ memory_object_destroy (struct activity *activity, struct object *object)
}
struct object *
-object_find_soft (struct activity *activity, oid_t oid,
+object_find_soft (struct activity *activity, vg_oid_t oid,
struct object_policy policy)
{
struct object_desc *odesc = hurd_ihash_find (&objects, oid);
@@ -217,21 +217,21 @@ object_find_soft (struct activity *activity, oid_t oid,
struct object *object = object_desc_to_object (odesc);
assert (oid == odesc->oid);
- if (oid % (FOLIO_OBJECTS + 1) != 0)
+ if (oid % (VG_FOLIO_OBJECTS + 1) != 0)
{
#ifndef NDEBUG
struct folio *folio = objects_folio (activity, object);
int i = objects_folio_offset (object);
- assertx (folio_object_type (folio, i) == odesc->type,
- "(" OID_FMT ") %s != %s",
- OID_PRINTF (oid),
- cap_type_string (folio_object_type (folio, i)),
- cap_type_string (odesc->type));
+ assertx (vg_folio_object_type (folio, i) == odesc->type,
+ "(" VG_OID_FMT ") %s != %s",
+ VG_OID_PRINTF (oid),
+ vg_cap_type_string (vg_folio_object_type (folio, i)),
+ vg_cap_type_string (odesc->type));
assertx (! folio_object_discarded (folio, i),
- OID_FMT ": %s",
- OID_PRINTF (oid),
- cap_type_string (odesc->type));
+ VG_OID_FMT ": %s",
+ VG_OID_PRINTF (oid),
+ vg_cap_type_string (odesc->type));
#endif
}
@@ -259,7 +259,7 @@ object_find_soft (struct activity *activity, oid_t oid,
}
struct object *
-object_find (struct activity *activity, oid_t oid,
+object_find (struct activity *activity, vg_oid_t oid,
struct object_policy policy)
{
struct object *obj = object_find_soft (activity, oid, policy);
@@ -268,16 +268,16 @@ object_find (struct activity *activity, oid_t oid,
struct folio *folio;
- int page = (oid % (FOLIO_OBJECTS + 1)) - 1;
+ int page = (oid % (VG_FOLIO_OBJECTS + 1)) - 1;
if (page == -1)
/* The object to find is a folio. */
{
- if (oid / (FOLIO_OBJECTS + 1) < FOLIOS_CORE)
+ if (oid / (VG_FOLIO_OBJECTS + 1) < FOLIOS_CORE)
/* It's an in-core folio. */
{
- assert (bit_test (folios, oid / (FOLIO_OBJECTS + 1)));
+ assert (bit_test (folios, oid / (VG_FOLIO_OBJECTS + 1)));
- return memory_object_alloc (activity, cap_folio, oid, 0,
+ return memory_object_alloc (activity, vg_cap_folio, oid, 0,
policy);
}
@@ -287,12 +287,12 @@ object_find (struct activity *activity, oid_t oid,
{
/* Find the folio corresponding to the object. */
folio = (struct folio *) object_find (activity, oid - page - 1,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assertx (folio,
- "Didn't find folio " OID_FMT,
- OID_PRINTF (oid - page - 1));
+ "Didn't find folio " VG_OID_FMT,
+ VG_OID_PRINTF (oid - page - 1));
- if (folio_object_type (folio, page) == cap_void)
+ if (vg_folio_object_type (folio, page) == vg_cap_void)
return NULL;
if (folio_object_discarded (folio, page))
@@ -303,7 +303,7 @@ object_find (struct activity *activity, oid_t oid,
if (! folio_object_content (folio, page))
/* The object is a zero page. No need to read anything from
backing store: just allocate a page and zero it. */
- return memory_object_alloc (activity, folio_object_type (folio, page),
+ return memory_object_alloc (activity, vg_folio_object_type (folio, page),
oid, folio_object_version (folio, page),
policy);
}
@@ -321,12 +321,12 @@ folio_parent (struct activity *activity, struct folio *folio)
assert (({
struct object_desc *desc;
desc = object_to_object_desc ((struct object *) folio);
- assert (desc->oid % (FOLIO_OBJECTS + 1) == 0);
+ assert (desc->oid % (VG_FOLIO_OBJECTS + 1) == 0);
true;
}));
- assert (! cap_to_object (activity, &folio->activity));
- assert (! cap_to_object (activity, &folio->next));
- assert (! cap_to_object (activity, &folio->prev));
+ assert (! vg_cap_to_object (activity, &folio->activity));
+ assert (! vg_cap_to_object (activity, &folio->next));
+ assert (! vg_cap_to_object (activity, &folio->prev));
assert (({
struct object_desc *desc;
desc = object_to_object_desc ((struct object *) folio);
@@ -335,9 +335,9 @@ folio_parent (struct activity *activity, struct folio *folio)
of it before it is parented. */
{
int i;
- for (i = 0; i < FOLIO_OBJECTS; i ++)
+ for (i = 0; i < VG_FOLIO_OBJECTS; i ++)
assert (! object_find_soft (activity, desc->oid + 1 + i,
- OBJECT_POLICY_DEFAULT));
+ VG_OBJECT_POLICY_DEFAULT));
}
true;
}));
@@ -348,11 +348,11 @@ folio_parent (struct activity *activity, struct folio *folio)
/* Add FOLIO to ACTIVITY's folio list. */
/* Update the old head's previous pointer. */
- struct object *head = cap_to_object (activity, &activity->folios);
+ struct object *head = vg_cap_to_object (activity, &activity->folios);
if (head)
{
/* It shouldn't have a previous pointer. */
- struct object *prev = cap_to_object (activity,
+ struct object *prev = vg_cap_to_object (activity,
&((struct folio *) head)->prev);
assert (! prev);
@@ -363,11 +363,11 @@ folio_parent (struct activity *activity, struct folio *folio)
folio->next = activity->folios;
/* Ensure FOLIO's PREV pointer is void. */
- folio->prev.type = cap_void;
+ folio->prev.type = vg_cap_void;
/* Finally, set ACTIVITY->FOLIOS to the new head. */
activity->folios = object_to_cap ((struct object *) folio);
- assert (cap_to_object (activity, &activity->folios)
+ assert (vg_cap_to_object (activity, &activity->folios)
== (struct object *) folio);
}
@@ -410,12 +410,12 @@ folio_alloc (struct activity *activity, struct folio_policy policy)
int f = bit_alloc (folios, sizeof (folios), 0);
if (f < 0)
panic ("Out of folios");
- oid_t foid = f * (FOLIO_OBJECTS + 1);
+ vg_oid_t foid = f * (VG_FOLIO_OBJECTS + 1);
/* We can't just allocate a fresh page: we need to preserve the
version information for the folio as well as the objects. */
struct folio *folio = (struct folio *) object_find (activity, foid,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
if (activity)
folio_parent (activity, folio);
@@ -431,14 +431,14 @@ folio_free (struct activity *activity, struct folio *folio)
/* Make sure that FOLIO appears on its owner's folio list. */
assert (({
struct activity *owner
- = (struct activity *) cap_to_object (activity, &folio->activity);
+ = (struct activity *) vg_cap_to_object (activity, &folio->activity);
assert (owner);
- assert (object_type ((struct object *) owner) == cap_activity_control);
+ assert (object_type ((struct object *) owner) == vg_cap_activity_control);
struct folio *f;
- for (f = (struct folio *) cap_to_object (activity, &owner->folios);
- f; f = (struct folio *) cap_to_object (activity, &f->next))
+ for (f = (struct folio *) vg_cap_to_object (activity, &owner->folios);
+ f; f = (struct folio *) vg_cap_to_object (activity, &f->next))
{
- assert (object_type ((struct object *) folio) == cap_folio);
+ assert (object_type ((struct object *) folio) == vg_cap_folio);
if (f == folio)
break;
}
@@ -451,8 +451,8 @@ folio_free (struct activity *activity, struct folio *folio)
the paging activity, etc. */
struct object_desc *fdesc = object_to_object_desc ((struct object *) folio);
- assert (fdesc->type == cap_folio);
- assert (fdesc->oid % (FOLIO_OBJECTS + 1) == 0);
+ assert (fdesc->type == vg_cap_folio);
+ assert (fdesc->oid % (VG_FOLIO_OBJECTS + 1) == 0);
/* Free the objects. This bumps the version of any live objects.
This is correct as although the folio is being destroyed, when we
@@ -462,11 +462,11 @@ folio_free (struct activity *activity, struct folio *folio)
/* As we free the objects, we also don't have to call cap_shootdown
here. */
int i;
- for (i = 0; i < FOLIO_OBJECTS; i ++)
+ for (i = 0; i < VG_FOLIO_OBJECTS; i ++)
folio_object_free (activity, folio, i);
struct activity *owner
- = (struct activity *) cap_to_object (activity, &folio->activity);
+ = (struct activity *) vg_cap_to_object (activity, &folio->activity);
assert (owner);
/* Update the allocation information. */
@@ -474,11 +474,11 @@ folio_free (struct activity *activity, struct folio *folio)
activity_for_each_ancestor (a, ({ a->folio_count --; }));
/* Clear the owner. */
- folio->activity.type = cap_void;
+ folio->activity.type = vg_cap_void;
/* Remove FOLIO from its owner's folio list. */
- struct folio *next = (struct folio *) cap_to_object (activity, &folio->next);
- struct folio *prev = (struct folio *) cap_to_object (activity, &folio->prev);
+ struct folio *next = (struct folio *) vg_cap_to_object (activity, &folio->next);
+ struct folio *prev = (struct folio *) vg_cap_to_object (activity, &folio->prev);
if (prev)
prev->next = folio->next;
@@ -490,8 +490,8 @@ folio_free (struct activity *activity, struct folio *folio)
if (next)
next->prev = folio->prev;
- folio->next.type = cap_void;
- folio->prev.type = cap_void;
+ folio->next.type = vg_cap_void;
+ folio->prev.type = vg_cap_void;
/* And free the folio. */
@@ -499,58 +499,58 @@ folio_free (struct activity *activity, struct folio *folio)
previous data including version information. */
fdesc->version = folio_object_version (folio, -1) + 1;
folio_object_version_set (folio, -1, fdesc->version);
- bit_dealloc (folios, fdesc->oid / (FOLIO_OBJECTS + 1));
+ bit_dealloc (folios, fdesc->oid / (VG_FOLIO_OBJECTS + 1));
}
-struct cap
+struct vg_cap
folio_object_alloc (struct activity *activity,
struct folio *folio,
int idx,
- enum cap_type type,
+ enum vg_cap_type type,
struct object_policy policy,
uintptr_t return_code)
{
- assert (0 <= idx && idx < FOLIO_OBJECTS);
+ assert (0 <= idx && idx < VG_FOLIO_OBJECTS);
- type = cap_type_strengthen (type);
+ type = vg_cap_type_strengthen (type);
struct object_desc *fdesc = object_to_object_desc ((struct object *) folio);
- assert (fdesc->type == cap_folio);
- assert (fdesc->oid % (1 + FOLIO_OBJECTS) == 0);
+ assert (fdesc->type == vg_cap_folio);
+ assert (fdesc->oid % (1 + VG_FOLIO_OBJECTS) == 0);
- debug (5, OID_FMT ":%d -> %s (%s/%d)",
- OID_PRINTF (fdesc->oid), idx, cap_type_string (type),
+ debug (5, VG_OID_FMT ":%d -> %s (%s/%d)",
+ VG_OID_PRINTF (fdesc->oid), idx, vg_cap_type_string (type),
policy.discardable ? "discardable" : "precious", policy.priority);
- oid_t oid = fdesc->oid + 1 + idx;
+ vg_oid_t oid = fdesc->oid + 1 + idx;
struct object *object = NULL;
/* Deallocate any existing object. */
- if (folio_object_type (folio, idx) == cap_activity_control
- || folio_object_type (folio, idx) == cap_thread
- || folio_object_type (folio, idx) == cap_messenger)
+ if (vg_folio_object_type (folio, idx) == vg_cap_activity_control
+ || vg_folio_object_type (folio, idx) == vg_cap_thread
+ || vg_folio_object_type (folio, idx) == vg_cap_messenger)
/* These object types have state that needs to be explicitly
destroyed. */
{
- object = object_find (activity, oid, OBJECT_POLICY_DEFAULT);
+ object = object_find (activity, oid, VG_OBJECT_POLICY_DEFAULT);
assert (object_to_object_desc (object)->type
- == folio_object_type (folio, idx));
+ == vg_folio_object_type (folio, idx));
/* See if we need to destroy the object. */
- switch (folio_object_type (folio, idx))
+ switch (vg_folio_object_type (folio, idx))
{
- case cap_activity_control:
+ case vg_cap_activity_control:
debug (4, "Destroying activity at %llx", oid);
activity_destroy (activity, (struct activity *) object);
break;
- case cap_thread:
+ case vg_cap_thread:
debug (4, "Destroying thread object at %llx", oid);
thread_deinit (activity, (struct thread *) object);
break;
- case cap_messenger:
+ case vg_cap_messenger:
debug (4, "Destroying messenger object at %llx", oid);
messenger_destroy (activity, (struct messenger *) object);
break;
@@ -584,12 +584,12 @@ folio_object_alloc (struct activity *activity,
odesc = object_to_object_desc (object);
assert (odesc->oid == oid);
assert (odesc->version == folio_object_version (folio, idx));
- assertx (odesc->type == folio_object_type (folio, idx),
- OID_FMT ": %s != %s",
- OID_PRINTF (odesc->oid), cap_type_string (odesc->type),
- cap_type_string (folio_object_type (folio, idx)));
+ assertx (odesc->type == vg_folio_object_type (folio, idx),
+ VG_OID_FMT ": %s != %s",
+ VG_OID_PRINTF (odesc->oid), vg_cap_type_string (odesc->type),
+ vg_cap_type_string (vg_folio_object_type (folio, idx)));
- if (type == cap_void)
+ if (type == vg_cap_void)
/* We are deallocating the object: free associated memory. */
{
memory_object_destroy (activity, object);
@@ -601,9 +601,9 @@ folio_object_alloc (struct activity *activity,
}
else
{
- struct cap cap = object_desc_to_cap (odesc);
+ struct vg_cap vg_cap = object_desc_to_cap (odesc);
assert (activity);
- cap_shootdown (activity, &cap);
+ cap_shootdown (activity, &vg_cap);
memset ((void *) object, 0, PAGESIZE);
object_desc_flush (odesc, true);
@@ -618,7 +618,7 @@ folio_object_alloc (struct activity *activity,
}
}
- if (folio_object_type (folio, idx) != cap_void)
+ if (vg_folio_object_type (folio, idx) != vg_cap_void)
/* We know that if an object's type is void then there are no
extant pointers to it. If there are only pointers in memory,
then we need to bump the memory version. Otherwise, we need to
@@ -633,16 +633,16 @@ folio_object_alloc (struct activity *activity,
odesc->version = folio_object_version (folio, idx);
}
- folio_object_type_set (folio, idx, type);
+ vg_folio_object_type_set (folio, idx, type);
folio_object_content_set (folio, idx, false);
folio_object_discarded_set (folio, idx, false);
- folio_object_policy_set (folio, idx, policy);
+ vg_folio_object_policy_set (folio, idx, policy);
folio_object_referenced_set (folio, idx, false);
folio_object_dirty_set (folio, idx, false);
switch (type)
{
- case cap_activity_control:
+ case vg_cap_activity_control:
{
if (! object)
object = object_find (activity, oid, policy);
@@ -655,14 +655,14 @@ folio_object_alloc (struct activity *activity,
;
}
- struct cap cap;
- memset (&cap, 0, sizeof (cap));
- cap.type = type;
- cap.oid = oid;
- cap.version = folio_object_version (folio, idx);
- CAP_POLICY_SET (&cap, policy);
+ struct vg_cap vg_cap;
+ memset (&vg_cap, 0, sizeof (vg_cap));
+ vg_cap.type = type;
+ vg_cap.oid = oid;
+ vg_cap.version = folio_object_version (folio, idx);
+ VG_CAP_POLICY_SET (&vg_cap, policy);
- return cap;
+ return vg_cap;
}
void
@@ -671,26 +671,26 @@ folio_policy (struct activity *activity,
uintptr_t flags, struct folio_policy in,
struct folio_policy *out)
{
- if ((flags & FOLIO_POLICY_DELIVER) && out)
+ if ((flags & VG_FOLIO_POLICY_DELIVER) && out)
{
out->discardable = folio->policy.discardable;
out->group = folio->policy.group;
out->priority = folio->policy.priority;
}
- if (! (flags & FOLIO_POLICY_SET))
+ if (! (flags & VG_FOLIO_POLICY_SET))
return;
- if ((flags & FOLIO_POLICY_GROUP_SET))
+ if ((flags & VG_FOLIO_POLICY_GROUP_SET))
folio->policy.group = in.group;
- if ((flags & FOLIO_POLICY_DISCARDABLE_SET)
+ if ((flags & VG_FOLIO_POLICY_DISCARDABLE_SET)
&& in.discardable != folio->policy.discardable)
/* XXX: We need to move the folio from the discardable list to the
precious list (or vice versa). */
folio->policy.discardable = in.discardable;
- if ((flags & FOLIO_POLICY_PRIORITY_SET))
+ if ((flags & VG_FOLIO_POLICY_PRIORITY_SET))
folio->policy.priority = in.priority;
}
@@ -710,7 +710,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc,
int inactive = 0;
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&desc->activity->frames[i].active);
inactive += activity_list_count (&desc->activity->frames[i].inactive);
@@ -736,7 +736,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc,
int inactive = 0;
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&activity->frames[i].active);
inactive += activity_list_count (&activity->frames[i].inactive);
@@ -774,16 +774,16 @@ object_desc_claim (struct activity *activity, struct object_desc *desc,
not have an activity, it is being initialized. */
if (desc->activity)
{
- debug (5, OID_FMT " claims from " OID_FMT,
- OID_PRINTF (object_to_object_desc ((struct object *) desc
+ debug (5, VG_OID_FMT " claims from " VG_OID_FMT,
+ VG_OID_PRINTF (object_to_object_desc ((struct object *) desc
->activity)->oid),
- OID_PRINTF (activity
+ VG_OID_PRINTF (activity
? object_to_object_desc ((struct object *)
activity)->oid
: 0));
assert (object_type ((struct object *) desc->activity)
- == cap_activity_control);
+ == vg_cap_activity_control);
if (desc->eviction_candidate)
/* DESC is an eviction candidate. The act of claiming saves
@@ -905,10 +905,10 @@ object_desc_claim (struct activity *activity, struct object_desc *desc,
desc->activity = activity;
desc->policy.discardable = policy.discardable;
- debug (5, OID_FMT " claimed " OID_FMT " (%s): %s",
- OID_PRINTF (object_to_object_desc ((struct object *) activity)->oid),
- OID_PRINTF (desc->oid),
- cap_type_string (desc->type),
+ debug (5, VG_OID_FMT " claimed " VG_OID_FMT " (%s): %s",
+ VG_OID_PRINTF (object_to_object_desc ((struct object *) activity)->oid),
+ VG_OID_PRINTF (desc->oid),
+ vg_cap_type_string (desc->type),
desc->policy.discardable ? "discardable" : "precious");
out:;
@@ -919,7 +919,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc,
int inactive = 0;
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&desc->activity->frames[i].active);
inactive += activity_list_count (&desc->activity->frames[i].inactive);
@@ -944,7 +944,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc,
int inactive = 0;
int i;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&activity->frames[i].active);
inactive += activity_list_count (&activity->frames[i].inactive);
@@ -976,10 +976,10 @@ object_wait_queue_head (struct activity *activity, struct object *object)
if (! folio_object_wait_queue_p (folio, i))
return NULL;
- oid_t h = folio_object_wait_queue (folio, i);
- struct object *head = object_find (activity, h, OBJECT_POLICY_DEFAULT);
+ vg_oid_t h = folio_object_wait_queue (folio, i);
+ struct object *head = object_find (activity, h, VG_OBJECT_POLICY_DEFAULT);
assert (head);
- assert (object_type (head) == cap_messenger);
+ assert (object_type (head) == vg_cap_messenger);
assert (((struct messenger *) head)->wait_queue_p);
assert (((struct messenger *) head)->wait_queue_head);
@@ -1000,9 +1000,9 @@ object_wait_queue_tail (struct activity *activity, struct object *object)
struct messenger *tail;
tail = (struct messenger *) object_find (activity, head->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (tail);
- assert (object_type ((struct object *) tail) == cap_messenger);
+ assert (object_type ((struct object *) tail) == vg_cap_messenger);
assert (tail->wait_queue_p);
assert (tail->wait_queue_tail);
@@ -1018,9 +1018,9 @@ object_wait_queue_next (struct activity *activity, struct messenger *m)
struct messenger *next;
next = (struct messenger *) object_find (activity, m->wait_queue.next,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (next);
- assert (object_type ((struct object *) next) == cap_messenger);
+ assert (object_type ((struct object *) next) == vg_cap_messenger);
assert (next->wait_queue_p);
assert (! next->wait_queue_head);
@@ -1036,9 +1036,9 @@ object_wait_queue_prev (struct activity *activity, struct messenger *m)
struct messenger *prev;
prev = (struct messenger *) object_find (activity, m->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (prev);
- assert (object_type ((struct object *) prev) == cap_messenger);
+ assert (object_type ((struct object *) prev) == vg_cap_messenger);
assert (prev->wait_queue_p);
assert (! prev->wait_queue_tail);
@@ -1060,12 +1060,12 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger)
break;
m = (struct messenger *) object_find (activity, last->wait_queue.next,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (m);
assert (m->wait_queue_p);
assert (! m->wait_queue_head);
struct object *p = object_find (activity, m->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (p == (struct object *) last);
last = m;
@@ -1074,7 +1074,7 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger)
assert (last->wait_queue_tail);
struct object *o = object_find (activity, last->wait_queue.next,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (o);
assert (folio_object_wait_queue_p (objects_folio (activity, o),
objects_folio_offset (o)));
@@ -1086,7 +1086,7 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger)
struct messenger *tail;
tail = (struct messenger *) object_find (activity, head->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (tail);
assert (tail->wait_queue_tail);
@@ -1098,13 +1098,13 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger)
assert (! last->wait_queue_tail);
m = (struct messenger *) object_find (activity, last->wait_queue.next,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (m);
assert (m->wait_queue_p);
assert (! m->wait_queue_head);
struct object *p = object_find (activity, m->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (p == (struct object *) last);
last = m;
@@ -1116,8 +1116,8 @@ void
object_wait_queue_push (struct activity *activity,
struct object *object, struct messenger *messenger)
{
- debug (5, "Pushing " OID_FMT " onto %p",
- OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid),
+ debug (5, "Pushing " VG_OID_FMT " onto %p",
+ VG_OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid),
object);
object_wait_queue_check (activity, messenger);
@@ -1171,8 +1171,8 @@ void
object_wait_queue_enqueue (struct activity *activity,
struct object *object, struct messenger *messenger)
{
- debug (5, "Enqueueing " OID_FMT " on %p",
- OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid),
+ debug (5, "Enqueueing " VG_OID_FMT " on %p",
+ VG_OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid),
object);
object_wait_queue_check (activity, messenger);
@@ -1232,8 +1232,8 @@ void
object_wait_queue_unlink (struct activity *activity,
struct messenger *messenger)
{
- debug (5, "Removing " OID_FMT,
- OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid));
+ debug (5, "Removing " VG_OID_FMT,
+ VG_OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid));
assert (messenger->wait_queue_p);
@@ -1245,7 +1245,7 @@ object_wait_queue_unlink (struct activity *activity,
{
struct object *object;
object = object_find (activity, messenger->wait_queue.next,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (object);
assert (folio_object_wait_queue_p (objects_folio (activity, object),
objects_folio_offset (object)));
@@ -1256,7 +1256,7 @@ object_wait_queue_unlink (struct activity *activity,
list. */
{
assert (object_find (activity, messenger->wait_queue.prev,
- OBJECT_POLICY_DEFAULT)
+ VG_OBJECT_POLICY_DEFAULT)
== (struct object *) messenger);
folio_object_wait_queue_p_set (objects_folio (activity, object),
@@ -1270,7 +1270,7 @@ object_wait_queue_unlink (struct activity *activity,
/* HEAD->PREV == TAIL. */
assert (object_find (activity, head->wait_queue.prev,
- OBJECT_POLICY_DEFAULT)
+ VG_OBJECT_POLICY_DEFAULT)
== (struct object *) messenger);
/* HEAD->PREV = TAIL->PREV. */
@@ -1280,9 +1280,9 @@ object_wait_queue_unlink (struct activity *activity,
struct messenger *prev;
prev = (struct messenger *) object_find (activity,
messenger->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (prev);
- assert (object_type ((struct object *) prev) == cap_messenger);
+ assert (object_type ((struct object *) prev) == vg_cap_messenger);
prev->wait_queue_tail = 1;
prev->wait_queue.next = messenger->wait_queue.next;
@@ -1295,9 +1295,9 @@ object_wait_queue_unlink (struct activity *activity,
assert (next);
struct object *p = object_find (activity, messenger->wait_queue.prev,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (p);
- assert (object_type (p) == cap_messenger);
+ assert (object_type (p) == vg_cap_messenger);
struct messenger *prev = (struct messenger *) p;
if (messenger->wait_queue_head)
@@ -1307,7 +1307,7 @@ object_wait_queue_unlink (struct activity *activity,
struct messenger *tail = prev;
struct object *object = object_find (activity, tail->wait_queue.next,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (object);
assert (object_wait_queue_head (activity, object) == messenger);
diff --git a/viengoos/object.h b/viengoos/object.h
index e8855f0..0e7978d 100644
--- a/viengoos/object.h
+++ b/viengoos/object.h
@@ -46,9 +46,9 @@ extern ss_mutex_t kernel_lock;
-------
A folio is a unit of disk storage. Objects are allocated out of a
- folio. Each folio consists of exactly FOLIO_OBJECTS objects each
+ folio. Each folio consists of exactly VG_FOLIO_OBJECTS objects each
PAGESIZE bytes in size. A folio also includes a 4 kb header (Thus
- a folio consists of a total of FOLIO_OBJECTS + 1 pages of storage).
+ a folio consists of a total of VG_FOLIO_OBJECTS + 1 pages of storage).
The header also describes the folio:
version
@@ -80,7 +80,7 @@ extern ss_mutex_t kernel_lock;
The implementation ensures these invariants. When a storage device
is initialized, all objects are set to have a version of 0 and a
- type of cap_void. As all objects are new, there can be no
+ type of vg_cap_void. As all objects are new, there can be no
capabilities designating them. When an object is deallocated, if
the object's type is void, nothing is done. Otherwise, the
object's version is incremented and its type is set to void. When
@@ -122,9 +122,9 @@ extern ss_mutex_t kernel_lock;
struct object_desc
{
/* The version and OID of the object. */
- oid_t oid;
- uintptr_t version : CAP_VERSION_BITS;
- uintptr_t type : CAP_TYPE_BITS;
+ vg_oid_t oid;
+ uintptr_t version : VG_CAP_VERSION_BITS;
+ uintptr_t type : VG_CAP_TYPE_BITS;
/* Whether the page is dirty. */
uintptr_t dirty: 1;
@@ -172,13 +172,13 @@ struct object_desc
union
{
/* ACTIVITY is valid, EVICTION_CANDIDATE is false, POLICY.PRIORITY
- != OBJECT_PRIORITY_DEFAULT.
+ != VG_OBJECT_PRIORITY_DEFAULT.
=> attached to ACTIVITY->PRIORITIES. */
hurd_btree_node_t priority_node;
/* ACTIVITY is valid, EVICTION_CANDIDATE is false, POLICY.PRIORITY
- == OBJECT_PRIORITY_DEFAULT,
+ == VG_OBJECT_PRIORITY_DEFAULT,
=> attached to one of ACTIVITY's LRU lists.
@@ -215,16 +215,16 @@ extern struct object_desc *object_descs;
place. The first reason is that it relies on the definition of
struct activity and struct thread and this header file includes
neither activity.h nor thread.h. */
-#define OBJECT_NAME_FMT "%s%s" OID_FMT
+#define OBJECT_NAME_FMT "%s%s" VG_OID_FMT
#define OBJECT_NAME_PRINTF(__onp) \
({ \
const char *name = ""; \
- if (object_type ((__onp)) == cap_activity_control) \
+ if (object_type ((__onp)) == vg_cap_activity_control) \
{ \
struct activity *a = (struct activity *) (__onp); \
name = a->name.name; \
} \
- else if (object_type ((__onp)) == cap_thread) \
+ else if (object_type ((__onp)) == vg_cap_thread) \
{ \
struct thread *t = (struct thread *) (__onp); \
name = t->name.name; \
@@ -233,12 +233,12 @@ extern struct object_desc *object_descs;
}), \
({ \
const char *name = ""; \
- if (object_type ((__onp)) == cap_activity_control) \
+ if (object_type ((__onp)) == vg_cap_activity_control) \
{ \
struct activity *a = (struct activity *) (__onp); \
name = a->name.name; \
} \
- else if (object_type ((__onp)) == cap_thread) \
+ else if (object_type ((__onp)) == vg_cap_thread) \
{ \
struct thread *t = (struct thread *) (__onp); \
name = t->name.name; \
@@ -247,7 +247,7 @@ extern struct object_desc *object_descs;
if (*name) \
space = " "; \
space; \
- }), OID_PRINTF (object_to_object_desc ((__onp))->oid) \
+ }), VG_OID_PRINTF (object_to_object_desc ((__onp))->oid) \
LIST_CLASS(activity, struct object_desc, activity_node, true)
LIST_CLASS(eviction, struct object_desc, activity_node, true)
@@ -281,13 +281,13 @@ extern void object_init (void);
/* Return the address of the object corresponding to object OID,
reading it from backing store if required. */
-extern struct object *object_find (struct activity *activity, oid_t oid,
+extern struct object *object_find (struct activity *activity, vg_oid_t oid,
struct object_policy policy);
/* If the object corresponding to object OID is in-memory, return it.
Otherwise, return NULL. Does not go to disk. */
extern struct object *object_find_soft (struct activity *activity,
- oid_t oid,
+ vg_oid_t oid,
struct object_policy policy);
/* Destroy the object OBJECT. Any changes must have already been
@@ -329,41 +329,41 @@ extern void memory_object_destroy (struct activity *activity,
&object_descs[((uintptr_t) (object__) - first_frame) / PAGESIZE]; \
})
-/* Return a cap referencing the object designated by OBJECT_DESC. */
-static inline struct cap
+/* Return a vg_cap referencing the object designated by OBJECT_DESC. */
+static inline struct vg_cap
object_desc_to_cap (struct object_desc *desc)
{
- struct cap cap;
+ struct vg_cap vg_cap;
- cap.type = desc->type;
- cap.oid = desc->oid;
- cap.version = desc->version;
- cap.addr_trans = CAP_ADDR_TRANS_VOID;
- cap.discardable = desc->policy.discardable;
- cap.priority = desc->policy.priority;
+ vg_cap.type = desc->type;
+ vg_cap.oid = desc->oid;
+ vg_cap.version = desc->version;
+ vg_cap.addr_trans = VG_CAP_ADDR_TRANS_VOID;
+ vg_cap.discardable = desc->policy.discardable;
+ vg_cap.priority = desc->policy.priority;
- if (cap.type == cap_cappage)
- CAP_SET_SUBPAGE (&cap, 0, 1);
- else if (cap.type == cap_folio)
- CAP_SET_SUBPAGE (&cap, 0, 1);
+ if (vg_cap.type == vg_cap_cappage)
+ VG_CAP_SET_SUBPAGE (&vg_cap, 0, 1);
+ else if (vg_cap.type == vg_cap_folio)
+ VG_CAP_SET_SUBPAGE (&vg_cap, 0, 1);
- return cap;
+ return vg_cap;
}
-/* Return a cap referencing the object OBJECT. */
-static inline struct cap
+/* Return a vg_cap referencing the object OBJECT. */
+static inline struct vg_cap
object_to_cap (struct object *object)
{
return object_desc_to_cap (object_to_object_desc (object));
}
-static inline oid_t
+static inline vg_oid_t
object_oid (struct object *object)
{
return object_to_object_desc (object)->oid;
}
-static inline enum cap_type
+static inline enum vg_cap_type
object_type (struct object *object)
{
return object_to_object_desc (object)->type;
@@ -469,13 +469,13 @@ extern void folio_free (struct activity *activity, struct folio *folio);
/* Allocate an object of type TYPE using the PAGE page from the folio
FOLIO. This implicitly destroys any existing object in that page.
If there were any waiters waiting for the descruction, they are
- woken and passed RETURN_CODE. If TYPE is cap_void, this is
+ woken and passed RETURN_CODE. If TYPE is vg_cap_void, this is
equivalent to calling folio_object_free. If OBJECTP is not-NULL,
then the in-memory location of the object is returned in
*OBJECTP. */
-extern struct cap folio_object_alloc (struct activity *activity,
+extern struct vg_cap folio_object_alloc (struct activity *activity,
struct folio *folio, int page,
- enum cap_type type,
+ enum vg_cap_type type,
struct object_policy policy,
uintptr_t return_code);
@@ -484,8 +484,8 @@ static inline void
folio_object_free (struct activity *activity,
struct folio *folio, int page)
{
- folio_object_alloc (activity, folio, page, cap_void,
- OBJECT_POLICY_VOID, 0);
+ folio_object_alloc (activity, folio, page, vg_cap_void,
+ VG_OBJECT_POLICY_VOID, 0);
}
/* Return an object's position within its folio. */
@@ -494,7 +494,7 @@ objects_folio_offset (struct object *object)
{
struct object_desc *desc = object_to_object_desc (object);
- return (desc->oid % (1 + FOLIO_OBJECTS)) - 1;
+ return (desc->oid % (1 + VG_FOLIO_OBJECTS)) - 1;
}
/* Return the folio corresponding to the object OBJECT. */
@@ -504,7 +504,7 @@ objects_folio (struct activity *activity, struct object *object)
struct object_desc *odesc = object_to_object_desc (object);
int page = objects_folio_offset (object);
- oid_t foid = odesc->oid - page - 1;
+ vg_oid_t foid = odesc->oid - page - 1;
if (odesc->maybe_folio_desc
&& odesc->maybe_folio_desc->live
@@ -512,7 +512,7 @@ objects_folio (struct activity *activity, struct object *object)
return (struct folio *) object_desc_to_object (odesc->maybe_folio_desc);
struct folio *folio = (struct folio *) object_find (activity, foid,
- OBJECT_POLICY_VOID);
+ VG_OBJECT_POLICY_VOID);
assert (folio);
odesc->maybe_folio_desc = object_to_object_desc ((struct object *) folio);
@@ -578,8 +578,8 @@ extern void object_wait_queue_unlink (struct activity *activity,
(folio_object_wait_queue_p (__owqfe_folio, __owqfe_idx) \
? object_find (__owqfe_activity, \
folio_object_wait_queue (__owqfe_folio, \
- __owqfe_idx), \
- OBJECT_POLICY_VOID) \
+ __owqfe_idx), \
+ VG_OBJECT_POLICY_VOID) \
: NULL); \
(__owqfe_messenger = __owqfe_next) \
&& ((__owqfe_next = object_wait_queue_next (__owqfe_activity, \
diff --git a/viengoos/pager.c b/viengoos/pager.c
index 8b3b038..28bb76a 100644
--- a/viengoos/pager.c
+++ b/viengoos/pager.c
@@ -37,8 +37,8 @@ is_clean (struct object_desc *desc)
l4_fpage_t result = l4_unmap_fpage (l4_fpage ((l4_word_t) object,
PAGESIZE));
assertx (! l4_was_written (result) && ! l4_was_referenced (result),
- "The %s " OID_FMT "(at %p) has status bits set (%s %s)",
- cap_type_string (desc->type), OID_PRINTF (desc->oid), object,
+ "The %s " VG_OID_FMT "(at %p) has status bits set (%s %s)",
+ vg_cap_type_string (desc->type), VG_OID_PRINTF (desc->oid), object,
l4_was_written (result) ? "dirty" : "",
l4_was_referenced (result) ? "refed" : "");
@@ -55,8 +55,8 @@ is_clean (struct object_desc *desc)
clean = false;
}
assertx (clean,
- "The %s " OID_FMT "(at %p) is dirty!",
- cap_type_string (desc->type), OID_PRINTF (desc->oid),
+ "The %s " VG_OID_FMT "(at %p) is dirty!",
+ vg_cap_type_string (desc->type), VG_OID_PRINTF (desc->oid),
object);
}
#endif
@@ -79,7 +79,7 @@ reclaim_from (struct activity *victim, int goal)
int active = 0;
int inactive = 0;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&victim->frames[i].active);
inactive += activity_list_count (&victim->frames[i].inactive);
@@ -98,7 +98,7 @@ reclaim_from (struct activity *victim, int goal)
victim->frames_local,
available_list_count (&available), laundry_list_count (&laundry));
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
int s = count;
@@ -207,7 +207,7 @@ reclaim_from (struct activity *victim, int goal)
active = 0;
inactive = 0;
- for (i = OBJECT_PRIORITY_MIN; i <= OBJECT_PRIORITY_MAX; i ++)
+ for (i = VG_OBJECT_PRIORITY_MIN; i <= VG_OBJECT_PRIORITY_MAX; i ++)
{
active += activity_list_count (&victim->frames[i].active);
inactive += activity_list_count (&victim->frames[i].inactive);
diff --git a/viengoos/server.c b/viengoos/server.c
index 6c0be23..5a6c4cc 100644
--- a/viengoos/server.c
+++ b/viengoos/server.c
@@ -218,18 +218,18 @@ server_loop (void)
and then once we find the real principal, we just add the
charges to the former to the latter. */
struct activity *activity
- = (struct activity *) cap_to_object (root_activity,
+ = (struct activity *) vg_cap_to_object (root_activity,
&thread->activity);
if (! activity)
{
DEBUG (1, "Caller has no assigned activity");
continue;
}
- if (object_type ((struct object *) activity) != cap_activity_control)
+ if (object_type ((struct object *) activity) != vg_cap_activity_control)
{
DEBUG (1, "Caller's activity slot contains a %s,"
"not an activity_control",
- cap_type_string (object_type ((struct object *) activity)));
+ vg_cap_type_string (object_type ((struct object *) activity)));
continue;
}
@@ -248,17 +248,17 @@ server_loop (void)
uintptr_t page_addr = fault & ~(PAGESIZE - 1);
- struct cap cap;
+ struct vg_cap cap;
bool writable;
cap = as_object_lookup_rel (activity, &thread->aspace,
- addr_chop (PTR_TO_ADDR (page_addr),
+ vg_addr_chop (VG_PTR_TO_ADDR (page_addr),
PAGESIZE_LOG2),
- write_fault ? cap_page : cap_rpage,
+ write_fault ? vg_cap_page : vg_cap_rpage,
&writable);
- assert (cap.type == cap_void
- || cap.type == cap_page
- || cap.type == cap_rpage);
+ assert (cap.type == vg_cap_void
+ || cap.type == vg_cap_page
+ || cap.type == vg_cap_rpage);
bool discarded = false;
if (write_fault && ! writable)
@@ -270,32 +270,32 @@ server_loop (void)
if (! writable && cap.discardable)
{
DEBUG (4, "Ignoring discardable predicate for cap designating "
- OID_FMT " (%s)",
- OID_PRINTF (cap.oid), cap_type_string (cap.type));
+ VG_OID_FMT " (%s)",
+ VG_OID_PRINTF (cap.oid), vg_cap_type_string (cap.type));
cap.discardable = false;
}
- struct object *page = cap_to_object (activity, &cap);
- if (! page && cap.type != cap_void)
+ struct object *page = vg_cap_to_object (activity, &cap);
+ if (! page && cap.type != vg_cap_void)
/* It's not in-memory. See if it was discarded. If not,
- load it using cap_to_object. */
+ load it using vg_cap_to_object. */
{
- int object = (cap.oid % (FOLIO_OBJECTS + 1)) - 1;
- oid_t foid = cap.oid - object - 1;
+ int object = (cap.oid % (VG_FOLIO_OBJECTS + 1)) - 1;
+ vg_oid_t foid = cap.oid - object - 1;
struct folio *folio
= (struct folio *) object_find (activity, foid,
- OBJECT_POLICY_DEFAULT);
+ VG_OBJECT_POLICY_DEFAULT);
assert (folio);
- assert (object_type ((struct object *) folio) == cap_folio);
+ assert (object_type ((struct object *) folio) == vg_cap_folio);
if (cap.version == folio_object_version (folio, object))
{
if (folio_object_discarded (folio, object))
{
- DEBUG (4, OID_FMT " (%s) was discarded",
- OID_PRINTF (cap.oid),
- cap_type_string (folio_object_type (folio,
- object)));
+ DEBUG (4, VG_OID_FMT " (%s) was discarded",
+ VG_OID_PRINTF (cap.oid),
+ vg_cap_type_string (vg_folio_object_type (folio,
+ object)));
assert (! folio_object_content (folio, object));
@@ -320,14 +320,14 @@ server_loop (void)
_L4_exchange_registers (&targ, &c,
&sp, &dummy, &dummy, &dummy, &dummy);
- struct activation_fault_info info;
+ struct vg_activation_fault_info info;
info.access = access;
- info.type = write_fault ? cap_page : cap_rpage;
+ info.type = write_fault ? vg_cap_page : vg_cap_rpage;
info.discarded = discarded;
- activation_fault_send_marshal (reply_buffer, PTR_TO_ADDR (fault),
- sp, ip, info, ADDR_VOID);
+ activation_fault_send_marshal (reply_buffer, VG_PTR_TO_ADDR (fault),
+ sp, ip, info, VG_ADDR_VOID);
thread_raise_exception (activity, thread, reply_buffer);
continue;
@@ -363,17 +363,17 @@ server_loop (void)
page_addr += PAGESIZE;
cap = as_object_lookup_rel (activity, &thread->aspace,
- addr_chop (PTR_TO_ADDR (page_addr),
+ vg_addr_chop (VG_PTR_TO_ADDR (page_addr),
PAGESIZE_LOG2),
- cap_rpage, &writable);
+ vg_cap_rpage, &writable);
- if (cap.type != cap_page && cap.type != cap_rpage)
+ if (cap.type != vg_cap_page && cap.type != vg_cap_rpage)
break;
if (! writable && cap.discardable)
cap.discardable = false;
- struct object *page = cap_to_object (activity, &cap);
+ struct object *page = vg_cap_to_object (activity, &cap);
if (! page)
break;
@@ -392,7 +392,7 @@ server_loop (void)
DEBUG (5, "Prefaulting " DEBUG_BOLD ("%x") " <- %p (%x/%x/%x) %s",
page_addr,
page, l4_address (fpage), l4_size (fpage),
- l4_rights (fpage), cap_type_string (cap.type));
+ l4_rights (fpage), vg_cap_type_string (cap.type));
count ++;
}
@@ -427,7 +427,7 @@ server_loop (void)
/* Return the capability slot corresponding to address ADDR in
the address space rooted at ROOT. */
- error_t SLOT_ (struct cap *root, addr_t addr, struct cap **capp)
+ error_t SLOT_ (struct vg_cap *root, vg_addr_t addr, struct vg_cap **capp)
{
bool w;
if (! as_slot_lookup_rel_use (activity, root, addr,
@@ -437,14 +437,14 @@ server_loop (void)
})))
{
DEBUG (0, "No capability slot at 0x%llx/%d",
- addr_prefix (addr), addr_depth (addr));
+ vg_addr_prefix (addr), vg_addr_depth (addr));
as_dump_from (activity, root, "");
return ENOENT;
}
if (! w)
{
DEBUG (1, "Capability slot at 0x%llx/%d not writable",
- addr_prefix (addr), addr_depth (addr));
+ vg_addr_prefix (addr), vg_addr_depth (addr));
as_dump_from (activity, root, "");
return EPERM;
}
@@ -453,7 +453,7 @@ server_loop (void)
}
#define SLOT(root_, addr_) \
({ \
- struct cap *SLOT_ret; \
+ struct vg_cap *SLOT_ret; \
error_t err = SLOT_ (root_, addr_, &SLOT_ret); \
if (err) \
REPLY (err); \
@@ -463,27 +463,27 @@ server_loop (void)
/* Return a cap referencing the object at address ADDR of the
callers capability space if it is of type TYPE (-1 = don't care).
Whether the object is writable is stored in *WRITABLEP_. */
- error_t CAP_ (struct cap *root,
- addr_t addr, int type, bool require_writable,
- struct cap *cap)
+ error_t CAP_ (struct vg_cap *root,
+ vg_addr_t addr, int type, bool require_writable,
+ struct vg_cap *cap)
{
bool writable = true;
*cap = as_cap_lookup_rel (principal, root, addr,
type, require_writable ? &writable : NULL);
- if (type != -1 && ! cap_types_compatible (cap->type, type))
+ if (type != -1 && ! vg_cap_types_compatible (cap->type, type))
{
DEBUG (1, "Addr 0x%llx/%d does not reference object of "
"type %s but %s",
- addr_prefix (addr), addr_depth (addr),
- cap_type_string (type), cap_type_string (cap->type));
+ vg_addr_prefix (addr), vg_addr_depth (addr),
+ vg_cap_type_string (type), vg_cap_type_string (cap->type));
as_dump_from (activity, root, "");
return ENOENT;
}
if (require_writable && ! writable)
{
- DEBUG (1, "Addr " ADDR_FMT " not writable",
- ADDR_PRINTF (addr));
+ DEBUG (1, "Addr " VG_ADDR_FMT " not writable",
+ VG_ADDR_PRINTF (addr));
return EPERM;
}
@@ -491,7 +491,7 @@ server_loop (void)
}
#define CAP(root_, addr_, type_, require_writable_) \
({ \
- struct cap CAP_ret; \
+ struct vg_cap CAP_ret; \
error_t err = CAP_ (root_, addr_, type_, require_writable_, \
&CAP_ret); \
if (err) \
@@ -499,19 +499,19 @@ server_loop (void)
CAP_ret; \
})
- error_t OBJECT_ (struct cap *root,
- addr_t addr, int type, bool require_writable,
+ error_t OBJECT_ (struct vg_cap *root,
+ vg_addr_t addr, int type, bool require_writable,
struct object **objectp, bool *writable)
{
bool w = true;
- struct cap cap;
+ struct vg_cap cap;
cap = as_object_lookup_rel (principal, root, addr, type, &w);
- if (type != -1 && ! cap_types_compatible (cap.type, type))
+ if (type != -1 && ! vg_cap_types_compatible (cap.type, type))
{
DEBUG (0, "Addr 0x%llx/%d does not reference object of "
"type %s but %s",
- addr_prefix (addr), addr_depth (addr),
- cap_type_string (type), cap_type_string (cap.type));
+ vg_addr_prefix (addr), vg_addr_depth (addr),
+ vg_cap_type_string (type), vg_cap_type_string (cap.type));
return ENOENT;
}
@@ -520,18 +520,18 @@ server_loop (void)
if (require_writable && ! w)
{
- DEBUG (0, "Addr " ADDR_FMT " not writable",
- ADDR_PRINTF (addr));
+ DEBUG (0, "Addr " VG_ADDR_FMT " not writable",
+ VG_ADDR_PRINTF (addr));
return EPERM;
}
- *objectp = cap_to_object (principal, &cap);
+ *objectp = vg_cap_to_object (principal, &cap);
if (! *objectp)
{
do_debug (4)
- DEBUG (0, "Addr " ADDR_FMT " contains a dangling pointer: "
- CAP_FMT,
- ADDR_PRINTF (addr), CAP_PRINTF (&cap));
+ DEBUG (0, "Addr " VG_ADDR_FMT " contains a dangling pointer: "
+ VG_CAP_FMT,
+ VG_ADDR_PRINTF (addr), VG_CAP_PRINTF (&cap));
return ENOENT;
}
@@ -547,14 +547,14 @@ server_loop (void)
OBJECT_ret; \
})
- /* Find an address space root. If ADDR_VOID, the current
+ /* Find an address space root. If VG_ADDR_VOID, the current
thread's. Otherwise, the object identified by ROOT_ADDR_ in
the caller's address space. If that is a thread object, then
it's address space root. */
#define ROOT(root_addr_) \
({ \
- struct cap *root_; \
- if (ADDR_IS_VOID (root_addr_)) \
+ struct vg_cap *root_; \
+ if (VG_ADDR_IS_VOID (root_addr_)) \
root_ = &thread->aspace; \
else \
{ \
@@ -563,13 +563,13 @@ server_loop (void)
thread if it matches the guard exactly. */ \
struct object *t_; \
error_t err = OBJECT_ (&thread->aspace, root_addr_, \
- cap_thread, true, &t_, NULL); \
+ vg_cap_thread, true, &t_, NULL); \
if (! err) \
root_ = &((struct thread *) t_)->aspace; \
else \
root_ = SLOT (&thread->aspace, root_addr_); \
} \
- DEBUG (4, "root: " CAP_FMT, CAP_PRINTF (root_)); \
+ DEBUG (4, "root: " VG_CAP_FMT, VG_CAP_PRINTF (root_)); \
\
root_; \
})
@@ -592,7 +592,7 @@ server_loop (void)
#define ARG64_WORDS 1
#endif
-#define ARG_ADDR(word_) ((addr_t) { ARG64(word_) })
+#define ARG_ADDR(word_) ((vg_addr_t) { ARG64(word_) })
if (label == 2132)
/* write. */
@@ -613,30 +613,30 @@ server_loop (void)
int i = 0;
uintptr_t flags = ARG (i);
i ++;
- addr_t recv_activity = ARG_ADDR (i);
+ vg_addr_t recv_activity = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t recv_messenger = ARG_ADDR (i);
+ vg_addr_t recv_messenger = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t recv_buf = ARG_ADDR (i);
+ vg_addr_t recv_buf = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t recv_inline_cap = ARG_ADDR (i);
+ vg_addr_t recv_inline_cap = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t send_activity = ARG_ADDR (i);
+ vg_addr_t send_activity = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t target_messenger = ARG_ADDR (i);
+ vg_addr_t target_messenger = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t send_messenger = ARG_ADDR (i);
+ vg_addr_t send_messenger = ARG_ADDR (i);
i += ARG64_WORDS;
- addr_t send_buf = ARG_ADDR (i);
+ vg_addr_t send_buf = ARG_ADDR (i);
i += ARG64_WORDS;
uintptr_t inline_word1 = ARG (i);
i ++;
uintptr_t inline_word2 = ARG (i);
i ++;
- addr_t inline_cap = ARG_ADDR (i);
+ vg_addr_t inline_cap = ARG_ADDR (i);
#ifndef NDEBUG
/* Get the label early to improve debugging output in case the
@@ -649,21 +649,21 @@ server_loop (void)
{
principal = activity;
- struct cap cap = CAP_VOID;
- if (! ADDR_IS_VOID (send_buf))
+ struct vg_cap cap = VG_CAP_VOID;
+ if (! VG_ADDR_IS_VOID (send_buf))
/* Caller provided a send buffer. */
- CAP_ (&thread->aspace, send_buf, cap_page, true, &cap);
+ CAP_ (&thread->aspace, send_buf, vg_cap_page, true, &cap);
else
{
struct object *object = NULL;
OBJECT_ (&thread->aspace, send_messenger,
- cap_messenger, true, &object, NULL);
+ vg_cap_messenger, true, &object, NULL);
if (object)
cap = ((struct messenger *) object)->buffer;
}
struct vg_message *message;
- message = (struct vg_message *) cap_to_object (principal,
+ message = (struct vg_message *) vg_cap_to_object (principal,
&cap);
if (message)
label = vg_message_word (message, 0);
@@ -672,9 +672,9 @@ server_loop (void)
#endif
DEBUG (4, "flags: %s%s%s%s%s%s %s%s%s%s%s%s %s %s%s%s%s(%x),"
- "recv (" ADDR_FMT ", " ADDR_FMT ", " ADDR_FMT "), "
- "send (" ADDR_FMT ", " ADDR_FMT ", " ADDR_FMT ", " ADDR_FMT "), "
- "inline (" ADDR_FMT "; %x, %x, " ADDR_FMT ")",
+ "recv (" VG_ADDR_FMT ", " VG_ADDR_FMT ", " VG_ADDR_FMT "), "
+ "send (" VG_ADDR_FMT ", " VG_ADDR_FMT ", " VG_ADDR_FMT ", " VG_ADDR_FMT "), "
+ "inline (" VG_ADDR_FMT "; %x, %x, " VG_ADDR_FMT ")",
(flags & VG_IPC_RECEIVE) ? "R" : "-",
(flags & VG_IPC_RECEIVE_NONBLOCKING) ? "N" : "B",
(flags & VG_IPC_RECEIVE_ACTIVATE) ? "A" : "-",
@@ -693,22 +693,22 @@ server_loop (void)
(flags & VG_IPC_SEND_INLINE_WORD2) ? "2" : "-",
(flags & VG_IPC_SEND_INLINE_CAP1) ? "C" : "-",
flags,
- ADDR_PRINTF (recv_activity), ADDR_PRINTF (recv_messenger),
- ADDR_PRINTF (recv_buf),
- ADDR_PRINTF (send_activity), ADDR_PRINTF (target_messenger),
- ADDR_PRINTF (send_messenger), ADDR_PRINTF (send_buf),
- ADDR_PRINTF (recv_inline_cap),
- inline_word1, inline_word2, ADDR_PRINTF (inline_cap));
+ VG_ADDR_PRINTF (recv_activity), VG_ADDR_PRINTF (recv_messenger),
+ VG_ADDR_PRINTF (recv_buf),
+ VG_ADDR_PRINTF (send_activity), VG_ADDR_PRINTF (target_messenger),
+ VG_ADDR_PRINTF (send_messenger), VG_ADDR_PRINTF (send_buf),
+ VG_ADDR_PRINTF (recv_inline_cap),
+ inline_word1, inline_word2, VG_ADDR_PRINTF (inline_cap));
if ((flags & VG_IPC_RECEIVE))
/* IPC includes a receive phase. */
{
principal = activity;
- if (! ADDR_IS_VOID (recv_activity))
+ if (! VG_ADDR_IS_VOID (recv_activity))
{
principal = (struct activity *) OBJECT (&thread->aspace,
recv_activity,
- cap_activity, false,
+ vg_cap_activity, false,
NULL);
if (! principal)
{
@@ -719,7 +719,7 @@ server_loop (void)
struct messenger *messenger
= (struct messenger *) OBJECT (&thread->aspace,
- recv_messenger, cap_messenger,
+ recv_messenger, vg_cap_messenger,
true, NULL);
if (! messenger)
{
@@ -737,10 +737,10 @@ server_loop (void)
else
{
messenger->out_of_band = true;
- if (unlikely (! ADDR_IS_VOID (recv_buf)))
+ if (unlikely (! VG_ADDR_IS_VOID (recv_buf)))
/* Associate RECV_BUF with RECV_MESSENGER. */
messenger->buffer = CAP (&thread->aspace, recv_buf,
- cap_page, true);
+ vg_cap_page, true);
}
if (unlikely ((flags & VG_IPC_RECEIVE_SET_THREAD_TO_CALLER)))
@@ -799,19 +799,19 @@ server_loop (void)
label = inline_word1;
principal = activity;
- struct cap principal_cap;
- if (! ADDR_IS_VOID (send_activity))
+ struct vg_cap principal_cap;
+ if (! VG_ADDR_IS_VOID (send_activity))
{
/* We need the cap below, otherwise, we could just use
OBJECT. */
principal_cap = CAP (&thread->aspace,
- send_activity, cap_activity, false);
- principal = (struct activity *) cap_to_object (principal,
+ send_activity, vg_cap_activity, false);
+ principal = (struct activity *) vg_cap_to_object (principal,
&principal_cap);
if (! principal)
{
- DEBUG (4, "Dangling pointer at " ADDR_FMT,
- ADDR_PRINTF (send_activity));
+ DEBUG (4, "Dangling pointer at " VG_ADDR_FMT,
+ VG_ADDR_PRINTF (send_activity));
REPLY (ENOENT);
}
}
@@ -823,7 +823,7 @@ server_loop (void)
struct messenger *source
= (struct messenger *) OBJECT (&thread->aspace,
- send_messenger, cap_messenger,
+ send_messenger, vg_cap_messenger,
true, NULL);
if (unlikely (! source))
{
@@ -832,8 +832,8 @@ server_loop (void)
}
if (! (flags & VG_IPC_SEND_INLINE)
- && unlikely (! ADDR_IS_VOID (send_buf)))
- source->buffer = CAP (&thread->aspace, send_buf, cap_page, true);
+ && unlikely (! VG_ADDR_IS_VOID (send_buf)))
+ source->buffer = CAP (&thread->aspace, send_buf, vg_cap_page, true);
if (unlikely ((flags & VG_IPC_SEND_SET_THREAD_TO_CALLER)))
source->thread = object_to_cap ((struct object *) thread);
@@ -846,7 +846,7 @@ server_loop (void)
bool target_writable = true;
struct object *target;
/* We special case VOID to mean the current thread. */
- if (ADDR_IS_VOID (target_messenger))
+ if (VG_ADDR_IS_VOID (target_messenger))
target = (struct object *) thread;
else
target = OBJECT (&thread->aspace, target_messenger, -1, false,
@@ -857,13 +857,13 @@ server_loop (void)
REPLY (ENOENT);
}
- if (object_type (target) == cap_messenger && ! target_writable)
+ if (object_type (target) == vg_cap_messenger && ! target_writable)
/* TARGET is a weak reference to a messenger. Forward the
message. */
{
- DEBUG (5, "IPC: " OID_FMT " -> " OID_FMT,
- OID_PRINTF (object_oid ((struct object *) source)),
- OID_PRINTF (object_oid ((struct object *) target)));
+ DEBUG (5, "IPC: " VG_OID_FMT " -> " VG_OID_FMT,
+ VG_OID_PRINTF (object_oid ((struct object *) source)),
+ VG_OID_PRINTF (object_oid ((struct object *) target)));
if ((flags & VG_IPC_SEND_INLINE))
{
@@ -940,18 +940,18 @@ server_loop (void)
}
else
{
- if (source->buffer.type != cap_page)
+ if (source->buffer.type != vg_cap_page)
{
DEBUG (0, "Sender user-buffer has wrong type: %s",
- cap_type_string (source->buffer.type));
+ vg_cap_type_string (source->buffer.type));
REPLY (EINVAL);
}
- message = (struct vg_message *) cap_to_object (principal,
+ message = (struct vg_message *) vg_cap_to_object (principal,
&source->buffer);
if (! message)
{
DEBUG (0, "Sender user-buffer has wrong type: %s",
- cap_type_string (source->buffer.type));
+ vg_cap_type_string (source->buffer.type));
REPLY (EINVAL);
}
}
@@ -973,16 +973,16 @@ server_loop (void)
OBJECT (&thread->aspace,
vg_message_cap (message,
vg_message_cap_count (message) - 1),
- cap_rmessenger, false, NULL);
+ vg_cap_rmessenger, false, NULL);
/* There are a number of methods that look up an object relative
to the invoked object. Generate an appropriate root for
them. */
- struct cap target_root_cap;
- struct cap *target_root;
+ struct vg_cap target_root_cap;
+ struct vg_cap *target_root;
if (likely (target == (struct object *) thread))
target_root = &thread->aspace;
- else if (object_type (target) == cap_thread)
+ else if (object_type (target) == vg_cap_thread)
target_root = &((struct thread *) target)->aspace;
else
{
@@ -990,17 +990,17 @@ server_loop (void)
target_root = &target_root_cap;
}
- DEBUG (4, OID_FMT " %s(%llx) -> " OID_FMT " %s(%llx)",
- OID_PRINTF (object_oid ((struct object *) source)),
- cap_type_string (object_type ((struct object *) source)),
+ DEBUG (4, VG_OID_FMT " %s(%llx) -> " VG_OID_FMT " %s(%llx)",
+ VG_OID_PRINTF (object_oid ((struct object *) source)),
+ vg_cap_type_string (object_type ((struct object *) source)),
source->id,
- OID_PRINTF (object_oid ((struct object *) target)),
- cap_type_string (object_type (target)),
- object_type (target) == cap_messenger
+ VG_OID_PRINTF (object_oid ((struct object *) target)),
+ vg_cap_type_string (object_type (target)),
+ object_type (target) == vg_cap_messenger
? ((struct messenger *) target)->id : 0);
if (reply)
- DEBUG (4, "reply to: " OID_FMT "(%llx)",
- OID_PRINTF (object_oid ((struct object *) reply)),
+ DEBUG (4, "reply to: " VG_OID_FMT "(%llx)",
+ VG_OID_PRINTF (object_oid ((struct object *) reply)),
reply->id);
switch (label)
@@ -1066,20 +1066,20 @@ server_loop (void)
int count = 0;
for (count = 0; count < max; count ++, start += PAGESIZE)
{
- struct cap cap;
+ struct vg_cap cap;
bool writable;
cap = as_object_lookup_rel (activity, &thread->aspace,
- addr_chop (PTR_TO_ADDR (start),
+ vg_addr_chop (VG_PTR_TO_ADDR (start),
PAGESIZE_LOG2),
- cap_rpage, &writable);
+ vg_cap_rpage, &writable);
- if (cap.type != cap_page && cap.type != cap_rpage)
+ if (cap.type != vg_cap_page && cap.type != vg_cap_rpage)
break;
if (! writable && cap.discardable)
cap.discardable = false;
- struct object *page = cap_to_object (activity, &cap);
+ struct object *page = vg_cap_to_object (activity, &cap);
if (! page)
break;
@@ -1097,7 +1097,7 @@ server_loop (void)
DEBUG (4, "Prefault %d: " DEBUG_BOLD ("%x") " <- %x/%x %s",
count + 1, start,
l4_address (fpage), l4_rights (fpage),
- cap_type_string (cap.type));
+ vg_cap_type_string (cap.type));
}
if (count > 0)
@@ -1115,11 +1115,11 @@ server_loop (void)
case RM_folio_alloc:
{
- if (object_type (target) != cap_activity_control)
+ if (object_type (target) != vg_cap_activity_control)
{
- DEBUG (0, "target " ADDR_FMT " not an activity but a %s",
- ADDR_PRINTF (target_messenger),
- cap_type_string (object_type (target)));
+ DEBUG (0, "target " VG_ADDR_FMT " not an activity but a %s",
+ VG_ADDR_PRINTF (target_messenger),
+ vg_cap_type_string (object_type (target)));
REPLY (EINVAL);
}
@@ -1130,7 +1130,7 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, "(" ADDR_FMT ")", ADDR_PRINTF (target_messenger));
+ DEBUG (4, "(" VG_ADDR_FMT ")", VG_ADDR_PRINTF (target_messenger));
struct folio *folio = folio_alloc (activity, policy);
if (! folio)
@@ -1143,7 +1143,7 @@ server_loop (void)
case RM_folio_free:
{
- if (object_type (target) != cap_folio)
+ if (object_type (target) != vg_cap_folio)
REPLY (EINVAL);
struct folio *folio = (struct folio *) target;
@@ -1152,7 +1152,7 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, "(" ADDR_FMT ")", ADDR_PRINTF (target_messenger));
+ DEBUG (4, "(" VG_ADDR_FMT ")", VG_ADDR_PRINTF (target_messenger));
folio_free (principal, folio);
@@ -1162,7 +1162,7 @@ server_loop (void)
case RM_folio_object_alloc:
{
- if (object_type (target) != cap_folio)
+ if (object_type (target) != vg_cap_folio)
REPLY (EINVAL);
struct folio *folio = (struct folio *) target;
@@ -1178,30 +1178,30 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, "(" ADDR_FMT ", %d (" ADDR_FMT "), %s, (%s, %d), %d)",
- ADDR_PRINTF (target_messenger), idx,
- addr_depth (target_messenger) + FOLIO_OBJECTS_LOG2
- <= ADDR_BITS
- ? ADDR_PRINTF (addr_extend (target_messenger,
- idx, FOLIO_OBJECTS_LOG2))
- : ADDR_PRINTF (ADDR_VOID),
- cap_type_string (type),
+ DEBUG (4, "(" VG_ADDR_FMT ", %d (" VG_ADDR_FMT "), %s, (%s, %d), %d)",
+ VG_ADDR_PRINTF (target_messenger), idx,
+ vg_addr_depth (target_messenger) + VG_FOLIO_OBJECTS_LOG2
+ <= VG_ADDR_BITS
+ ? VG_ADDR_PRINTF (vg_addr_extend (target_messenger,
+ idx, VG_FOLIO_OBJECTS_LOG2))
+ : VG_ADDR_PRINTF (VG_ADDR_VOID),
+ vg_cap_type_string (type),
policy.discardable ? "discardable" : "precious",
policy.priority,
return_code);
- if (idx >= FOLIO_OBJECTS)
+ if (idx >= VG_FOLIO_OBJECTS)
REPLY (EINVAL);
- if (! (CAP_TYPE_MIN <= type && type <= CAP_TYPE_MAX))
+ if (! (VG_CAP_TYPE_MIN <= type && type <= VG_CAP_TYPE_MAX))
REPLY (EINVAL);
- struct cap cap;
+ struct vg_cap cap;
cap = folio_object_alloc (principal,
folio, idx, type, policy, return_code);
- struct cap weak = cap;
- weak.type = cap_type_weaken (cap.type);
+ struct vg_cap weak = cap;
+ weak.type = vg_cap_type_weaken (cap.type);
rm_folio_object_alloc_reply (activity, reply, cap, weak);
break;
@@ -1209,7 +1209,7 @@ server_loop (void)
case RM_folio_policy:
{
- if (object_type (target) != cap_folio)
+ if (object_type (target) != vg_cap_folio)
REPLY (EINVAL);
struct folio *folio = (struct folio *) target;
@@ -1221,8 +1221,8 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, "(" ADDR_FMT ", %d)",
- ADDR_PRINTF (target_messenger), flags);
+ DEBUG (4, "(" VG_ADDR_FMT ", %d)",
+ VG_ADDR_PRINTF (target_messenger), flags);
folio_policy (principal, folio, flags, in, &out);
@@ -1232,13 +1232,13 @@ server_loop (void)
case RM_cap_copy:
{
- addr_t source_as_addr;
- addr_t source_addr;
- struct cap source;
- addr_t target_as_addr;
- addr_t target_addr;
+ vg_addr_t source_as_addr;
+ vg_addr_t source_addr;
+ struct vg_cap source;
+ vg_addr_t target_as_addr;
+ vg_addr_t target_addr;
uint32_t flags;
- struct cap_properties properties;
+ struct vg_cap_properties properties;
err = rm_cap_copy_send_unmarshal (message,
&target_addr,
@@ -1247,67 +1247,67 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, "(" ADDR_FMT "@" ADDR_FMT " <- "
- ADDR_FMT "@" ADDR_FMT ", %s%s%s%s%s%s, %s/%d %lld/%d %d/%d",
+ DEBUG (4, "(" VG_ADDR_FMT "@" VG_ADDR_FMT " <- "
+ VG_ADDR_FMT "@" VG_ADDR_FMT ", %s%s%s%s%s%s, %s/%d %lld/%d %d/%d",
- ADDR_PRINTF (target_messenger), ADDR_PRINTF (target_addr),
- ADDR_PRINTF (source_as_addr), ADDR_PRINTF (source_addr),
+ VG_ADDR_PRINTF (target_messenger), VG_ADDR_PRINTF (target_addr),
+ VG_ADDR_PRINTF (source_as_addr), VG_ADDR_PRINTF (source_addr),
- CAP_COPY_COPY_ADDR_TRANS_SUBPAGE & flags
+ VG_CAP_COPY_COPY_ADDR_TRANS_SUBPAGE & flags
? "copy subpage/" : "",
- CAP_COPY_COPY_ADDR_TRANS_GUARD & flags
+ VG_CAP_COPY_COPY_ADDR_TRANS_GUARD & flags
? "copy trans guard/" : "",
- CAP_COPY_COPY_SOURCE_GUARD & flags
+ VG_CAP_COPY_COPY_SOURCE_GUARD & flags
? "copy src guard/" : "",
- CAP_COPY_WEAKEN & flags ? "weak/" : "",
- CAP_COPY_DISCARDABLE_SET & flags ? "discardable/" : "",
- CAP_COPY_PRIORITY_SET & flags ? "priority" : "",
+ VG_CAP_COPY_WEAKEN & flags ? "weak/" : "",
+ VG_CAP_COPY_DISCARDABLE_SET & flags ? "discardable/" : "",
+ VG_CAP_COPY_PRIORITY_SET & flags ? "priority" : "",
properties.policy.discardable ? "discardable" : "precious",
properties.policy.priority,
- CAP_ADDR_TRANS_GUARD (properties.addr_trans),
- CAP_ADDR_TRANS_GUARD_BITS (properties.addr_trans),
- CAP_ADDR_TRANS_SUBPAGE (properties.addr_trans),
- CAP_ADDR_TRANS_SUBPAGES (properties.addr_trans));
+ VG_CAP_ADDR_TRANS_GUARD (properties.addr_trans),
+ VG_CAP_ADDR_TRANS_GUARD_BITS (properties.addr_trans),
+ VG_CAP_ADDR_TRANS_SUBPAGE (properties.addr_trans),
+ VG_CAP_ADDR_TRANS_SUBPAGES (properties.addr_trans));
- struct cap *target;
+ struct vg_cap *target;
target = SLOT (target_root, target_addr);
target_root = ROOT (source_as_addr);
source = CAP (target_root, source_addr, -1, false);
- if ((flags & ~(CAP_COPY_COPY_ADDR_TRANS_SUBPAGE
- | CAP_COPY_COPY_ADDR_TRANS_GUARD
- | CAP_COPY_COPY_SOURCE_GUARD
- | CAP_COPY_WEAKEN
- | CAP_COPY_DISCARDABLE_SET
- | CAP_COPY_PRIORITY_SET)))
+ if ((flags & ~(VG_CAP_COPY_COPY_ADDR_TRANS_SUBPAGE
+ | VG_CAP_COPY_COPY_ADDR_TRANS_GUARD
+ | VG_CAP_COPY_COPY_SOURCE_GUARD
+ | VG_CAP_COPY_WEAKEN
+ | VG_CAP_COPY_DISCARDABLE_SET
+ | VG_CAP_COPY_PRIORITY_SET)))
REPLY (EINVAL);
- DEBUG (4, "(target: (" ADDR_FMT ") " ADDR_FMT ", "
- "source: (" ADDR_FMT ") " ADDR_FMT ", "
+ DEBUG (4, "(target: (" VG_ADDR_FMT ") " VG_ADDR_FMT ", "
+ "source: (" VG_ADDR_FMT ") " VG_ADDR_FMT ", "
"%s|%s, %s {%llx/%d %d/%d})",
- ADDR_PRINTF (target_as_addr), ADDR_PRINTF (target_addr),
- ADDR_PRINTF (source_as_addr), ADDR_PRINTF (source_addr),
- flags & CAP_COPY_COPY_ADDR_TRANS_GUARD ? "copy trans"
- : (flags & CAP_COPY_COPY_SOURCE_GUARD ? "source"
+ VG_ADDR_PRINTF (target_as_addr), VG_ADDR_PRINTF (target_addr),
+ VG_ADDR_PRINTF (source_as_addr), VG_ADDR_PRINTF (source_addr),
+ flags & VG_CAP_COPY_COPY_ADDR_TRANS_GUARD ? "copy trans"
+ : (flags & VG_CAP_COPY_COPY_SOURCE_GUARD ? "source"
: "preserve"),
- flags & CAP_COPY_COPY_ADDR_TRANS_SUBPAGE ? "copy"
+ flags & VG_CAP_COPY_COPY_ADDR_TRANS_SUBPAGE ? "copy"
: "preserve",
- flags & CAP_COPY_WEAKEN ? "weaken" : "no weaken",
- CAP_ADDR_TRANS_GUARD (properties.addr_trans),
- CAP_ADDR_TRANS_GUARD_BITS (properties.addr_trans),
- CAP_ADDR_TRANS_SUBPAGE (properties.addr_trans),
- CAP_ADDR_TRANS_SUBPAGES (properties.addr_trans));
-
- bool r = cap_copy_x (principal,
- ADDR_VOID, target, ADDR_VOID,
- ADDR_VOID, source, ADDR_VOID,
+ flags & VG_CAP_COPY_WEAKEN ? "weaken" : "no weaken",
+ VG_CAP_ADDR_TRANS_GUARD (properties.addr_trans),
+ VG_CAP_ADDR_TRANS_GUARD_BITS (properties.addr_trans),
+ VG_CAP_ADDR_TRANS_SUBPAGE (properties.addr_trans),
+ VG_CAP_ADDR_TRANS_SUBPAGES (properties.addr_trans));
+
+ bool r = vg_cap_copy_x (principal,
+ VG_ADDR_VOID, target, VG_ADDR_VOID,
+ VG_ADDR_VOID, source, VG_ADDR_VOID,
flags, properties);
if (! r)
REPLY (EINVAL);
- if ((flags & (CAP_COPY_DISCARDABLE_SET | CAP_COPY_PRIORITY_SET)))
+ if ((flags & (VG_CAP_COPY_DISCARDABLE_SET | VG_CAP_COPY_PRIORITY_SET)))
/* The caller changed the policy. Also change it on the
object. */
{
@@ -1322,12 +1322,12 @@ server_loop (void)
/* XXX: This should only be allowed if TARGET
grants writable access to the object. */
- if ((flags & CAP_COPY_DISCARDABLE_SET))
+ if ((flags & VG_CAP_COPY_DISCARDABLE_SET))
p.discardable = properties.policy.discardable;
/* Only the current claimant can set the
priority. */
- if ((flags & CAP_COPY_PRIORITY_SET)
+ if ((flags & VG_CAP_COPY_PRIORITY_SET)
&& desc->activity == principal)
p.priority = properties.policy.priority;
@@ -1341,20 +1341,20 @@ server_loop (void)
/* XXX: Surprisingly, it appears that this may be
more expensive than just faulting the pages
normally. This needs more investivation. */
- if (ADDR_IS_VOID (target_as_addr)
- && cap_types_compatible (target->type, cap_page)
- && CAP_GUARD_BITS (target) == 0
- && addr_depth (target_addr) == ADDR_BITS - PAGESIZE_LOG2)
+ if (VG_ADDR_IS_VOID (target_as_addr)
+ && vg_cap_types_compatible (target->type, vg_cap_page)
+ && VG_CAP_GUARD_BITS (target) == 0
+ && vg_addr_depth (target_addr) == VG_ADDR_BITS - PAGESIZE_LOG2)
/* The target address space is the caller's. The target
object appears to be a page. It seems to be
installed at a point where it would appear in the
hardware address space. If this is really the case,
then we can map it now and save a fault later. */
{
- profile_region ("cap_copy-prefault");
+ profile_region ("vg_cap_copy-prefault");
- struct cap cap = *target;
- if (target->type == cap_rpage)
+ struct vg_cap cap = *target;
+ if (target->type == vg_cap_rpage)
cap.discardable = false;
struct object *page = cap_to_object_soft (principal, &cap);
@@ -1365,11 +1365,11 @@ server_loop (void)
l4_fpage_t fpage
= l4_fpage ((uintptr_t) page, PAGESIZE);
fpage = l4_fpage_add_rights (fpage, L4_FPAGE_READABLE);
- if (cap.type == cap_page)
+ if (cap.type == vg_cap_page)
fpage = l4_fpage_add_rights (fpage,
L4_FPAGE_WRITABLE);
- uintptr_t page_addr = addr_prefix (target_addr);
+ uintptr_t page_addr = vg_addr_prefix (target_addr);
l4_map_item_t map_item = l4_map_item (fpage, page_addr);
@@ -1385,19 +1385,19 @@ server_loop (void)
case RM_cap_rubout:
{
- addr_t addr;
+ vg_addr_t addr;
err = rm_cap_rubout_send_unmarshal (message, &addr, NULL);
if (err)
REPLY (err);
- DEBUG (4, ADDR_FMT "@" ADDR_FMT,
- ADDR_PRINTF (target_messenger),
- ADDR_PRINTF (addr));
+ DEBUG (4, VG_ADDR_FMT "@" VG_ADDR_FMT,
+ VG_ADDR_PRINTF (target_messenger),
+ VG_ADDR_PRINTF (addr));
/* We don't look up the argument directly as we need to
respect any subpage specification for cappages. */
- struct cap *slot = SLOT (target_root, addr);
+ struct vg_cap *slot = SLOT (target_root, addr);
cap_shootdown (principal, slot);
@@ -1409,53 +1409,53 @@ server_loop (void)
case RM_cap_read:
{
- addr_t cap_addr;
+ vg_addr_t cap_addr;
err = rm_cap_read_send_unmarshal (message, &cap_addr, NULL);
if (err)
REPLY (err);
- DEBUG (4, ADDR_FMT "@" ADDR_FMT,
- ADDR_PRINTF (target_messenger), ADDR_PRINTF (cap_addr));
+ DEBUG (4, VG_ADDR_FMT "@" VG_ADDR_FMT,
+ VG_ADDR_PRINTF (target_messenger), VG_ADDR_PRINTF (cap_addr));
- struct cap cap = CAP (target_root, cap_addr, -1, false);
+ struct vg_cap cap = CAP (target_root, cap_addr, -1, false);
/* Even if CAP.TYPE is not void, the cap may not designate
an object. Looking up the object will set CAP.TYPE to
- cap_void if this is the case. */
- if (cap.type != cap_void)
- cap_to_object (principal, &cap);
+ vg_cap_void if this is the case. */
+ if (cap.type != vg_cap_void)
+ vg_cap_to_object (principal, &cap);
rm_cap_read_reply (activity, reply, cap.type,
- CAP_PROPERTIES_GET (cap));
+ VG_CAP_PROPERTIES_GET (cap));
break;
}
case RM_object_discarded_clear:
{
- addr_t object_addr;
+ vg_addr_t object_addr;
err = rm_object_discarded_clear_send_unmarshal
(message, &object_addr, NULL);
if (err)
REPLY (err);
- DEBUG (4, ADDR_FMT, ADDR_PRINTF (object_addr));
+ DEBUG (4, VG_ADDR_FMT, VG_ADDR_PRINTF (object_addr));
/* We can't look up the object use OBJECT as object_lookup
returns NULL if the object's discardable bit is set!
Instead, we lookup the capability, find the object's
folio and then clear its discarded bit. */
- struct cap cap = CAP (&thread->aspace, object_addr, -1, true);
- if (cap.type == cap_void)
+ struct vg_cap cap = CAP (&thread->aspace, object_addr, -1, true);
+ if (cap.type == vg_cap_void)
REPLY (ENOENT);
- if (cap_type_weak_p (cap.type))
+ if (vg_cap_type_weak_p (cap.type))
REPLY (EPERM);
- int idx = (cap.oid % (1 + FOLIO_OBJECTS)) - 1;
- oid_t foid = cap.oid - idx - 1;
+ int idx = (cap.oid % (1 + VG_FOLIO_OBJECTS)) - 1;
+ vg_oid_t foid = cap.oid - idx - 1;
struct folio *folio = (struct folio *)
- object_find (activity, foid, OBJECT_POLICY_VOID);
+ object_find (activity, foid, VG_OBJECT_POLICY_VOID);
if (folio_object_version (folio, idx) != cap.version)
REPLY (ENOENT);
@@ -1470,9 +1470,9 @@ server_loop (void)
expensive than just faulting the pages normally. This
needs more investivation. */
if (was_discarded
- && cap.type == cap_page
- && CAP_GUARD_BITS (&cap) == 0
- && (addr_depth (object_addr) == ADDR_BITS - PAGESIZE_LOG2))
+ && cap.type == vg_cap_page
+ && VG_CAP_GUARD_BITS (&cap) == 0
+ && (vg_addr_depth (object_addr) == VG_ADDR_BITS - PAGESIZE_LOG2))
/* The target object was discarded, appears to be a page
and seems to be installed at a point where it would
appear in the hardware address space. If this is
@@ -1481,7 +1481,7 @@ server_loop (void)
{
profile_region ("object_discard-prefault");
- struct object *page = cap_to_object (principal, &cap);
+ struct object *page = vg_cap_to_object (principal, &cap);
if (page)
{
object_to_object_desc (page)->mapped = true;
@@ -1491,14 +1491,14 @@ server_loop (void)
L4_FPAGE_READABLE
| L4_FPAGE_WRITABLE);
- uintptr_t page_addr = addr_prefix (object_addr);
+ uintptr_t page_addr = vg_addr_prefix (object_addr);
l4_map_item_t map_item = l4_map_item (fpage, page_addr);
l4_msg_append_map_item (msg, map_item);
- DEBUG (4, "Prefaulting "ADDR_FMT"(%x) <- %p (%x/%x/%x)",
- ADDR_PRINTF (object_addr), page_addr,
+ DEBUG (4, "Prefaulting "VG_ADDR_FMT"(%x) <- %p (%x/%x/%x)",
+ VG_ADDR_PRINTF (object_addr), page_addr,
page, l4_address (fpage), l4_size (fpage),
l4_rights (fpage));
}
@@ -1516,7 +1516,7 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, ADDR_FMT, ADDR_PRINTF (target_messenger));
+ DEBUG (4, VG_ADDR_FMT, VG_ADDR_PRINTF (target_messenger));
struct folio *folio = objects_folio (principal, target);
@@ -1534,8 +1534,8 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, ADDR_FMT ", %sclear",
- ADDR_PRINTF (target_messenger), clear ? "" : "no ");
+ DEBUG (4, VG_ADDR_FMT ", %sclear",
+ VG_ADDR_PRINTF (target_messenger), clear ? "" : "no ");
struct object_desc *desc = object_to_object_desc (target);
uintptr_t status = (desc->user_referenced ? object_referenced : 0)
@@ -1556,14 +1556,14 @@ server_loop (void)
struct object_name name;
err = rm_object_name_send_unmarshal (message, &name, NULL);
- if (object_type (target) == cap_activity_control)
+ if (object_type (target) == vg_cap_activity_control)
{
struct activity *a = (struct activity *) target;
memcpy (a->name.name, name.name, sizeof (name));
a->name.name[sizeof (a->name.name) - 1] = 0;
}
- else if (object_type (target) == cap_thread)
+ else if (object_type (target) == vg_cap_thread)
{
struct thread *t = (struct thread *) target;
@@ -1577,16 +1577,16 @@ server_loop (void)
case RM_thread_exregs:
{
- if (object_type (target) != cap_thread)
+ if (object_type (target) != vg_cap_thread)
REPLY (EINVAL);
struct thread *t = (struct thread *) target;
struct hurd_thread_exregs_in in;
uintptr_t control;
- addr_t aspace_addr;
- addr_t activity_addr;
- addr_t utcb_addr;
- addr_t exception_messenger_addr;
+ vg_addr_t aspace_addr;
+ vg_addr_t activity_addr;
+ vg_addr_t utcb_addr;
+ vg_addr_t exception_messenger_addr;
err = rm_thread_exregs_send_unmarshal
(message, &control, &in,
&aspace_addr, &activity_addr, &utcb_addr,
@@ -1596,10 +1596,10 @@ server_loop (void)
REPLY (err);
int d = 4;
- DEBUG (d, "%s%s" ADDR_FMT "(%x): %s%s%s%s %s%s%s%s %s%s%s %s%s",
+ DEBUG (d, "%s%s" VG_ADDR_FMT "(%x): %s%s%s%s %s%s%s%s %s%s%s %s%s",
t->name.name[0] ? t->name.name : "",
t->name.name[0] ? ": " : "",
- ADDR_PRINTF (target_messenger), t->tid,
+ VG_ADDR_PRINTF (target_messenger), t->tid,
(control & HURD_EXREGS_SET_UTCB) ? "U" : "-",
(control & HURD_EXREGS_SET_EXCEPTION_MESSENGER) ? "E" : "-",
(control & HURD_EXREGS_SET_ASPACE) ? "R" : "-",
@@ -1615,14 +1615,14 @@ server_loop (void)
(control & _L4_XCHG_REGS_SET_HALT) ? "Y" : "N");
if ((control & HURD_EXREGS_SET_UTCB))
- DEBUG (d, "utcb: " ADDR_FMT, ADDR_PRINTF (utcb_addr));
+ DEBUG (d, "utcb: " VG_ADDR_FMT, VG_ADDR_PRINTF (utcb_addr));
if ((control & HURD_EXREGS_SET_EXCEPTION_MESSENGER))
- DEBUG (d, "exception messenger: " ADDR_FMT,
- ADDR_PRINTF (exception_messenger_addr));
+ DEBUG (d, "exception messenger: " VG_ADDR_FMT,
+ VG_ADDR_PRINTF (exception_messenger_addr));
if ((control & HURD_EXREGS_SET_ASPACE))
- DEBUG (d, "aspace: " ADDR_FMT, ADDR_PRINTF (aspace_addr));
+ DEBUG (d, "aspace: " VG_ADDR_FMT, VG_ADDR_PRINTF (aspace_addr));
if ((control & HURD_EXREGS_SET_ACTIVITY))
- DEBUG (d, "activity: " ADDR_FMT, ADDR_PRINTF (activity_addr));
+ DEBUG (d, "activity: " VG_ADDR_FMT, VG_ADDR_PRINTF (activity_addr));
if ((control & HURD_EXREGS_SET_SP))
DEBUG (d, "sp: %p", (void *) in.sp);
if ((control & HURD_EXREGS_SET_IP))
@@ -1632,35 +1632,35 @@ server_loop (void)
if ((control & HURD_EXREGS_SET_USER_HANDLE))
DEBUG (d, "user_handle: %p", (void *) in.user_handle);
- struct cap aspace = CAP_VOID;
+ struct vg_cap aspace = VG_CAP_VOID;
if ((HURD_EXREGS_SET_ASPACE & control))
aspace = CAP (&thread->aspace, aspace_addr, -1, false);
- struct cap a = CAP_VOID;
+ struct vg_cap a = VG_CAP_VOID;
if ((HURD_EXREGS_SET_ACTIVITY & control))
{
/* XXX: Remove this hack... */
- if (ADDR_IS_VOID (activity_addr))
+ if (VG_ADDR_IS_VOID (activity_addr))
a = thread->activity;
else
a = CAP (&thread->aspace,
- activity_addr, cap_activity, false);
+ activity_addr, vg_cap_activity, false);
}
- struct cap utcb = CAP_VOID;
+ struct vg_cap utcb = VG_CAP_VOID;
if ((HURD_EXREGS_SET_UTCB & control))
- utcb = CAP (&thread->aspace, utcb_addr, cap_page, true);
+ utcb = CAP (&thread->aspace, utcb_addr, vg_cap_page, true);
- struct cap exception_messenger = CAP_VOID;
+ struct vg_cap exception_messenger = VG_CAP_VOID;
if ((HURD_EXREGS_SET_EXCEPTION_MESSENGER & control))
exception_messenger
= CAP (&thread->aspace, exception_messenger_addr,
- cap_rmessenger, false);
+ vg_cap_rmessenger, false);
- struct cap aspace_out = thread->aspace;
- struct cap activity_out = thread->activity;
- struct cap utcb_out = thread->utcb;
- struct cap exception_messenger_out = thread->exception_messenger;
+ struct vg_cap aspace_out = thread->aspace;
+ struct vg_cap activity_out = thread->activity;
+ struct vg_cap utcb_out = thread->utcb;
+ struct vg_cap exception_messenger_out = thread->exception_messenger;
struct hurd_thread_exregs_out out;
out.sp = in.sp;
@@ -1686,7 +1686,7 @@ server_loop (void)
case RM_thread_id:
{
- if (object_type (target) != cap_thread)
+ if (object_type (target) != vg_cap_thread)
REPLY (EINVAL);
struct thread *t = (struct thread *) target;
@@ -1705,7 +1705,7 @@ server_loop (void)
if (err)
REPLY (err);
- DEBUG (4, ADDR_FMT, ADDR_PRINTF (target_messenger));
+ DEBUG (4, VG_ADDR_FMT, VG_ADDR_PRINTF (target_messenger));
reply->wait_reason = MESSENGER_WAIT_DESTROY;
object_wait_queue_enqueue (principal, target, reply);
@@ -1715,10 +1715,10 @@ server_loop (void)
case RM_activity_policy:
{
- if (object_type (target) != cap_activity_control)
+ if (object_type (target) != vg_cap_activity_control)
{
DEBUG (0, "expects an activity, not a %s",
- cap_type_string (object_type (target)));
+ vg_cap_type_string (object_type (target)));
REPLY (EINVAL);
}
struct activity *activity = (struct activity *) target;
@@ -1734,50 +1734,50 @@ server_loop (void)
int d = 4;
DEBUG (d, "(%s) child: %s%s; sibling: %s%s; storage: %s",
target_writable ? "strong" : "weak",
- (flags & ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET) ? "P" : "-",
- (flags & ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET) ? "W" : "-",
- (flags & ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET)
+ (flags & VG_ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET) ? "P" : "-",
+ (flags & VG_ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET) ? "W" : "-",
+ (flags & VG_ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET)
? "P" : "-",
- (flags & ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET) ? "W" : "-",
- (flags & ACTIVITY_POLICY_STORAGE_SET) ? "P" : "-");
+ (flags & VG_ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET) ? "W" : "-",
+ (flags & VG_ACTIVITY_POLICY_STORAGE_SET) ? "P" : "-");
- if ((flags & ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET))
+ if ((flags & VG_ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET))
DEBUG (d, "Child priority: %d", in.child_rel.priority);
- if ((flags & ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET))
+ if ((flags & VG_ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET))
DEBUG (d, "Child weight: %d", in.child_rel.weight);
- if ((flags & ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET))
+ if ((flags & VG_ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET))
DEBUG (d, "Sibling priority: %d", in.sibling_rel.priority);
- if ((flags & ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET))
+ if ((flags & VG_ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET))
DEBUG (d, "Sibling weight: %d", in.sibling_rel.weight);
- if ((flags & ACTIVITY_POLICY_STORAGE_SET))
+ if ((flags & VG_ACTIVITY_POLICY_STORAGE_SET))
DEBUG (d, "Storage: %d", in.folios);
if (! target_writable
- && (flags & (ACTIVITY_POLICY_STORAGE_SET
- | ACTIVITY_POLICY_SIBLING_REL_SET)))
+ && (flags & (VG_ACTIVITY_POLICY_STORAGE_SET
+ | VG_ACTIVITY_POLICY_SIBLING_REL_SET)))
REPLY (EPERM);
rm_activity_policy_reply (principal, reply, activity->policy);
- if ((flags & (ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET
- | ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET
- | ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET
- | ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET
- | ACTIVITY_POLICY_STORAGE_SET)))
+ if ((flags & (VG_ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET
+ | VG_ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET
+ | VG_ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET
+ | VG_ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET
+ | VG_ACTIVITY_POLICY_STORAGE_SET)))
{
struct activity_policy p = principal->policy;
- if ((flags & ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET))
+ if ((flags & VG_ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET))
p.child_rel.priority = in.child_rel.priority;
- if ((flags & ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET))
+ if ((flags & VG_ACTIVITY_POLICY_CHILD_REL_WEIGHT_SET))
p.child_rel.weight = in.child_rel.weight;
- if ((flags & ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET))
+ if ((flags & VG_ACTIVITY_POLICY_SIBLING_REL_PRIORITY_SET))
p.sibling_rel.priority = in.sibling_rel.priority;
- if ((flags & ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET))
+ if ((flags & VG_ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET))
p.sibling_rel.weight = in.sibling_rel.weight;
- if ((flags & ACTIVITY_POLICY_STORAGE_SET))
+ if ((flags & VG_ACTIVITY_POLICY_STORAGE_SET))
p.folios = in.folios;
activity_policy_update (activity, p);
@@ -1788,7 +1788,7 @@ server_loop (void)
case RM_activity_info:
{
- if (object_type (target) != cap_activity_control)
+ if (object_type (target) != vg_cap_activity_control)
REPLY (EINVAL);
struct activity *activity = (struct activity *) target;
@@ -1855,7 +1855,7 @@ server_loop (void)
case RM_thread_activation_collect:
{
- if (object_type (target) != cap_thread)
+ if (object_type (target) != vg_cap_thread)
REPLY (EINVAL);
err = rm_thread_activation_collect_send_unmarshal (message, NULL);
@@ -1903,7 +1903,7 @@ server_loop (void)
err = rm_futex_reply (principal, m, 0);
if (err)
- panic ("Error futex waking: %d", err);
+ panic ("Error vg_futex waking: %d", err);
count ++;
@@ -1962,8 +1962,8 @@ server_loop (void)
char *mode = "unknown";
- struct object *page = cap_to_object (principal, &thread->utcb);
- if (page && object_type (page) == cap_page)
+ struct object *page = vg_cap_to_object (principal, &thread->utcb);
+ if (page && object_type (page) == vg_cap_page)
{
struct vg_utcb *utcb = (struct vg_utcb *) page;
@@ -1989,9 +1989,9 @@ server_loop (void)
REPLY (ENOSYS);
};
- addr_t addr = addr_chop (PTR_TO_ADDR (addr1), PAGESIZE_LOG2);
+ vg_addr_t addr = vg_addr_chop (VG_PTR_TO_ADDR (addr1), PAGESIZE_LOG2);
struct object *object1 = OBJECT (&thread->aspace,
- addr, cap_page, true, NULL);
+ addr, vg_cap_page, true, NULL);
int offset1 = (uintptr_t) addr1 & (PAGESIZE - 1);
int *vaddr1 = (void *) object1 + offset1;
@@ -2028,9 +2028,9 @@ server_loop (void)
break;
case FUTEX_WAKE_OP:
- addr = addr_chop (PTR_TO_ADDR (addr2), PAGESIZE_LOG2);
+ addr = vg_addr_chop (VG_PTR_TO_ADDR (addr2), PAGESIZE_LOG2);
struct object *object2 = OBJECT (&thread->aspace,
- addr, cap_page, true, NULL);
+ addr, vg_cap_page, true, NULL);
int offset2 = (uintptr_t) addr2 & (PAGESIZE - 1);
int *vaddr2 = (void *) object2 + offset2;
@@ -2096,8 +2096,8 @@ server_loop (void)
REPLY (EAGAIN);
/* Get the second object. */
- addr = addr_chop (PTR_TO_ADDR (addr2), PAGESIZE_LOG2);
- object2 = OBJECT (&thread->aspace, addr, cap_page, true, NULL);
+ addr = vg_addr_chop (VG_PTR_TO_ADDR (addr2), PAGESIZE_LOG2);
+ object2 = OBJECT (&thread->aspace, addr, vg_cap_page, true, NULL);
offset2 = (uintptr_t) addr2 & (PAGESIZE - 1);
count = wake (val1, object1, offset1,
@@ -2111,7 +2111,7 @@ server_loop (void)
case VG_messenger_id:
{
- if (object_type (target) != cap_messenger || ! target_writable)
+ if (object_type (target) != vg_cap_messenger || ! target_writable)
REPLY (EINVAL);
struct messenger *m = (struct messenger *) target;
diff --git a/viengoos/t-activity.c b/viengoos/t-activity.c
index f6a44fa..371bf81 100644
--- a/viengoos/t-activity.c
+++ b/viengoos/t-activity.c
@@ -17,21 +17,21 @@ static struct folio *folio;
static int object;
static struct as_allocate_pt_ret
-allocate_object (enum cap_type type, addr_t addr)
+allocate_object (enum vg_cap_type type, vg_addr_t addr)
{
- if (! folio || object == FOLIO_OBJECTS)
+ if (! folio || object == VG_FOLIO_OBJECTS)
{
- folio = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT);
+ folio = folio_alloc (root_activity, VG_FOLIO_POLICY_DEFAULT);
object = 0;
}
struct as_allocate_pt_ret rt;
rt.cap = folio_object_alloc (root_activity, folio, object ++,
- type, OBJECT_POLICY_DEFAULT, 0);
+ type, VG_OBJECT_POLICY_DEFAULT, 0);
/* We don't need to set RT.STORAGE as as_insert doesn't require it
for the internal interface implementations. */
- rt.storage = ADDR (0, 0);
+ rt.storage = VG_ADDR (0, 0);
return rt;
}
@@ -49,12 +49,12 @@ test (void)
object_init ();
/* Create the root activity. */
- folio = folio_alloc (NULL, FOLIO_POLICY_DEFAULT);
+ folio = folio_alloc (NULL, VG_FOLIO_POLICY_DEFAULT);
if (! folio)
panic ("Failed to allocate storage for the initial task!");
- struct cap c = allocate_object (cap_activity_control, ADDR_VOID).cap;
- root_activity = (struct activity *) cap_to_object (root_activity, &c);
+ struct vg_cap c = allocate_object (vg_cap_activity_control, VG_ADDR_VOID).cap;
+ root_activity = (struct activity *) vg_cap_to_object (root_activity, &c);
folio_parent (root_activity, folio);
@@ -74,20 +74,20 @@ test (void)
for (i = 0; i < N; i ++)
{
/* Allocate a new activity. */
- struct cap cap;
+ struct vg_cap cap;
cap = folio_object_alloc (activity, folio, obj ++,
- cap_activity_control,
- OBJECT_POLICY_DEFAULT, 0);
- a[i].child = (struct activity *) cap_to_object (activity, &cap);
+ vg_cap_activity_control,
+ VG_OBJECT_POLICY_DEFAULT, 0);
+ a[i].child = (struct activity *) vg_cap_to_object (activity, &cap);
/* Allocate a folio against the activity and use it. */
- a[i].folio = folio_alloc (a[i].child, FOLIO_POLICY_DEFAULT);
+ a[i].folio = folio_alloc (a[i].child, VG_FOLIO_POLICY_DEFAULT);
assert (a[i].folio);
cap = folio_object_alloc (a[i].child, a[i].folio, 0,
- cap_page, OBJECT_POLICY_DEFAULT, 0);
- a[i].page = cap_to_object (activity, &cap);
- assert (object_type (a[i].page) == cap_page);
+ vg_cap_page, VG_OBJECT_POLICY_DEFAULT, 0);
+ a[i].page = vg_cap_to_object (activity, &cap);
+ assert (object_type (a[i].page) == vg_cap_page);
}
if (depth > 0)
@@ -99,14 +99,14 @@ test (void)
destroy the rest. */
for (i = 0; i < N / 2; i ++)
{
- struct cap cap = object_to_cap (a[i].page);
- struct object *o = cap_to_object (activity, &cap);
+ struct vg_cap cap = object_to_cap (a[i].page);
+ struct object *o = vg_cap_to_object (activity, &cap);
assert (o == a[i].page);
/* Destroy the activity. */
folio_free (activity, a[i].folio);
- o = cap_to_object (activity, &cap);
+ o = vg_cap_to_object (activity, &cap);
assert (! o);
}
}
@@ -114,7 +114,7 @@ test (void)
int i;
for (i = 0; i < 10; i ++)
{
- struct folio *f = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT);
+ struct folio *f = folio_alloc (root_activity, VG_FOLIO_POLICY_DEFAULT);
assert (f);
try (root_activity, f, 4);
diff --git a/viengoos/t-as.c b/viengoos/t-as.c
index 75fbfaa..ffb061f 100644
--- a/viengoos/t-as.c
+++ b/viengoos/t-as.c
@@ -17,28 +17,28 @@ static struct folio *folio;
static int object;
static struct as_allocate_pt_ret
-allocate_object (enum cap_type type, addr_t addr)
+allocate_object (enum vg_cap_type type, vg_addr_t addr)
{
- if (! folio || object == FOLIO_OBJECTS)
+ if (! folio || object == VG_FOLIO_OBJECTS)
{
- folio = folio_alloc (root_activity, FOLIO_POLICY_DEFAULT);
+ folio = folio_alloc (root_activity, VG_FOLIO_POLICY_DEFAULT);
object = 0;
}
struct as_allocate_pt_ret rt;
rt.cap = folio_object_alloc (root_activity, folio, object ++,
- type, OBJECT_POLICY_DEFAULT, 0);
+ type, VG_OBJECT_POLICY_DEFAULT, 0);
/* We don't need to set RT.STORAGE as as_insert doesn't require it
for the internal interface implementations. */
- rt.storage = ADDR (0, 0);
+ rt.storage = VG_ADDR (0, 0);
return rt;
}
static struct as_allocate_pt_ret
-allocate_page_table (addr_t addr)
+allocate_page_table (vg_addr_t addr)
{
- return allocate_object (cap_cappage, addr);
+ return allocate_object (vg_cap_cappage, addr);
}
extern char _start;
@@ -46,17 +46,17 @@ extern char _end;
struct alloc
{
- addr_t addr;
+ vg_addr_t addr;
int type;
};
static void
try (struct alloc *allocs, int count, bool dump)
{
- struct cap aspace = { .type = cap_void };
- struct cap caps[count];
+ struct vg_cap aspace = { .type = vg_cap_void };
+ struct vg_cap caps[count];
- void do_check (struct cap *cap, bool writable, int i, bool present)
+ void do_check (struct vg_cap *cap, bool writable, int i, bool present)
{
if (present)
{
@@ -64,24 +64,24 @@ try (struct alloc *allocs, int count, bool dump)
assert (cap->type == caps[i].type);
- struct object *object = cap_to_object (root_activity, cap);
+ struct object *object = vg_cap_to_object (root_activity, cap);
struct object_desc *odesc = object_to_object_desc (object);
- if (caps[i].type != cap_void)
+ if (caps[i].type != vg_cap_void)
assert (odesc->oid == caps[i].oid);
- if (cap->type == cap_page)
+ if (cap->type == vg_cap_page)
assert (* (unsigned char *) object == i);
}
else
{
if (cap)
{
- struct object *object = cap_to_object (root_activity, cap);
+ struct object *object = vg_cap_to_object (root_activity, cap);
assert (! object);
/* This assertion relies on the fact that the
implementation will clear the type field on a failed
lookup. */
- assert (cap->type == cap_void);
+ assert (cap->type == vg_cap_void);
}
}
}
@@ -91,43 +91,43 @@ try (struct alloc *allocs, int count, bool dump)
{
switch (allocs[i].type)
{
- case cap_folio:
+ case vg_cap_folio:
caps[i] = object_to_cap ((struct object *)
folio_alloc (root_activity,
- FOLIO_POLICY_DEFAULT));
+ VG_FOLIO_POLICY_DEFAULT));
break;
- case cap_void:
- caps[i].type = cap_void;
+ case vg_cap_void:
+ caps[i].type = vg_cap_void;
break;
- case cap_page:
- case cap_rpage:
- case cap_cappage:
- case cap_rcappage:
+ case vg_cap_page:
+ case vg_cap_rpage:
+ case vg_cap_cappage:
+ case vg_cap_rcappage:
caps[i] = allocate_object (allocs[i].type, allocs[i].addr).cap;
break;
default:
assert (! " Bad type");
}
- struct object *object = cap_to_object (root_activity, &caps[i]);
- if (caps[i].type == cap_page)
+ struct object *object = vg_cap_to_object (root_activity, &caps[i]);
+ if (caps[i].type == vg_cap_page)
memset (object, i, PAGESIZE);
- as_insert_full (root_activity, ADDR_VOID, &aspace, allocs[i].addr,
- ADDR_VOID, ADDR_VOID, object_to_cap (object),
+ as_insert_full (root_activity, VG_ADDR_VOID, &aspace, allocs[i].addr,
+ VG_ADDR_VOID, VG_ADDR_VOID, object_to_cap (object),
allocate_page_table);
if (dump)
{
- printf ("After inserting: " ADDR_FMT "\n",
- ADDR_PRINTF (allocs[i].addr));
+ printf ("After inserting: " VG_ADDR_FMT "\n",
+ VG_ADDR_PRINTF (allocs[i].addr));
as_dump_from (root_activity, &aspace, NULL);
}
int j;
for (j = 0; j < count; j ++)
{
- struct cap *cap = NULL;
+ struct vg_cap *cap = NULL;
bool w;
as_slot_lookup_rel_use
@@ -138,7 +138,7 @@ try (struct alloc *allocs, int count, bool dump)
}));
do_check (cap, w, j, j <= i);
- struct cap c;
+ struct vg_cap c;
c = as_object_lookup_rel (root_activity,
&aspace, allocs[j].addr, -1,
&w);
@@ -150,7 +150,7 @@ try (struct alloc *allocs, int count, bool dump)
for (i = 0; i < count; i ++)
{
/* Make sure allocs[i].addr maps to PAGES[i]. */
- struct cap *cap = NULL;
+ struct vg_cap *cap = NULL;
bool w;
as_slot_lookup_rel_use (root_activity, &aspace, allocs[i].addr,
@@ -160,7 +160,7 @@ try (struct alloc *allocs, int count, bool dump)
}));
do_check (cap, w, i, true);
- struct cap c;
+ struct vg_cap c;
c = as_object_lookup_rel (root_activity,
&aspace, allocs[i].addr, -1,
&w);
@@ -169,13 +169,13 @@ try (struct alloc *allocs, int count, bool dump)
/* Void the capability in the returned capability slot. */
as_slot_lookup_rel_use (root_activity, &aspace, allocs[i].addr,
({
- slot->type = cap_void;
+ slot->type = vg_cap_void;
}));
/* The page should no longer be found. */
c = as_object_lookup_rel (root_activity, &aspace, allocs[i].addr, -1,
NULL);
- assert (c.type == cap_void);
+ assert (c.type == vg_cap_void);
/* Restore the capability slot. */
as_slot_lookup_rel_use (root_activity, &aspace, allocs[i].addr,
@@ -201,15 +201,15 @@ try (struct alloc *allocs, int count, bool dump)
/* Finally, free the object. */
switch (caps[i].type)
{
- case cap_folio:
+ case vg_cap_folio:
folio_free (root_activity,
- (struct folio *) cap_to_object (root_activity,
+ (struct folio *) vg_cap_to_object (root_activity,
&caps[i]));
break;
- case cap_void:
+ case vg_cap_void:
break;
default:
- object_free (root_activity, cap_to_object (root_activity, &caps[i]));
+ object_free (root_activity, vg_cap_to_object (root_activity, &caps[i]));
break;
}
@@ -225,7 +225,7 @@ try (struct alloc *allocs, int count, bool dump)
}));
assert (ret);
- struct cap c;
+ struct vg_cap c;
bool writable;
c = as_object_lookup_rel (root_activity,
&aspace, allocs[j].addr, -1, &writable);
@@ -245,12 +245,12 @@ test (void)
object_init ();
/* Create the root activity. */
- folio = folio_alloc (NULL, FOLIO_POLICY_DEFAULT);
+ folio = folio_alloc (NULL, VG_FOLIO_POLICY_DEFAULT);
if (! folio)
panic ("Failed to allocate storage for the initial task!");
- struct cap c = allocate_object (cap_activity_control, ADDR_VOID).cap;
- root_activity = (struct activity *) cap_to_object (root_activity, &c);
+ struct vg_cap c = allocate_object (vg_cap_activity_control, VG_ADDR_VOID).cap;
+ root_activity = (struct activity *) vg_cap_to_object (root_activity, &c);
folio_parent (root_activity, folio);
@@ -260,20 +260,20 @@ test (void)
/* We have an empty address space. When we use slot_lookup_rel
and specify that we don't care what type of capability we get,
we should get the capability slot--if the guard is right. */
- struct cap aspace = { type: cap_void };
+ struct vg_cap aspace = { type: vg_cap_void };
l4_word_t addr = 0xFA000;
bool ret = as_slot_lookup_rel_use (root_activity,
- &aspace, ADDR (addr, ADDR_BITS),
+ &aspace, VG_ADDR (addr, VG_ADDR_BITS),
({ }));
assert (! ret);
- /* Set the root to designate ADDR. */
- bool r = CAP_SET_GUARD (&aspace, addr, ADDR_BITS);
+ /* Set the root to designate VG_ADDR. */
+ bool r = VG_CAP_SET_GUARD (&aspace, addr, VG_ADDR_BITS);
assert (r);
ret = as_slot_lookup_rel_use (root_activity,
- &aspace, ADDR (addr, ADDR_BITS),
+ &aspace, VG_ADDR (addr, VG_ADDR_BITS),
({
assert (slot == &aspace);
assert (writable);
@@ -286,30 +286,30 @@ test (void)
printf ("Checking as_insert... ");
{
struct alloc allocs[] =
- { { ADDR (1 << (FOLIO_OBJECTS_LOG2 + PAGESIZE_LOG2),
- ADDR_BITS - FOLIO_OBJECTS_LOG2 - PAGESIZE_LOG2), cap_folio },
- { ADDR (0x100000003, 63), cap_page },
- { ADDR (0x100000004, 63), cap_page },
- { ADDR (0x1000 /* 4k. */, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x00100000 /* 1MB */, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x01000000 /* 16MB */, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x10000000 /* 256MB */, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40000000 /* 1000MB */, ADDR_BITS - PAGESIZE_LOG2),
- cap_page },
- { ADDR (0x40000000 - 0x2000 /* 1000MB - 4k */,
- ADDR_BITS - PAGESIZE_LOG2),
- cap_page },
- { ADDR (0x40001000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40003000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40002000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40009000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40008000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40007000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x40006000, ADDR_BITS - PAGESIZE_LOG2), cap_page },
- { ADDR (0x00101000 /* 1MB + 4k. */, ADDR_BITS - PAGESIZE_LOG2),
- cap_page },
- { ADDR (0x00FF0000 /* 1MB - 4k. */, ADDR_BITS - PAGESIZE_LOG2),
- cap_page },
+ { { VG_ADDR (1 << (VG_FOLIO_OBJECTS_LOG2 + PAGESIZE_LOG2),
+ VG_ADDR_BITS - VG_FOLIO_OBJECTS_LOG2 - PAGESIZE_LOG2), vg_cap_folio },
+ { VG_ADDR (0x100000003, 63), vg_cap_page },
+ { VG_ADDR (0x100000004, 63), vg_cap_page },
+ { VG_ADDR (0x1000 /* 4k. */, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x00100000 /* 1MB */, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x01000000 /* 16MB */, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x10000000 /* 256MB */, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40000000 /* 1000MB */, VG_ADDR_BITS - PAGESIZE_LOG2),
+ vg_cap_page },
+ { VG_ADDR (0x40000000 - 0x2000 /* 1000MB - 4k */,
+ VG_ADDR_BITS - PAGESIZE_LOG2),
+ vg_cap_page },
+ { VG_ADDR (0x40001000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40003000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40002000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40009000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40008000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40007000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x40006000, VG_ADDR_BITS - PAGESIZE_LOG2), vg_cap_page },
+ { VG_ADDR (0x00101000 /* 1MB + 4k. */, VG_ADDR_BITS - PAGESIZE_LOG2),
+ vg_cap_page },
+ { VG_ADDR (0x00FF0000 /* 1MB - 4k. */, VG_ADDR_BITS - PAGESIZE_LOG2),
+ vg_cap_page },
};
try (allocs, sizeof (allocs) / sizeof (allocs[0]), false);
@@ -317,14 +317,14 @@ test (void)
{
struct alloc allocs[] =
- { { ADDR (1, ADDR_BITS), cap_page },
- { ADDR (2, ADDR_BITS), cap_page },
- { ADDR (3, ADDR_BITS), cap_page },
- { ADDR (4, ADDR_BITS), cap_page },
- { ADDR (5, ADDR_BITS), cap_page },
- { ADDR (6, ADDR_BITS), cap_page },
- { ADDR (7, ADDR_BITS), cap_page },
- { ADDR (8, ADDR_BITS), cap_page }
+ { { VG_ADDR (1, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (2, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (3, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (4, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (5, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (6, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (7, VG_ADDR_BITS), vg_cap_page },
+ { VG_ADDR (8, VG_ADDR_BITS), vg_cap_page }
};
try (allocs, sizeof (allocs) / sizeof (allocs[0]), false);
@@ -333,8 +333,8 @@ test (void)
{
/* Induce a long different guard. */
struct alloc allocs[] =
- { { ADDR (0x100000000, 51), cap_cappage },
- { ADDR (0x80000, 44), cap_folio }
+ { { VG_ADDR (0x100000000, 51), vg_cap_cappage },
+ { VG_ADDR (0x80000, 44), vg_cap_folio }
};
try (allocs, sizeof (allocs) / sizeof (allocs[0]), false);
@@ -343,10 +343,10 @@ test (void)
{
/* Induce subpage allocation. */
struct alloc allocs[] =
- { { ADDR (0x80000, 44), cap_folio },
- { ADDR (0x1000, 51), cap_page },
- { ADDR (0x10000, 51), cap_page },
- { ADDR (0x2000, 51), cap_page }
+ { { VG_ADDR (0x80000, 44), vg_cap_folio },
+ { VG_ADDR (0x1000, 51), vg_cap_page },
+ { VG_ADDR (0x10000, 51), vg_cap_page },
+ { VG_ADDR (0x2000, 51), vg_cap_page }
};
try (allocs, sizeof (allocs) / sizeof (allocs[0]), false);
@@ -371,13 +371,13 @@ test (void)
would be used to point to the folio and the second to the
smaller cappage. */
struct alloc allocs[] =
- { { ADDR (0x80000, 51), cap_page },
- { ADDR (0x81000, 51), cap_page },
- { ADDR (0x82000, 51), cap_page },
- { ADDR (0x83000, 51), cap_page },
- { ADDR (0x84000, 51), cap_page },
- { ADDR (0x85000, 51), cap_page },
- { ADDR (0x0, 44), cap_folio }
+ { { VG_ADDR (0x80000, 51), vg_cap_page },
+ { VG_ADDR (0x81000, 51), vg_cap_page },
+ { VG_ADDR (0x82000, 51), vg_cap_page },
+ { VG_ADDR (0x83000, 51), vg_cap_page },
+ { VG_ADDR (0x84000, 51), vg_cap_page },
+ { VG_ADDR (0x85000, 51), vg_cap_page },
+ { VG_ADDR (0x0, 44), vg_cap_folio }
};
try (allocs, sizeof (allocs) / sizeof (allocs[0]), false);
diff --git a/viengoos/t-guard.c b/viengoos/t-guard.c
index 8ca55dc..ea0428d 100644
--- a/viengoos/t-guard.c
+++ b/viengoos/t-guard.c
@@ -18,17 +18,17 @@ test (void)
assert (gc.gbits == 8);
assert (gc.cappage_width == 2);
- /* Inserting a folio at /ADDR_BITS-19. */
+ /* Inserting a folio at /VG_ADDR_BITS-19. */
gc = as_compute_gbits_cappage (30, 11, 10);
assert (gc.gbits == 3);
assert (gc.cappage_width == 8);
- /* Inserting a page at /ADDR_BITS-12. */
+ /* Inserting a page at /VG_ADDR_BITS-12. */
gc = as_compute_gbits_cappage (30, 18, 10);
assert (gc.gbits == 3);
assert (gc.cappage_width == 8);
- /* Inserting a page at /ADDR_BITS-12. */
+ /* Inserting a page at /VG_ADDR_BITS-12. */
gc = as_compute_gbits_cappage (30, 18, 17);
assert (gc.gbits == 11);
assert (gc.cappage_width == 7);
diff --git a/viengoos/thread.c b/viengoos/thread.c
index 1889aa8..e17df62 100644
--- a/viengoos/thread.c
+++ b/viengoos/thread.c
@@ -252,11 +252,11 @@ control_to_string (l4_word_t control, char string[33])
error_t
thread_exregs (struct activity *principal,
struct thread *thread, uintptr_t control,
- struct cap aspace,
- uintptr_t flags, struct cap_properties properties,
- struct cap activity,
- struct cap utcb,
- struct cap exception_messenger,
+ struct vg_cap aspace,
+ uintptr_t flags, struct vg_cap_properties properties,
+ struct vg_cap activity,
+ struct vg_cap utcb,
+ struct vg_cap exception_messenger,
uintptr_t *sp, uintptr_t *ip,
uintptr_t *eflags, uintptr_t *user_handle)
{
@@ -271,25 +271,25 @@ thread_exregs (struct activity *principal,
}
if ((control & HURD_EXREGS_SET_ASPACE))
- cap_copy_x (principal,
- ADDR_VOID, &thread->aspace, ADDR_VOID,
- ADDR_VOID, aspace, ADDR_VOID,
+ vg_cap_copy_x (principal,
+ VG_ADDR_VOID, &thread->aspace, VG_ADDR_VOID,
+ VG_ADDR_VOID, aspace, VG_ADDR_VOID,
flags, properties);
if ((control & HURD_EXREGS_SET_ACTIVITY))
- cap_copy (principal,
- ADDR_VOID, &thread->activity, ADDR_VOID,
- ADDR_VOID, activity, ADDR_VOID);
+ vg_cap_copy (principal,
+ VG_ADDR_VOID, &thread->activity, VG_ADDR_VOID,
+ VG_ADDR_VOID, activity, VG_ADDR_VOID);
if ((control & HURD_EXREGS_SET_UTCB))
- cap_copy (principal,
- ADDR_VOID, &thread->utcb, ADDR_VOID,
- ADDR_VOID, utcb, ADDR_VOID);
+ vg_cap_copy (principal,
+ VG_ADDR_VOID, &thread->utcb, VG_ADDR_VOID,
+ VG_ADDR_VOID, utcb, VG_ADDR_VOID);
if ((control & HURD_EXREGS_SET_EXCEPTION_MESSENGER))
- cap_copy (principal,
- ADDR_VOID, &thread->exception_messenger, ADDR_VOID,
- ADDR_VOID, exception_messenger, ADDR_VOID);
+ vg_cap_copy (principal,
+ VG_ADDR_VOID, &thread->exception_messenger, VG_ADDR_VOID,
+ VG_ADDR_VOID, exception_messenger, VG_ADDR_VOID);
if (thread->commissioned)
{
@@ -357,7 +357,7 @@ thread_exregs (struct activity *principal,
if ((control & HURD_EXREGS_START) == HURD_EXREGS_START)
{
- struct object *a = cap_to_object (principal, &thread->activity);
+ struct object *a = vg_cap_to_object (principal, &thread->activity);
if (! a)
{
debug (0, "Thread not schedulable: no activity");
@@ -365,10 +365,10 @@ thread_exregs (struct activity *principal,
}
struct object_desc *desc = object_to_object_desc (a);
- if (! cap_types_compatible (desc->type, cap_activity))
+ if (! vg_cap_types_compatible (desc->type, vg_cap_activity))
{
debug (0, "Thread not schedulable: activity slot contains a %s",
- cap_type_string (desc->type));
+ vg_cap_type_string (desc->type));
return 0;
}
@@ -436,7 +436,7 @@ thread_activate (struct activity *activity,
bool may_block)
{
assert (messenger);
- assert (object_type ((struct object *) messenger) == cap_messenger);
+ assert (object_type ((struct object *) messenger) == vg_cap_messenger);
uintptr_t ip = 0;
@@ -450,7 +450,7 @@ thread_activate (struct activity *activity,
}
struct vg_utcb *utcb
- = (struct vg_utcb *) cap_to_object (activity, &thread->utcb);
+ = (struct vg_utcb *) vg_cap_to_object (activity, &thread->utcb);
if (! utcb)
{
#ifndef NDEBUG
@@ -465,10 +465,10 @@ thread_activate (struct activity *activity,
return false;
}
- if (object_type ((struct object *) utcb) != cap_page)
+ if (object_type ((struct object *) utcb) != vg_cap_page)
{
debug (0, "Malformed thread: utcb slot contains a %s, not a page",
- cap_type_string (object_type ((struct object *) utcb)));
+ vg_cap_type_string (object_type ((struct object *) utcb)));
return false;
}
@@ -490,7 +490,7 @@ thread_activate (struct activity *activity,
}
debug (5, "Activating %x (ip: %p; sp: %p)",
- thread->tid, ip, sp);
+ thread->tid, (void *) ip, (void *) sp);
utcb->protected_payload = messenger->protected_payload;
utcb->messenger_id = messenger->id;
@@ -500,7 +500,7 @@ thread_activate (struct activity *activity,
memcpy (utcb->inline_words, messenger->inline_words,
messenger->inline_word_count * sizeof (uintptr_t));
memcpy (utcb->inline_caps, messenger->inline_caps,
- messenger->inline_cap_count * sizeof (addr_t));
+ messenger->inline_cap_count * sizeof (vg_addr_t));
utcb->inline_word_count = messenger->inline_word_count;
utcb->inline_cap_count = messenger->inline_cap_count;
}
@@ -594,16 +594,16 @@ thread_raise_exception (struct activity *activity,
struct vg_message *message)
{
struct messenger *handler
- = (struct messenger *) cap_to_object (activity,
+ = (struct messenger *) vg_cap_to_object (activity,
&thread->exception_messenger);
if (! handler)
{
backtrace_print ();
debug (0, "Thread %x has no exception handler.", thread->tid);
}
- else if (object_type ((struct object *) handler) != cap_messenger)
+ else if (object_type ((struct object *) handler) != vg_cap_messenger)
debug (0, "%s is not a valid exception handler.",
- cap_type_string (object_type ((struct object *) handler)));
+ vg_cap_type_string (object_type ((struct object *) handler)));
else
{
if (! messenger_message_load (activity, handler, message))
@@ -617,7 +617,7 @@ thread_deliver_pending (struct activity *activity,
struct thread *thread)
{
struct vg_utcb *utcb
- = (struct vg_utcb *) cap_to_object (activity, &thread->utcb);
+ = (struct vg_utcb *) vg_cap_to_object (activity, &thread->utcb);
if (! utcb)
{
debug (0, "Malformed thread (%x): no utcb",
@@ -625,10 +625,10 @@ thread_deliver_pending (struct activity *activity,
return;
}
- if (object_type ((struct object *) utcb) != cap_page)
+ if (object_type ((struct object *) utcb) != vg_cap_page)
{
debug (0, "Malformed thread: utcb slot contains a %s, not a page",
- cap_type_string (object_type ((struct object *) utcb)));
+ vg_cap_type_string (object_type ((struct object *) utcb)));
return;
}
diff --git a/viengoos/thread.h b/viengoos/thread.h
index f869d0b..912137a 100644
--- a/viengoos/thread.h
+++ b/viengoos/thread.h
@@ -34,18 +34,18 @@ struct thread
/* User accessible fields. */
/* Address space. */
- struct cap aspace;
+ struct vg_cap aspace;
/* The current associated activity. (Not the activity out of which
this thread's storage is allocated!) */
- struct cap activity;
+ struct vg_cap activity;
/* A capability designating a messenger to which to deliver
exceptions. */
- struct cap exception_messenger;
+ struct vg_cap exception_messenger;
/* A capability the page that contains the thread's UTCB. */
- struct cap utcb;
+ struct vg_cap utcb;
/* Non-user-accessible fields. */
@@ -95,11 +95,11 @@ extern void thread_decommission (struct thread *thread);
not set the pager. */
extern error_t thread_exregs (struct activity *principal,
struct thread *thread, uintptr_t control,
- struct cap aspace,
- uintptr_t flags, struct cap_properties properties,
- struct cap activity,
- struct cap utcb,
- struct cap exception_messenger,
+ struct vg_cap aspace,
+ uintptr_t flags, struct vg_cap_properties properties,
+ struct vg_cap activity,
+ struct vg_cap utcb,
+ struct vg_cap exception_messenger,
uintptr_t *sp, uintptr_t *ip,
uintptr_t *eflags, uintptr_t *user_handle);
diff --git a/viengoos/viengoos.c b/viengoos/viengoos.c
index ccab7a5..837c820 100644
--- a/viengoos/viengoos.c
+++ b/viengoos/viengoos.c
@@ -219,7 +219,7 @@ system_task_load (void)
{
const char *const argv[] = { boot_modules[0].command_line, NULL };
struct thread *thread;
- thread = process_spawn (ADDR_VOID,
+ thread = process_spawn (VG_ADDR_VOID,
(void *) boot_modules[0].start,
(void *) boot_modules[0].end,
argv, NULL,