diff options
author | Neal H. Walfield <neal@gnu.org> | 2008-12-18 10:48:24 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@gnu.org> | 2008-12-18 10:48:24 +0100 |
commit | 61ce081e93aaf465a31beb41dd4094575cfbb19f (patch) | |
tree | 5570a5239f5adb8f5bd852f902fe3d4ca481d41c | |
parent | 87bfe7ed7bbe4dd4350f420cc9649809bef6d5a4 (diff) |
Add vg_ prefix to the (hopefully) remaining viengoos symbols.
2008-12-18 Neal H. Walfield <neal@gnu.org>
* viengoos/activity.h (struct activity_memory_policy): Rename from
this...
(struct vg_activity_memory_policy): ... to this. Update users.
(struct activity_policy): Rename from this...
(struct vg_activity_policy): ... to this. Update users.
(ACTIVITY_STATS_PERIODS): Rename from this...
(VG_ACTIVITY_STATS_PERIODS): ... to this. Update users.
(struct activity_stats): Rename from this...
(struct vg_activity_stats): ... to this. Update users.
(struct activity_info): Rename from this...
(struct vg_activity_info): ... to this. Update users.
* viengoos/addr.h (struct addr): Rename from this...
(struct vg_addr): ... to this. Update users.
* viengoos/cap.h (struct object_policy): Rename from this...
(struct vg_object_policy): ... to this. Update users.
(struct object_name): Rename from this...
(struct vg_object_name): ... to this. Update users.
(struct object): Rename from this...
(struct vg_object): ... to this. Update users.
* viengoos/folio.h (struct folio_policy): Rename from this...
(struct vg_folio_policy): ... to this. Update users.
(struct folio): Rename for this...
(struct vg_folio): ... to this. Update users.
* viengoos/thread.h
(HURD_EXREGS_SET_UTCB): Rename from this...
(VG_EXREGS_SET_UTCB): ... to this. Update users.
(HURD_EXREGS_SET_EXCEPTION_MESSENGER): Rename from this...
(VG_EXREGS_SET_EXCEPTION_MESSENGER): ... to this. Update users.
(HURD_EXREGS_SET_ASPACE): Rename from this...
(VG_EXREGS_SET_ASPACE): ... to this. Update users.
(HURD_EXREGS_SET_ACTIVITY): Rename from this...
(VG_EXREGS_SET_ACTIVITY): ... to this. Update users.
(HURD_EXREGS_SET_SP): Rename from this...
(VG_EXREGS_SET_SP): ... to this. Update users.
(HURD_EXREGS_SET_IP): Rename from this...
(VG_EXREGS_SET_IP): ... to this. Update users.
(HURD_EXREGS_SET_SP_IP): Rename from this...
(VG_EXREGS_SET_SP_IP): ... to this. Update users.
(HURD_EXREGS_SET_EFLAGS): Rename from this...
(VG_EXREGS_SET_EFLAGS): ... to this. Update users.
(HURD_EXREGS_SET_USER_HANDLE): Rename from this...
(VG_EXREGS_SET_USER_HANDLE): ... to this. Update users.
(HURD_EXREGS_SET_REGS): Rename from this...
(VG_EXREGS_SET_REGS): ... to this. Update users.
(HURD_EXREGS_GET_REGS): Rename from this...
(VG_EXREGS_GET_REGS): ... to this. Update users.
(HURD_EXREGS_START): Rename from this...
(VG_EXREGS_START): ... to this. Update users.
(HURD_EXREGS_STOP): Rename from this...
(VG_EXREGS_STOP): ... to this. Update users.
(HURD_EXREGS_ABORT_SEND): Rename from this...
(VG_EXREGS_ABORT_SEND): ... to this. Update users.
(HURD_EXREGS_ABORT_RECEIVE): Rename from this...
(VG_EXREGS_ABORT_RECEIVE): ... to this. Update users.
(HURD_EXREGS_ABORT_IPC): Rename from this...
(VG_EXREGS_ABORT_IPC): ... to this. Update users.
(struct hurd_thread_exregs_in): Rename form this...
(struct vg_thread_exregs_in): ... to this. Update users.
(struct hurd_thread_exregs_out): Rename form this...
(struct vg_thread_exregs_out): ... to this. Update users.
(RPC_STUB_PREFIX): Define to vg_activation. Update users.
(RPC_ID_PREFIX): Define to VG_ACTIVATION. Update users.
(ACTIVATION_fault): Rename from this...
(VG_ACTIVATION_fault): ... to this. Update users.
45 files changed, 727 insertions, 643 deletions
diff --git a/benchmarks/GCbench.c b/benchmarks/GCbench.c index bafb3ec..fdb9971 100644 --- a/benchmarks/GCbench.c +++ b/benchmarks/GCbench.c @@ -104,7 +104,7 @@ helper (void *arg) { pthread_setactivity_np (hog_activity); - struct activity_info info; + struct vg_activity_info info; void wait_read_stats (void) { @@ -113,12 +113,12 @@ helper (void *arg) /* First the main thread. */ error_t err; - err = vg_activity_info (gc_activity, activity_info_stats, + err = vg_activity_info (gc_activity, vg_activity_info_stats, stat_count == 0 ? 0 : stats[stat_count - 1].period + 1, &info); assert_perror (err); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); stats[stat_count].alloced[0] @@ -132,12 +132,12 @@ helper (void *arg) stats[stat_count].iter = iter; /* Then, the hog. */ - err = vg_activity_info (hog_activity, activity_info_stats, + err = vg_activity_info (hog_activity, vg_activity_info_stats, stat_count == 0 ? 0 : stats[stat_count - 1].period + 1, &info); assert_perror (err); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); stats[stat_count].alloced[1] @@ -244,7 +244,7 @@ helper_fork (void) if (VG_ADDR_IS_VOID (gc_activity)) panic ("Failed to allocate main activity"); - struct object_name name; + struct vg_object_name name; snprintf (&name.name[0], sizeof (name.name), "gc.%x", l4_myself ()); vg_object_name (VG_ADDR_VOID, gc_activity, name); @@ -259,7 +259,7 @@ helper_fork (void) /* We give the main thread and the hog the same priority and weight. */ - struct activity_policy in, out; + struct vg_activity_policy in, out; memset (&in, 0, sizeof (in)); in.sibling_rel.priority = 1; in.sibling_rel.weight = 10; diff --git a/benchmarks/activity-distribution.c b/benchmarks/activity-distribution.c index 63726f5..1710090 100644 --- a/benchmarks/activity-distribution.c +++ b/benchmarks/activity-distribution.c @@ -43,10 +43,10 @@ main (int argc, char *argv[]) VG_OBJECT_POLICY_DEFAULT, VG_ADDR_VOID).addr; - struct activity_policy in; + struct vg_activity_policy in; in.sibling_rel.priority = i == 0 ? 2 : 1; in.sibling_rel.weight = i + 1; - struct activity_policy out; + struct vg_activity_policy out; err = vg_activity_policy (activity, activities[i], VG_ACTIVITY_POLICY_SIBLING_REL_SET, in, &out); @@ -60,11 +60,11 @@ main (int argc, char *argv[]) int available; { - struct activity_info info; + struct vg_activity_info info; - err = vg_activity_info (activity, activity, activity_info_stats, 1, &info); + err = vg_activity_info (activity, activity, vg_activity_info_stats, 1, &info); assert (err == 0); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count >= 1); available = info.stats.stats[0].available * PAGESIZE; @@ -150,18 +150,18 @@ main (int argc, char *argv[]) } #define ITERATIONS 200 - struct activity_stats stats[ITERATIONS][1 + THREADS]; + struct vg_activity_stats stats[ITERATIONS][1 + THREADS]; uintptr_t next_period = 0; for (i = 0; i < ITERATIONS; i ++) { printf ("Iteration: %d\n", i); - struct activity_info info; + struct vg_activity_info info; - vg_activity_info (activity, activity, activity_info_stats, + vg_activity_info (activity, activity, vg_activity_info_stats, next_period, &info); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); if (i != 0) assertx (info.stats.stats[0].period != stats[i - 1][0].period, @@ -173,9 +173,9 @@ main (int argc, char *argv[]) int j; for (j = 0; j < THREADS; j ++) { - vg_activity_info (activity, activity, activity_info_stats, + vg_activity_info (activity, activity, vg_activity_info_stats, next_period, &info); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); stats[i][1 + j] = info.stats.stats[0]; } diff --git a/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch b/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch index 6e48da8..6fbb790 100644 --- a/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch +++ b/benchmarks/boehm-gc/patches/05-viengoos-scheduler.patch @@ -274,21 +274,21 @@ diff -uprN -x '*.applied' -x config.guess -x '*~' -x autom4te.cache -x config.su + int period = 0; + for (;;) + { -+ struct activity_info info; ++ struct vg_activity_info info; + error_t err = vg_activity_info (ACTIVITY, -+ activity_info_stats -+ | activity_info_pressure, ++ vg_activity_info_stats ++ | vg_activity_info_pressure, + period, &info); + assert_perror (err); + + switch (info.event) + { -+ case activity_info_stats: ++ case vg_activity_info_stats: + GC_available_bytes = info.stats.stats[0].available_local * PAGESIZE; + period = info.stats.stats[0].period + 1; + break; + -+ case activity_info_pressure: ++ case vg_activity_info_pressure: + if (-info.pressure.amount * PAGESIZE < GC_available_bytes) + GC_available_bytes -= -info.pressure.amount * PAGESIZE; + else @@ -305,9 +305,9 @@ diff -uprN -x '*.applied' -x config.guess -x '*~' -x autom4te.cache -x config.su + "mapped:%d, unmapped: %d, available: %d, " + "low-water: %d\n", + l4_myself (), -+ info.event == activity_info_stats ++ info.event == vg_activity_info_stats + ? "Period" : DEBUG_BOLD ("PRESSURE"), -+ (int) (info.event == activity_info_stats ++ (int) (info.event == vg_activity_info_stats + ? period : info.pressure.amount), + (int) GC_adj_bytes_allocd() / PAGESIZE, + (int) GC_get_heap_size () / PAGESIZE, diff --git a/benchmarks/cache.c b/benchmarks/cache.c index d6dbd51..40aa9f2 100644 --- a/benchmarks/cache.c +++ b/benchmarks/cache.c @@ -198,7 +198,7 @@ helper (void *arg) #ifdef __gnu_hurd_viengoos__ pthread_setactivity_np (hog_activity); - struct activity_info info; + struct vg_activity_info info; #endif int hog_alloced = 0; @@ -211,12 +211,12 @@ helper (void *arg) /* First the main thread. */ error_t err; - err = vg_activity_info (VG_ADDR_VOID, main_activity, activity_info_stats, + err = vg_activity_info (VG_ADDR_VOID, main_activity, vg_activity_info_stats, stat_count == 0 ? 0 : stats[stat_count - 1].period + 1, &info); assert_perror (err); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); stats[stat_count].alloced[0] @@ -227,12 +227,12 @@ helper (void *arg) stats[stat_count].period = info.stats.stats[0].period; /* Then, the hog. */ - err = vg_activity_info (VG_ADDR_VOID, hog_activity, activity_info_stats, + err = vg_activity_info (VG_ADDR_VOID, hog_activity, vg_activity_info_stats, stat_count == 0 ? 0 : stats[stat_count - 1].period + 1, &info); assert_perror (err); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); stats[stat_count].alloced[1] @@ -396,7 +396,7 @@ helper_fork (void) if (VG_ADDR_IS_VOID (main_activity)) panic ("Failed to allocate main activity"); - struct object_name name; + struct vg_object_name name; snprintf (&name.name[0], sizeof (name.name), "main.%x", l4_myself ()); vg_object_name (VG_ADDR_VOID, main_activity, name); @@ -411,7 +411,7 @@ helper_fork (void) /* We give the main thread and the hog the same priority and weight. */ - struct activity_policy in, out; + struct vg_activity_policy in, out; memset (&in, 0, sizeof (in)); in.sibling_rel.priority = 1; in.sibling_rel.weight = 10; diff --git a/benchmarks/shared-memory-distribution.c b/benchmarks/shared-memory-distribution.c index a9ffabf..6267a5c 100644 --- a/benchmarks/shared-memory-distribution.c +++ b/benchmarks/shared-memory-distribution.c @@ -101,18 +101,18 @@ main (int argc, char *argv[]) } #define ITERATIONS 100 - struct activity_stats stats[ITERATIONS][1 + THREADS]; + struct vg_activity_stats stats[ITERATIONS][1 + THREADS]; uintptr_t next_period = 0; for (i = 0; i < ITERATIONS; i ++) { debug (0, DEBUG_BOLD ("starting iteration %d (%x)"), i, l4_myself ()); - struct activity_info info; + struct vg_activity_info info; vg_activity_info (activity, activity, - activity_info_stats, next_period, &info); - assert (info.event == activity_info_stats); + vg_activity_info_stats, next_period, &info); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); if (i != 0) assertx (info.stats.stats[0].period != stats[i - 1][0].period, @@ -125,8 +125,8 @@ main (int argc, char *argv[]) for (j = 0; j < THREADS; j ++) { vg_activity_info (activity, activity, - activity_info_stats, next_period, &info); - assert (info.event == activity_info_stats); + vg_activity_info_stats, next_period, &info); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); stats[i][1 + j] = info.stats.stats[0]; } diff --git a/hieronymus/hieronymus.c b/hieronymus/hieronymus.c index 5a4a3f5..4a7190e 100644 --- a/hieronymus/hieronymus.c +++ b/hieronymus/hieronymus.c @@ -63,7 +63,7 @@ extern struct hurd_startup_data *__hurd_startup_data; /* Allocate a new activity out of our storage. */ static struct storage -activity_alloc (struct activity_policy policy) +activity_alloc (struct vg_activity_policy policy) { struct storage storage = storage_alloc (root_activity, vg_cap_activity_control, STORAGE_LONG_LIVED, @@ -71,7 +71,7 @@ activity_alloc (struct activity_policy policy) if (! storage.cap) panic ("Failed to allocate storage."); - struct activity_policy out; + struct vg_activity_policy out; error_t err = vg_activity_policy (VG_ADDR_VOID, storage.addr, VG_ACTIVITY_POLICY_STORAGE_SET | VG_ACTIVITY_POLICY_CHILD_REL_SET @@ -115,7 +115,7 @@ do_gather_stats (void *arg) while (! all_done) { - struct activity_info info; + struct vg_activity_info info; if (size == stats_count) { @@ -137,10 +137,10 @@ do_gather_stats (void *arg) for (i = 0; i < module_count; i ++, stat ++) { error_t err; - err = vg_activity_info (VG_ADDR_VOID, activities[i], activity_info_stats, + err = vg_activity_info (VG_ADDR_VOID, activities[i], vg_activity_info_stats, period, &info); assert_perror (err); - assert (info.event == activity_info_stats); + assert (info.event == vg_activity_info_stats); assert (info.stats.count > 0); if (err) { @@ -184,13 +184,13 @@ main (int argc, char *argv[]) int i; for (i = 0; i < module_count; i ++) { - struct activity_memory_policy sibling_policy + struct vg_activity_memory_policy sibling_policy = VG_ACTIVITY_MEMORY_POLICY (modules[i].priority, modules[i].weight); - struct activity_policy policy + struct vg_activity_policy policy = VG_ACTIVITY_POLICY (sibling_policy, VG_ACTIVITY_MEMORY_POLICY_VOID, 0); activities[i] = activity_alloc (policy).addr; - struct object_name name; + struct vg_object_name name; strncpy (&name.name[0], modules[i].name, sizeof (name.name)); vg_object_name (VG_ADDR_VOID, activities[i], name); } diff --git a/libc-parts/loader.c b/libc-parts/loader.c index 2a6a210..2db7bb3 100644 --- a/libc-parts/loader.c +++ b/libc-parts/loader.c @@ -133,7 +133,7 @@ loader_elf_load (loader_allocate_object_callback_t alloc, for (; addr < ph->p_paddr + ph->p_memsz; addr += PAGESIZE) { /* Allocate a page. */ - struct object *page = NULL; + struct vg_object *page = NULL; if (ph->p_paddr + ph->p_memsz < addr + PAGESIZE) /* We have less than a page of data to process. Another diff --git a/libc-parts/process-spawn.c b/libc-parts/process-spawn.c index b20ffa5..77de8a7 100644 --- a/libc-parts/process-spawn.c +++ b/libc-parts/process-spawn.c @@ -141,9 +141,9 @@ process_spawn (vg_addr_t activity, bind them to the page table. That is, if there is a page table at X, and we index it, we don't refer to X but simply extend its address and return the shadow pte at that address. */ - struct vg_cap *do_index (activity_t activity, - struct vg_cap *pt, vg_addr_t pt_addr, int idx, - struct vg_cap *fake_slot) + struct vg_cap *do_index (vg_activity_t activity, + struct vg_cap *pt, vg_addr_t pt_addr, int idx, + struct vg_cap *fake_slot) { assert (pt->type == vg_cap_cappage || pt->type == vg_cap_rcappage || pt->type == vg_cap_folio); @@ -501,9 +501,9 @@ process_spawn (vg_addr_t activity, /* We know that we are the only one who can access the data structure, however, the object_claim asserts that this lock is held. */ - object_claim (root_activity, (struct object *) root_activity, + object_claim (root_activity, (struct vg_object *) root_activity, VG_OBJECT_POLICY_VOID, true); - object_claim (root_activity, (struct object *) folio_local_addr, + object_claim (root_activity, (struct vg_object *) folio_local_addr, VG_OBJECT_POLICY_VOID, true); #else struct hurd_object_desc *desc; @@ -666,7 +666,7 @@ process_spawn (vg_addr_t activity, { struct vg_cap cap; #ifdef RM_INTERN - cap = object_to_cap ((struct object *) (uintptr_t) + cap = object_to_cap ((struct vg_object *) (uintptr_t) desc->storage.raw); assert (cap.type == vg_cap_folio); #else @@ -745,21 +745,21 @@ process_spawn (vg_addr_t activity, #ifdef RM_INTERN thread->aspace = *as_root_cap; - thread->activity = object_to_cap ((struct object *) root_activity); + thread->activity = object_to_cap ((struct vg_object *) root_activity); l4_word_t sp = STARTUP_DATA_ADDR; error_t err; err = thread_exregs (root_activity, thread, - HURD_EXREGS_SET_SP_IP - | (make_runnable ? HURD_EXREGS_START : 0) - | HURD_EXREGS_ABORT_IPC, + VG_EXREGS_SET_SP_IP + | (make_runnable ? VG_EXREGS_START : 0) + | VG_EXREGS_ABORT_IPC, VG_CAP_VOID, 0, VG_CAP_PROPERTIES_VOID, VG_CAP_VOID, VG_CAP_VOID, VG_CAP_VOID, &sp, &ip, NULL, NULL); #else /* Start thread. */ - struct hurd_thread_exregs_in in; + struct vg_thread_exregs_in in; /* Per the API (cf. <hurd/startup.h>). */ in.sp = STARTUP_DATA_ADDR; in.ip = ip; @@ -767,14 +767,14 @@ process_spawn (vg_addr_t activity, in.aspace_cap_properties_flags = VG_CAP_COPY_COPY_SOURCE_GUARD; error_t err; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_out out; /* XXX: Use a weakened activity. */ err = vg_thread_exregs (VG_ADDR_VOID, thread, - HURD_EXREGS_SET_SP_IP - | HURD_EXREGS_SET_ASPACE - | HURD_EXREGS_SET_ACTIVITY - | (make_runnable ? HURD_EXREGS_START : 0) - | HURD_EXREGS_ABORT_IPC, + VG_EXREGS_SET_SP_IP + | VG_EXREGS_SET_ASPACE + | VG_EXREGS_SET_ACTIVITY + | (make_runnable ? VG_EXREGS_START : 0) + | VG_EXREGS_ABORT_IPC, in, vg_addr_extend (as_root, VG_THREAD_ASPACE_SLOT, VG_THREAD_SLOTS_LOG2), activity, VG_ADDR_VOID, VG_ADDR_VOID, diff --git a/libhurd-mm/anonymous.c b/libhurd-mm/anonymous.c index e90ad04..dac8309 100644 --- a/libhurd-mm/anonymous.c +++ b/libhurd-mm/anonymous.c @@ -579,7 +579,7 @@ advise (struct pager *pager, struct anonymous_pager * anonymous_pager_alloc (vg_addr_t activity, void *hint, uintptr_t length, enum map_access access, - struct object_policy policy, + struct vg_object_policy policy, uintptr_t flags, anonymous_pager_fill_t fill, void **addr_out) { diff --git a/libhurd-mm/anonymous.h b/libhurd-mm/anonymous.h index bdc71ec..28d1b9a 100644 --- a/libhurd-mm/anonymous.h +++ b/libhurd-mm/anonymous.h @@ -117,7 +117,7 @@ struct anonymous_pager vg_addr_t activity; /* The policy to use when allocating memory. */ - struct object_policy policy; + struct vg_object_policy policy; /* If not NULL, called when a fault is raised due to lack of storage @@ -167,7 +167,7 @@ extern struct anonymous_pager *anonymous_pager_alloc (vg_addr_t activity, void *addr_hint, uintptr_t length, enum map_access access, - struct object_policy p, + struct vg_object_policy p, uintptr_t flags, anonymous_pager_fill_t f, void **addr_out); diff --git a/libhurd-mm/as-build-custom.c b/libhurd-mm/as-build-custom.c index 96efe3d..3bed8ff 100644 --- a/libhurd-mm/as-build-custom.c +++ b/libhurd-mm/as-build-custom.c @@ -29,7 +29,7 @@ #include "as-build.c" struct vg_cap * -as_ensure_full_custom (activity_t activity, +as_ensure_full_custom (vg_activity_t activity, vg_addr_t as_root_addr, struct vg_cap *root, vg_addr_t addr, as_allocate_page_table_t as_allocate_page_table, as_object_index_t object_index) @@ -40,7 +40,7 @@ as_ensure_full_custom (activity_t activity, } struct vg_cap * -as_insert_custom (activity_t activity, +as_insert_custom (vg_activity_t activity, vg_addr_t as_root_addr, struct vg_cap *root, vg_addr_t addr, vg_addr_t entry_as, struct vg_cap entry, vg_addr_t entry_addr, as_allocate_page_table_t as_allocate_page_table, diff --git a/libhurd-mm/as-build.c b/libhurd-mm/as-build.c index 73df82f..5097117 100644 --- a/libhurd-mm/as-build.c +++ b/libhurd-mm/as-build.c @@ -122,7 +122,7 @@ struct trace_buffer as_trace = TRACE_BUFFER_INIT ("as_trace", 0, implicit (in the case of a folio), return a fabricated capability in *FAKE_SLOT and return FAKE_SLOT. Return NULL on failure. */ static inline struct vg_cap * -do_index (activity_t activity, struct vg_cap *pte, vg_addr_t pt_addr, int idx, +do_index (vg_activity_t activity, struct vg_cap *pte, vg_addr_t pt_addr, int idx, struct vg_cap *fake_slot) { assert (pte->type == vg_cap_cappage || pte->type == vg_cap_rcappage @@ -131,7 +131,7 @@ do_index (activity_t activity, struct vg_cap *pte, vg_addr_t pt_addr, int idx, || pte->type == vg_cap_messenger || pte->type == vg_cap_rmessenger); /* Load the referenced object. */ - struct object *pt = vg_cap_to_object (activity, pte); + struct vg_object *pt = vg_cap_to_object (activity, pte); if (! pt) /* PTE's type was not void but its designation was invalid. This can only happen if we inserted an object and subsequently @@ -149,7 +149,7 @@ do_index (activity_t activity, struct vg_cap *pte, vg_addr_t pt_addr, int idx, return &pt->caps[VG_CAP_SUBPAGE_OFFSET (pte) + idx]; case vg_cap_folio:; - struct folio *folio = (struct folio *) pt; + struct vg_folio *folio = (struct vg_folio *) pt; if (vg_folio_object_type (folio, idx) == vg_cap_void) PANIC ("Can't use void object at " VG_ADDR_FMT " for address translation", @@ -188,7 +188,7 @@ do_index (activity_t activity, struct vg_cap *pte, vg_addr_t pt_addr, int idx, capability. Otherwise, only capability slots containing a void capability are used. */ struct vg_cap * -ID (as_build) (activity_t activity, +ID (as_build) (vg_activity_t activity, vg_addr_t as_root_addr, struct vg_cap *as_root, vg_addr_t addr, as_allocate_page_table_t allocate_page_table OBJECT_INDEX_PARAM, diff --git a/libhurd-mm/as-dump.c b/libhurd-mm/as-dump.c index 68051ae..c802a93 100644 --- a/libhurd-mm/as-dump.c +++ b/libhurd-mm/as-dump.c @@ -66,7 +66,7 @@ print_nr (int width, int64_t nr, bool hex) } static void -do_walk (activity_t activity, int index, +do_walk (vg_activity_t activity, int index, struct vg_cap *root, vg_addr_t addr, int indent, bool descend, const char *output_prefix) { @@ -115,7 +115,7 @@ do_walk (activity_t activity, int index, #ifdef RM_INTERN if (vg_cap.type == vg_cap_page || vg_cap.type == vg_cap_rpage) { - struct object *object = cap_to_object_soft (root_activity, &vg_cap); + struct vg_object *object = cap_to_object_soft (root_activity, &vg_cap); if (object) { struct md5_ctx ctx; @@ -207,7 +207,7 @@ do_walk (activity_t activity, int index, /* AS_LOCK must not be held. */ void -as_dump_from (activity_t activity, struct vg_cap *root, const char *prefix) +as_dump_from (vg_activity_t activity, struct vg_cap *root, const char *prefix) { debug (0, "Dumping address space."); backtrace_print (); diff --git a/libhurd-mm/as-lookup.c b/libhurd-mm/as-lookup.c index 38b7072..e565e7c 100644 --- a/libhurd-mm/as-lookup.c +++ b/libhurd-mm/as-lookup.c @@ -58,7 +58,7 @@ #endif static bool -as_lookup_rel_internal (activity_t activity, +as_lookup_rel_internal (vg_activity_t activity, struct vg_cap *root, vg_addr_t address, enum vg_cap_type type, bool *writable, enum as_lookup_mode mode, union as_lookup_ret *rt, @@ -185,7 +185,7 @@ as_lookup_rel_internal (activity_t activity, DUMP_OR_RET (false); } - struct object *object = vg_cap_to_object (activity, root); + struct vg_object *object = vg_cap_to_object (activity, root); if (! object) { #ifdef RM_INTERN @@ -219,7 +219,7 @@ as_lookup_rel_internal (activity_t activity, DUMP_OR_RET (false); } - struct object *object = vg_cap_to_object (activity, root); + struct vg_object *object = vg_cap_to_object (activity, root); if (! object) { #ifdef RM_INTERN @@ -229,7 +229,7 @@ as_lookup_rel_internal (activity_t activity, DUMP_OR_RET (false); } - struct folio *folio = (struct folio *) object; + struct vg_folio *folio = (struct vg_folio *) object; int i = extract_bits64_inv (addr, remaining - 1, VG_FOLIO_OBJECTS_LOG2); #ifdef RM_INTERN @@ -274,7 +274,7 @@ as_lookup_rel_internal (activity_t activity, DUMP_OR_RET (false); } - struct object *object = vg_cap_to_object (activity, root); + struct vg_object *object = vg_cap_to_object (activity, root); if (! object) { #ifdef RM_INTERN @@ -391,7 +391,7 @@ as_lookup_rel_internal (activity_t activity, } bool -as_lookup_rel (activity_t activity, +as_lookup_rel (vg_activity_t activity, struct vg_cap *root, vg_addr_t address, enum vg_cap_type type, bool *writable, enum as_lookup_mode mode, union as_lookup_ret *rt) @@ -412,7 +412,7 @@ as_lookup_rel (activity_t activity, } void -as_dump_path_rel (activity_t activity, struct vg_cap *root, vg_addr_t addr) +as_dump_path_rel (vg_activity_t activity, struct vg_cap *root, vg_addr_t addr) { union as_lookup_ret rt; diff --git a/libhurd-mm/as.c b/libhurd-mm/as.c index a654e3e..1a291db 100644 --- a/libhurd-mm/as.c +++ b/libhurd-mm/as.c @@ -555,7 +555,7 @@ as_init (void) VG_OBJECT_POLICY_DEFAULT, VG_ADDR_VOID); if (VG_ADDR_IS_VOID (shadow_storage.addr)) panic ("Out of space."); - struct object *shadow + struct vg_object *shadow = VG_ADDR_TO_PTR (vg_addr_extend (shadow_storage.addr, 0, PAGESIZE_LOG2)); as_slot_lookup_use (addr, @@ -981,7 +981,7 @@ as_walk (int (*visit) (vg_addr_t addr, if (vg_addr_depth (addr) + slots_log2 > VG_ADDR_BITS) return 0; - struct object *shadow = NULL; + struct vg_object *shadow = NULL; if (as_init_done) shadow = vg_cap_to_object (meta_data_activity, cap); diff --git a/libhurd-mm/as.h b/libhurd-mm/as.h index 812693d..24f8f3e 100644 --- a/libhurd-mm/as.h +++ b/libhurd-mm/as.h @@ -183,7 +183,7 @@ as_unlock (void) running in a particular address space, all metadata is built from a single activity. This should dominate all activities running in this address space to avoid priority inversion. */ -extern activity_t meta_data_activity; +extern vg_activity_t meta_data_activity; /* The root of the shadow page tables. */ extern struct vg_cap shadow_root; @@ -293,7 +293,7 @@ extern struct as_allocate_pt_ret as_allocate_page_table (vg_addr_t addr); Must be called with a write lock on AS_LOCK. Must be called with 8kb of stack that will not fault. */ -struct vg_cap *as_build (activity_t activity, +struct vg_cap *as_build (vg_activity_t activity, vg_addr_t as_root_addr, struct vg_cap *as_root_cap, vg_addr_t addr, as_allocate_page_table_t allocate_page_table, @@ -305,14 +305,14 @@ struct vg_cap *as_build (activity_t activity, is implicit (in the case of a folio), return a fabricated capability in *FAKE_SLOT and return FAKE_SLOT. Return NULL on failure. */ -typedef struct vg_cap *(*as_object_index_t) (activity_t activity, +typedef struct vg_cap *(*as_object_index_t) (vg_activity_t activity, struct vg_cap *pt, vg_addr_t pt_addr, int idx, struct vg_cap *fake_slot); /* Like as_buildup, but using a custom shadow page table implementation. */ -struct vg_cap *as_build_custom (activity_t activity, +struct vg_cap *as_build_custom (vg_activity_t activity, vg_addr_t as_root_addr, struct vg_cap *as_root_cap, vg_addr_t addr, as_allocate_page_table_t allocate_page_table, @@ -332,7 +332,7 @@ struct vg_cap *as_build_custom (activity_t activity, __asef_code) \ do \ { \ - activity_t __asef_activity = (__asef_activity_); \ + vg_activity_t __asef_activity = (__asef_activity_); \ vg_addr_t __asef_as_root_addr = (__asef_as_root_addr_); \ struct vg_cap *__asef_as_root_cap = (__asef_as_root_cap_); \ vg_addr_t __asef_addr = (__asef_addr_); \ @@ -395,7 +395,7 @@ struct vg_cap *as_build_custom (activity_t activity, ALLOCATE_PAGE_TABLE is a callback to allocate page tables and any accompanying shadow page tables. See as_build for details. */ static inline void -as_insert_full (activity_t activity, +as_insert_full (vg_activity_t activity, vg_addr_t target_as_root_addr, struct vg_cap *target_as_root_cap, vg_addr_t target_addr, vg_addr_t source_as_root_addr, @@ -445,7 +445,7 @@ as_insert (vg_addr_t target_addr, /* Variant of as_ensure_full that doesn't assume the default shadow page table format but calls OBJECT_INDEX to index objects. */ extern struct vg_cap *as_ensure_full_custom - (activity_t activity, + (vg_activity_t activity, vg_addr_t as, struct vg_cap *root, vg_addr_t addr, as_allocate_page_table_t allocate_page_table, as_object_index_t object_index); @@ -453,7 +453,7 @@ extern struct vg_cap *as_ensure_full_custom /* Variant of as_insert that doesn't assume the default shadow page table format but calls OBJECT_INDEX to index objects. */ extern struct vg_cap *as_insert_custom - (activity_t activity, + (vg_activity_t activity, vg_addr_t target_as, struct vg_cap *t_as_cap, vg_addr_t target, vg_addr_t source_as, struct vg_cap c_cap, vg_addr_t source, as_allocate_page_table_t allocate_page_table, @@ -495,7 +495,7 @@ enum as_lookup_mode On success, whether the slot or the object is writable is returned in *WRITABLE. */ -extern bool as_lookup_rel (activity_t activity, +extern bool as_lookup_rel (vg_activity_t activity, struct vg_cap *as_root_cap, vg_addr_t addr, enum vg_cap_type type, bool *writable, enum as_lookup_mode mode, @@ -511,7 +511,7 @@ extern bool as_lookup_rel (activity_t activity, __alru_root_, __alru_addr_, \ __alru_code) \ ({ \ - activity_t __alru_activity = (__alru_activity_); \ + vg_activity_t __alru_activity = (__alru_activity_); \ struct vg_cap *__alru_root = (__alru_root_); \ vg_addr_t __alru_addr = (__alru_addr_); \ \ @@ -558,7 +558,7 @@ extern bool as_lookup_rel (activity_t activity, This function locks (and unlocks) as_lock. */ static inline struct vg_cap -as_cap_lookup_rel (activity_t activity, +as_cap_lookup_rel (vg_activity_t activity, struct vg_cap *root, vg_addr_t addr, enum vg_cap_type type, bool *writable) { @@ -603,7 +603,7 @@ as_cap_lookup (vg_addr_t addr, enum vg_cap_type type, bool *writable) This function locks (and unlocks) as_lock. */ static inline struct vg_cap -as_object_lookup_rel (activity_t activity, +as_object_lookup_rel (vg_activity_t activity, struct vg_cap *root, vg_addr_t addr, enum vg_cap_type type, bool *writable) { @@ -636,7 +636,7 @@ as_object_lookup (vg_addr_t addr, enum vg_cap_type type, bool *writable) #endif /* Print the path taken to get to the slot at address ADDRESS. */ -extern void as_dump_path_rel (activity_t activity, +extern void as_dump_path_rel (vg_activity_t activity, struct vg_cap *root, vg_addr_t addr); #ifndef RM_INTERN @@ -663,7 +663,7 @@ extern int as_walk (int (*visit) (vg_addr_t cap, void *cookie); /* AS_LOCK must not be held. */ -extern void as_dump_from (activity_t activity, struct vg_cap *root, +extern void as_dump_from (vg_activity_t activity, struct vg_cap *root, const char *prefix); #ifndef RM_INTERN diff --git a/libhurd-mm/capalloc.c b/libhurd-mm/capalloc.c index 56715e4..7096a65 100644 --- a/libhurd-mm/capalloc.c +++ b/libhurd-mm/capalloc.c @@ -196,8 +196,9 @@ capalloc (void) return VG_ADDR_VOID; } - struct object *shadow = VG_ADDR_TO_PTR (vg_addr_extend (shadow_storage.addr, - 0, PAGESIZE_LOG2)); + struct vg_object *shadow + = VG_ADDR_TO_PTR (vg_addr_extend (shadow_storage.addr, + 0, PAGESIZE_LOG2)); memset (shadow, 0, PAGESIZE); vg_cap_set_shadow (area->cap, shadow); @@ -270,7 +271,7 @@ capfree (vg_addr_t cap) list_unlink (desc); pthread_mutex_unlock (&cappage_descs_lock); - struct object *shadow = vg_cap_get_shadow (desc->cap); + struct vg_object *shadow = vg_cap_get_shadow (desc->cap); storage_free (vg_addr_chop (VG_PTR_TO_ADDR (shadow), PAGESIZE_LOG2), false); vg_cap_set_shadow (desc->cap, NULL); diff --git a/libhurd-mm/exceptions.c b/libhurd-mm/exceptions.c index e7a923c..39d972f 100644 --- a/libhurd-mm/exceptions.c +++ b/libhurd-mm/exceptions.c @@ -339,7 +339,7 @@ hurd_activation_handler_normal (struct activation_frame *activation_frame, uintptr_t label = vg_message_word (mb->reply, 0); switch (label) { - case ACTIVATION_fault: + case VG_ACTIVATION_fault: { vg_addr_t fault; uintptr_t ip; @@ -347,9 +347,9 @@ hurd_activation_handler_normal (struct activation_frame *activation_frame, struct vg_activation_fault_info info; error_t err; - err = activation_fault_send_unmarshal (mb->reply, - &fault, &sp, &ip, &info, - NULL); + err = vg_activation_fault_send_unmarshal (mb->reply, + &fault, &sp, &ip, &info, + NULL); if (err) panic ("Failed to unmarshal exception: %d", err); @@ -542,7 +542,7 @@ hurd_activation_handler_activated (struct hurd_utcb *utcb) uintptr_t label = vg_message_word (mb->reply, 0); switch (label) { - case ACTIVATION_fault: + case VG_ACTIVATION_fault: { vg_addr_t fault; uintptr_t ip; @@ -550,9 +550,9 @@ hurd_activation_handler_activated (struct hurd_utcb *utcb) struct vg_activation_fault_info info; error_t err; - err = activation_fault_send_unmarshal (mb->reply, - &fault, &sp, &ip, &info, - NULL); + err = vg_activation_fault_send_unmarshal (mb->reply, + &fault, &sp, &ip, &info, + NULL); if (err) panic ("Failed to unmarshal exception: %d", err); @@ -679,11 +679,11 @@ hurd_activation_handler_init_early (void) utcb->vg.activation_handler_ip = (uintptr_t) &hurd_activation_handler_entry; utcb->vg.activation_handler_end = (uintptr_t) &hurd_activation_handler_end; - struct hurd_thread_exregs_in in; + struct vg_thread_exregs_in in; memset (&in, 0, sizeof (in)); struct vg_message *msg = (void *) &activation_handler_msg[0]; - vg_thread_exregs_send_marshal (msg, HURD_EXREGS_SET_UTCB, in, + vg_thread_exregs_send_marshal (msg, VG_EXREGS_SET_UTCB, in, VG_ADDR_VOID, VG_ADDR_VOID, VG_PTR_TO_PAGE (utcb), VG_ADDR_VOID, __hurd_startup_data->messengers[1]); @@ -854,12 +854,12 @@ hurd_activation_state_alloc (vg_addr_t thread, struct hurd_utcb **utcbp) *utcbp = utcb; - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; err = vg_thread_exregs (VG_ADDR_VOID, thread, - HURD_EXREGS_SET_UTCB - | HURD_EXREGS_SET_EXCEPTION_MESSENGER, + VG_EXREGS_SET_UTCB + | VG_EXREGS_SET_EXCEPTION_MESSENGER, in, VG_ADDR_VOID, VG_ADDR_VOID, VG_PTR_TO_PAGE (utcb), utcb->exception_buffer->receiver, &out, NULL, NULL, NULL, NULL); diff --git a/libhurd-mm/storage.c b/libhurd-mm/storage.c index 388603d..5d37a56 100644 --- a/libhurd-mm/storage.c +++ b/libhurd-mm/storage.c @@ -58,7 +58,7 @@ struct storage_desc /* The address of the folio. */ vg_addr_t folio; /* The location of the shadow vg_cap designating this folio. */ - struct object *shadow; + struct vg_object *shadow; /* Which objects are allocated. */ unsigned char alloced[VG_FOLIO_OBJECTS / 8]; @@ -245,7 +245,7 @@ shadow_setup (struct vg_cap *cap, struct storage_desc *desc) storage descriptor, which is still unreachable from any other thread. */ - struct object *shadow; + struct vg_object *shadow; int idx = bit_alloc (desc->alloced, sizeof (desc->alloced), 0); if (likely (idx != -1)) @@ -531,7 +531,7 @@ storage_check_reserve (bool i_may_have_lock) struct storage storage_alloc (vg_addr_t activity, enum vg_cap_type type, enum storage_expectancy expectancy, - struct object_policy policy, + struct vg_object_policy policy, vg_addr_t addr) { assert (storage_init_done); @@ -652,7 +652,7 @@ storage_alloc (vg_addr_t activity, idx, VG_ADDR_PRINTF (folio), VG_ADDR_PRINTF (addr), err); assert (VG_ADDR_EQ (a, addr)); - struct object *shadow = desc->shadow; + struct vg_object *shadow = desc->shadow; struct vg_cap *cap = NULL; if (likely (!! shadow)) { @@ -729,7 +729,7 @@ storage_free_ (vg_addr_t object, bool unmap_now) storage->free ++; - struct object *shadow = storage->shadow; + struct vg_object *shadow = storage->shadow; if (storage->free == VG_FOLIO_OBJECTS || ((storage->free == VG_FOLIO_OBJECTS - 1) diff --git a/libhurd-mm/storage.h b/libhurd-mm/storage.h index e454b83..c3ea151 100644 --- a/libhurd-mm/storage.h +++ b/libhurd-mm/storage.h @@ -64,7 +64,7 @@ struct storage extern struct storage storage_alloc (vg_addr_t activity, enum vg_cap_type type, enum storage_expectancy expectancy, - struct object_policy policy, + struct vg_object_policy policy, vg_addr_t addr); #define storage_alloc(__sa_activity, __sa_type, __sa_expectancy, \ __sa_policy, __sa_addr) \ diff --git a/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c b/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c index 5777bb4..791b654 100644 --- a/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c +++ b/libpthread/sysdeps/viengoos/ia32/signal-dispatch-lowlevel.c @@ -120,14 +120,14 @@ signal_dispatch_lowlevel (struct signal_state *ss, pthread_t tid, } else { - struct hurd_thread_exregs_in in; + struct vg_thread_exregs_in in; memset (&in, 0, sizeof (in)); - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_out out; error_t err; err = vg_thread_exregs (VG_ADDR_VOID, thread->object, - HURD_EXREGS_STOP | HURD_EXREGS_ABORT_IPC - | HURD_EXREGS_GET_REGS, + VG_EXREGS_STOP | VG_EXREGS_ABORT_IPC + | VG_EXREGS_GET_REGS, in, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); if (err) @@ -201,15 +201,15 @@ signal_dispatch_lowlevel (struct signal_state *ss, pthread_t tid, ((void (*) (uintptr_t)) &_signal_dispatch_entry_self) ((uintptr_t) sp); else { - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; in.sp = sp; in.ip = (uintptr_t) &_signal_dispatch_entry; vg_thread_exregs (VG_ADDR_VOID, thread->object, - HURD_EXREGS_SET_SP_IP - | HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC, + VG_EXREGS_SET_SP_IP + | VG_EXREGS_START | VG_EXREGS_ABORT_IPC, in, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); } diff --git a/libpthread/sysdeps/viengoos/pt-setactivity-np.c b/libpthread/sysdeps/viengoos/pt-setactivity-np.c index f5ba400..70f0988 100644 --- a/libpthread/sysdeps/viengoos/pt-setactivity-np.c +++ b/libpthread/sysdeps/viengoos/pt-setactivity-np.c @@ -27,10 +27,10 @@ pthread_setactivity_np (vg_addr_t activity) { struct __pthread *self = _pthread_self (); - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; int err = vg_thread_exregs (VG_ADDR_VOID, self->object, - HURD_EXREGS_SET_ACTIVITY, + VG_EXREGS_SET_ACTIVITY, in, VG_ADDR_VOID, activity, VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); diff --git a/libpthread/sysdeps/viengoos/pt-thread-start.c b/libpthread/sysdeps/viengoos/pt-thread-start.c index 59583b4..41d0fbf 100644 --- a/libpthread/sysdeps/viengoos/pt-thread-start.c +++ b/libpthread/sysdeps/viengoos/pt-thread-start.c @@ -37,8 +37,8 @@ __pthread_thread_start (struct __pthread *thread) } else { - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; vg_addr_t aspace = VG_ADDR (0, 0); in.aspace_cap_properties = VG_CAP_PROPERTIES_VOID; @@ -51,12 +51,12 @@ __pthread_thread_start (struct __pthread *thread) in.user_handle = (l4_word_t) thread; err = vg_thread_exregs (VG_ADDR_VOID, thread->object, - HURD_EXREGS_SET_ASPACE - | HURD_EXREGS_SET_ACTIVITY - | HURD_EXREGS_SET_SP_IP - | HURD_EXREGS_SET_USER_HANDLE - | HURD_EXREGS_START - | HURD_EXREGS_ABORT_IPC, + VG_EXREGS_SET_ASPACE + | VG_EXREGS_SET_ACTIVITY + | VG_EXREGS_SET_SP_IP + | VG_EXREGS_SET_USER_HANDLE + | VG_EXREGS_START + | VG_EXREGS_ABORT_IPC, in, aspace, activity, VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); assert (err == 0); diff --git a/libviengoos/ChangeLog b/libviengoos/ChangeLog index c6a0f00..a55f0d0 100644 --- a/libviengoos/ChangeLog +++ b/libviengoos/ChangeLog @@ -1,3 +1,70 @@ +2008-12-18 Neal H. Walfield <neal@gnu.org> + + * viengoos/activity.h (struct activity_memory_policy): Rename from + this... + (struct vg_activity_memory_policy): ... to this. Update users. + (struct activity_policy): Rename from this... + (struct vg_activity_policy): ... to this. Update users. + (ACTIVITY_STATS_PERIODS): Rename from this... + (VG_ACTIVITY_STATS_PERIODS): ... to this. Update users. + (struct activity_stats): Rename from this... + (struct vg_activity_stats): ... to this. Update users. + (struct activity_info): Rename from this... + (struct vg_activity_info): ... to this. Update users. + * viengoos/addr.h (struct addr): Rename from this... + (struct vg_addr): ... to this. Update users. + * viengoos/cap.h (struct object_policy): Rename from this... + (struct vg_object_policy): ... to this. Update users. + (struct object_name): Rename from this... + (struct vg_object_name): ... to this. Update users. + (struct object): Rename from this... + (struct vg_object): ... to this. Update users. + * viengoos/folio.h (struct folio_policy): Rename from this... + (struct vg_folio_policy): ... to this. Update users. + (struct folio): Rename for this... + (struct vg_folio): ... to this. Update users. + * viengoos/thread.h + (HURD_EXREGS_SET_UTCB): Rename from this... + (VG_EXREGS_SET_UTCB): ... to this. Update users. + (HURD_EXREGS_SET_EXCEPTION_MESSENGER): Rename from this... + (VG_EXREGS_SET_EXCEPTION_MESSENGER): ... to this. Update users. + (HURD_EXREGS_SET_ASPACE): Rename from this... + (VG_EXREGS_SET_ASPACE): ... to this. Update users. + (HURD_EXREGS_SET_ACTIVITY): Rename from this... + (VG_EXREGS_SET_ACTIVITY): ... to this. Update users. + (HURD_EXREGS_SET_SP): Rename from this... + (VG_EXREGS_SET_SP): ... to this. Update users. + (HURD_EXREGS_SET_IP): Rename from this... + (VG_EXREGS_SET_IP): ... to this. Update users. + (HURD_EXREGS_SET_SP_IP): Rename from this... + (VG_EXREGS_SET_SP_IP): ... to this. Update users. + (HURD_EXREGS_SET_EFLAGS): Rename from this... + (VG_EXREGS_SET_EFLAGS): ... to this. Update users. + (HURD_EXREGS_SET_USER_HANDLE): Rename from this... + (VG_EXREGS_SET_USER_HANDLE): ... to this. Update users. + (HURD_EXREGS_SET_REGS): Rename from this... + (VG_EXREGS_SET_REGS): ... to this. Update users. + (HURD_EXREGS_GET_REGS): Rename from this... + (VG_EXREGS_GET_REGS): ... to this. Update users. + (HURD_EXREGS_START): Rename from this... + (VG_EXREGS_START): ... to this. Update users. + (HURD_EXREGS_STOP): Rename from this... + (VG_EXREGS_STOP): ... to this. Update users. + (HURD_EXREGS_ABORT_SEND): Rename from this... + (VG_EXREGS_ABORT_SEND): ... to this. Update users. + (HURD_EXREGS_ABORT_RECEIVE): Rename from this... + (VG_EXREGS_ABORT_RECEIVE): ... to this. Update users. + (HURD_EXREGS_ABORT_IPC): Rename from this... + (VG_EXREGS_ABORT_IPC): ... to this. Update users. + (struct hurd_thread_exregs_in): Rename form this... + (struct vg_thread_exregs_in): ... to this. Update users. + (struct hurd_thread_exregs_out): Rename form this... + (struct vg_thread_exregs_out): ... to this. Update users. + (RPC_STUB_PREFIX): Define to vg_activation. Update users. + (RPC_ID_PREFIX): Define to VG_ACTIVATION. Update users. + (ACTIVATION_fault): Rename from this... + (VG_ACTIVATION_fault): ... to this. Update users. + 2008-12-17 Neal H. Walfield <neal@gnu.org> * viengoos/futex.h (vg_futex_using): Rename from this... diff --git a/libviengoos/viengoos/activity.h b/libviengoos/viengoos/activity.h index bc10f7d..d4c9fcb 100644 --- a/libviengoos/viengoos/activity.h +++ b/libviengoos/viengoos/activity.h @@ -29,23 +29,23 @@ enum VG_activity_info, }; -struct activity_memory_policy +struct vg_activity_memory_policy { uint16_t priority; uint16_t weight; }; #define VG_ACTIVITY_MEMORY_POLICY(__amp_priority, __amp_weight) \ - (struct activity_memory_policy) { __amp_priority, __amp_weight } + (struct vg_activity_memory_policy) { __amp_priority, __amp_weight } #define VG_ACTIVITY_MEMORY_POLICY_VOID VG_ACTIVITY_MEMORY_POLICY(0, 0) -struct activity_policy +struct vg_activity_policy { /* This policy is typically set by the parent to reflect how available memory should be distributed among its immediate children. It may only be set via an activity control capability. */ - struct activity_memory_policy sibling_rel; + struct vg_activity_memory_policy sibling_rel; /* This policy is typically set by the activity user and controls how the memory allocated *directly* to this activity is managed @@ -54,7 +54,7 @@ struct activity_policy provides a policy to determine whether the memory allocated directly to the activity or that to a child activity should be evicted. */ - struct activity_memory_policy child_rel; + struct vg_activity_memory_policy child_rel; /* Number of folios. Zero means no limit. (This does not mean that there is no limit, just that this activity does not impose a @@ -65,8 +65,8 @@ struct activity_policy /* Activity statistics. These are approximate and in some cases represent averages. */ -#define ACTIVITY_STATS_PERIODS 2 -struct activity_stats +#define VG_ACTIVITY_STATS_PERIODS 2 +struct vg_activity_stats { /* The period during which this statistic was generated. */ uint32_t period; @@ -159,7 +159,7 @@ struct activity_stats }; #define VG_ACTIVITY_POLICY(__ap_sibling_rel, __ap_child_rel, __ap_storage) \ - (struct activity_policy) { __ap_sibling_rel, __ap_child_rel, __ap_storage } + (struct vg_activity_policy) { __ap_sibling_rel, __ap_child_rel, __ap_storage } #define VG_ACTIVITY_POLICY_VOID \ VG_ACTIVITY_POLICY(VG_ACTIVITY_MEMORY_POLICY_VOID, \ VG_ACTIVITY_MEMORY_POLICY_VOID, \ @@ -188,32 +188,32 @@ enum /* Get ACTIVITY's policy and set according to FLAGS and IN. */ RPC (activity_policy, 2, 1, 0, /* cap_t principal, cap_t activity */ - uintptr_t, flags, struct activity_policy, in, + uintptr_t, flags, struct vg_activity_policy, in, /* Out: */ - struct activity_policy, out); + struct vg_activity_policy, out); enum { /* Return statistics. */ - activity_info_stats = 1 << 0, + vg_activity_info_stats = 1 << 0, /* Asynchronous change in availability. */ - activity_info_pressure = 1 << 1, + vg_activity_info_pressure = 1 << 1, }; -struct activity_info +struct vg_activity_info { /* The returned event. */ uintptr_t event; union { - /* If EVENT is activity_info_stats. */ + /* If EVENT is vg_activity_info_stats. */ struct { /* The number of samples. */ int count; /* Samples are ordered by recency with the youngest towards the start of the buffer. */ - struct activity_stats stats[ACTIVITY_STATS_PERIODS]; + struct vg_activity_stats stats[VG_ACTIVITY_STATS_PERIODS]; } stats; /* If EVENT is activity_info_free. */ @@ -230,7 +230,7 @@ struct activity_info bit-wise or of events the caller is interested. Only one event will be returned. - If FLAGS contains activity_info_stats, may return the next + If FLAGS contains vg_activity_info_stats, may return the next statistic that comes at or after UNTIL_PERIOD. (This can be used to register a callback that is sent when the statistics are next available. For example, call with UNTIL_PERIOD equal to 0 to get @@ -245,7 +245,7 @@ RPC (activity_info, 2, 1, 0, /* cap_t principal, cap_t activity, */ uintptr_t, flags, uintptr_t, until_period, /* Out: */ - struct activity_info, info) + struct vg_activity_info, info) #undef RPC_STUB_PREFIX #undef RPC_ID_PREFIX diff --git a/libviengoos/viengoos/addr.h b/libviengoos/viengoos/addr.h index d3c9009..5d6d143 100644 --- a/libviengoos/viengoos/addr.h +++ b/libviengoos/viengoos/addr.h @@ -45,13 +45,13 @@ Leaves thus have a 1 in the least significant bit and nodes a 0. */ -struct addr +struct vg_addr { uint64_t raw; }; #define VG_ADDR_BITS 63 /* Client-side capability handle. */ -typedef struct addr vg_addr_t; +typedef struct vg_addr vg_addr_t; #define VG_ADDR_FMT "%llx/%d" #define VG_ADDR_PRINTF(addr_) vg_addr_prefix ((addr_)), vg_addr_depth ((addr_)) @@ -64,7 +64,7 @@ typedef struct addr vg_addr_t; assert (0 <= d_ && d_ <= VG_ADDR_BITS); \ assert ((p_ & ((1 << (VG_ADDR_BITS - d_)) - 1)) == 0); \ assert (p_ < (1ULL << VG_ADDR_BITS)); \ - (struct addr) { (p_ << 1ULL) | (1ULL << (VG_ADDR_BITS - d_)) }; \ + (struct vg_addr) { (p_ << 1ULL) | (1ULL << (VG_ADDR_BITS - d_)) }; \ }) /* Create an address given a prefix and a depth. Appropriate for use @@ -72,7 +72,7 @@ typedef struct addr vg_addr_t; #define VG_ADDR_INIT(prefix_, depth_) \ { .raw = ((((prefix_) << 1) | 1) << (VG_ADDR_BITS - (depth_))) } -#define VG_ADDR_VOID ((struct addr) { 0ULL }) +#define VG_ADDR_VOID ((struct vg_addr) { 0ULL }) #define VG_ADDR_EQ(a, b) (a.raw == b.raw) #define VG_ADDR_IS_VOID(a) (VG_ADDR_EQ (a, VG_ADDR_VOID)) @@ -110,16 +110,16 @@ vg_addr_extend (vg_addr_t addr, uint64_t prefix, int depth) #define vg_addr_extend(addr_, prefix_, depth_) \ ({ \ vg_addr_t a__ = (addr_); \ - uint64_t p__ = (prefix_); \ + uint64_t p__ = (prefix_); \ int d__ = (depth_); \ assertx (d__ >= 0, "depth: %d", d__); \ - assertx (vg_addr_depth ((a__)) + (d__) <= VG_ADDR_BITS, \ - "addr: " VG_ADDR_FMT "; depth: %d", VG_ADDR_PRINTF (a__), d__); \ + assertx (vg_addr_depth ((a__)) + (d__) <= VG_ADDR_BITS, \ + "addr: " VG_ADDR_FMT "; depth: %d", VG_ADDR_PRINTF (a__), d__); \ assertx (p__ < (1ULL << d__), \ "prefix: %llx; depth: %lld", p__, 1ULL << d__); \ - VG_ADDR (vg_addr_prefix ((a__)) \ - | ((p__) << (VG_ADDR_BITS - vg_addr_depth ((a__)) - (d__))), \ - vg_addr_depth ((a__)) + (d__)); \ + VG_ADDR (vg_addr_prefix ((a__)) \ + | ((p__) << (VG_ADDR_BITS - vg_addr_depth ((a__)) - (d__))), \ + vg_addr_depth ((a__)) + (d__)); \ }) #endif @@ -130,7 +130,8 @@ vg_addr_chop (vg_addr_t addr, int depth) int d = vg_addr_depth (addr) - depth; assert (d >= 0); - return VG_ADDR (vg_addr_prefix (addr) & ~((1ULL << (VG_ADDR_BITS - d)) - 1), d); + return VG_ADDR (vg_addr_prefix (addr) & ~((1ULL << (VG_ADDR_BITS - d)) - 1), + d); } /* Return the last WIDTH bits of address's VG_ADDR prefix. */ @@ -146,19 +147,19 @@ vg_addr_extract (vg_addr_t addr, int width) /* Convert an address to a pointer. The address must name an object mapped in the machine data instruction accessible part of the address space. */ -#define VG_ADDR_TO_PTR(addr_) \ - ({ \ +#define VG_ADDR_TO_PTR(addr_) \ + ({ \ assert (vg_addr_prefix ((addr_)) < ((uintptr_t) -1)); \ - assert (vg_addr_depth ((addr_)) == VG_ADDR_BITS); \ - (void *) (uintptr_t) vg_addr_prefix ((addr_)); \ + assert (vg_addr_depth ((addr_)) == VG_ADDR_BITS); \ + (void *) (uintptr_t) vg_addr_prefix ((addr_)); \ }) /* Convert a pointer to an address. */ -#define VG_PTR_TO_ADDR(ptr_) \ +#define VG_PTR_TO_ADDR(ptr_) \ (VG_ADDR ((uintptr_t) (ptr_), VG_ADDR_BITS)) /* Return the address of the page that would contain pointer PTR_. */ -#define VG_PTR_TO_PAGE(ptr_) \ +#define VG_PTR_TO_PAGE(ptr_) \ vg_addr_chop (VG_ADDR ((uintptr_t) (ptr_), VG_ADDR_BITS), PAGESIZE_LOG2) static inline vg_addr_t diff --git a/libviengoos/viengoos/cap.h b/libviengoos/viengoos/cap.h index 551a054..b456d34 100644 --- a/libviengoos/viengoos/cap.h +++ b/libviengoos/viengoos/cap.h @@ -201,7 +201,7 @@ vg_cap_type_strengthen (enum vg_cap_type type) #define VG_OBJECT_PRIORITY_DEFAULT (0) #define VG_OBJECT_PRIORITY_MAX ((1 << (VG_OBJECT_PRIORITY_BITS - 1)) - 1) -struct object_policy +struct vg_object_policy { union { @@ -224,7 +224,7 @@ struct object_policy #define VG_OBJECT_POLICY_INIT { { raw: 0 } } #define VG_OBJECT_POLICY(__op_discardable, __op_priority) \ - (struct object_policy) { { { (__op_discardable), (__op_priority) } } } + (struct vg_object_policy) { { { (__op_discardable), (__op_priority) } } } /* The default object policy: not discardable, managed by LRU. */ #define VG_OBJECT_POLICY_VOID \ VG_OBJECT_POLICY (false, VG_OBJECT_PRIORITY_DEFAULT) @@ -235,7 +235,7 @@ struct object_policy struct vg_cap_properties { - struct object_policy policy; + struct vg_object_policy policy; struct vg_cap_addr_trans addr_trans; }; @@ -282,7 +282,7 @@ struct vg_cap uint64_t oid : 64 - VG_CAP_TYPE_BITS; #else /* The shadow object (only for cappages and folios). */ - struct object *shadow; + struct vg_object *shadow; uint32_t discardable : 1; int32_t priority : VG_OBJECT_PRIORITY_BITS; @@ -470,8 +470,8 @@ RPC(object_discard, 0, 0, 0 enum { - object_dirty = 1 << 0, - object_referenced = 1 << 1, + vg_object_dirty = 1 << 0, + vg_object_referenced = 1 << 1, }; /* Returns whether OBJECT is dirty. If CLEAR is set, the dirty bit is @@ -490,7 +490,7 @@ RPC (object_reply_on_destruction, 0, 1, 0, /* Out: */ uintptr_t, return_code); -struct object_name +struct vg_object_name { char name[12]; }; @@ -499,7 +499,7 @@ struct object_name purposes and is only supported by some objects, in particular, activities and threads. */ RPC (object_name, 1, 0, 0, - /* cap_t activity, cap_t object, */ struct object_name, name); + /* cap_t activity, cap_t object, */ struct vg_object_name, name); #undef RPC_STUB_PREFIX @@ -518,7 +518,7 @@ enum VG_CAPPAGE_SLOTS_LOG2 = PAGESIZE_LOG2 - 4, }; -struct object +struct vg_object { union { @@ -528,9 +528,9 @@ struct object }; #ifdef RM_INTERN -typedef struct activity *activity_t; +typedef struct activity *vg_activity_t; #else -typedef vg_addr_t activity_t; +typedef vg_addr_t vg_activity_t; #endif #ifndef RM_INTERN @@ -552,10 +552,10 @@ vg_cap_set_shadow (struct vg_cap *vg_cap, void *shadow) /* Given vg_cap CAP, return the corresponding object, or NULL, if there is none. */ #ifdef RM_INTERN -extern struct object *vg_cap_to_object (activity_t activity, struct vg_cap *vg_cap); +extern struct vg_object *vg_cap_to_object (vg_activity_t activity, struct vg_cap *vg_cap); #else -static inline struct object * -vg_cap_to_object (activity_t activity, struct vg_cap *vg_cap) +static inline struct vg_object * +vg_cap_to_object (vg_activity_t activity, struct vg_cap *vg_cap) { return vg_cap_get_shadow (vg_cap); } @@ -564,9 +564,11 @@ vg_cap_to_object (activity_t activity, struct vg_cap *vg_cap) /* Wrapper for the vg_cap_copy method. Also updates shadow capabilities. */ static inline bool -vg_cap_copy_x (activity_t activity, - vg_addr_t target_address_space, struct vg_cap *target, vg_addr_t target_addr, - vg_addr_t source_address_space, struct vg_cap source, vg_addr_t source_addr, +vg_cap_copy_x (vg_activity_t activity, + vg_addr_t target_address_space, + struct vg_cap *target, vg_addr_t target_addr, + vg_addr_t source_address_space, + struct vg_cap source, vg_addr_t source_addr, int flags, struct vg_cap_properties properties) { /* By default, we preserve SOURCE's subpage specification. */ @@ -652,10 +654,12 @@ vg_cap_copy_x (activity_t activity, changes_translation = true; } - if (subpage != VG_CAP_SUBPAGE (target) || subpages != VG_CAP_SUBPAGES (target)) + if (subpage != VG_CAP_SUBPAGE (target) + || subpages != VG_CAP_SUBPAGES (target)) { debug (5, "Subpage specification differs %d/%d -> %d/%d.", - subpage, subpages, VG_CAP_SUBPAGE (target), VG_CAP_SUBPAGES (target)); + subpage, subpages, + VG_CAP_SUBPAGE (target), VG_CAP_SUBPAGES (target)); changes_translation = true; } @@ -676,7 +680,8 @@ vg_cap_copy_x (activity_t activity, if (changes_translation) { - extern void cap_shootdown (struct activity *activity, struct vg_cap *vg_cap); + extern void cap_shootdown (struct activity *activity, + struct vg_cap *cap); debug (5, "Translation changed: " VG_CAP_FMT " -> " VG_CAP_FMT, VG_CAP_PRINTF (target), VG_CAP_PRINTF (&source)); @@ -717,7 +722,7 @@ vg_cap_copy_x (activity_t activity, SOURCE's subpage specification and TARGET's guard. Copies SOURCE's policy. */ static inline bool -vg_cap_copy_simple (activity_t activity, +vg_cap_copy_simple (vg_activity_t activity, vg_addr_t target_as, struct vg_cap *target, vg_addr_t target_addr, vg_addr_t source_as, diff --git a/libviengoos/viengoos/folio.h b/libviengoos/viengoos/folio.h index 728fe7f..bf82b59 100644 --- a/libviengoos/viengoos/folio.h +++ b/libviengoos/viengoos/folio.h @@ -51,7 +51,7 @@ enum #define VG_FOLIO_GROUP_MIN 0 #define VG_FOLIO_GROUP_MAX ((1 << FOLIO_BITS) - 1) -struct folio_policy +struct vg_folio_policy { union { @@ -82,13 +82,13 @@ struct folio_policy }; #define VG_FOLIO_POLICY_INIT { { raw: 0 } } -#define VG_FOLIO_POLICY_VOID (struct folio_policy) VG_FOLIO_POLICY_INIT +#define VG_FOLIO_POLICY_VOID (struct vg_folio_policy) VG_FOLIO_POLICY_INIT /* The default policy is not discardable. */ #define VG_FOLIO_POLICY_DEFAULT VG_FOLIO_POLICY_VOID /* The format of the first page of a folio. This page is followed (on disk) by VG_FOLIO_OBJECTS pages. */ -struct folio +struct vg_folio { #ifdef RM_INTERN /* Folios are the unit of storage accounting. Every folio belongs @@ -100,7 +100,7 @@ struct folio struct vg_cap prev; /* The storage policy. */ - struct folio_policy policy; + struct vg_folio_policy policy; struct { @@ -146,14 +146,14 @@ struct folio }; #ifdef RM_INTERN -typedef struct folio *vg_folio_t; +typedef struct vg_folio *vg_folio_t; #else typedef vg_addr_t vg_folio_t; #endif /* OBJECT is from -1 to VG_FOLIO_OBJECTS. */ static inline enum vg_cap_type -vg_folio_object_type (struct folio *folio, int object) +vg_folio_object_type (struct vg_folio *folio, int object) { #ifdef RM_INTERN assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -168,7 +168,7 @@ vg_folio_object_type (struct folio *folio, int object) } static inline void -vg_folio_object_type_set (struct folio *folio, int object, +vg_folio_object_type_set (struct vg_folio *folio, int object, enum vg_cap_type type) { assert (object >= 0 && object < VG_FOLIO_OBJECTS); @@ -180,10 +180,10 @@ vg_folio_object_type_set (struct folio *folio, int object, #endif } -static inline struct object_policy -vg_folio_object_policy (struct folio *folio, int object) +static inline struct vg_object_policy +vg_folio_object_policy (struct vg_folio *folio, int object) { - struct object_policy policy; + struct vg_object_policy policy; #ifdef RM_INTERN assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -201,8 +201,8 @@ vg_folio_object_policy (struct folio *folio, int object) } static inline void -vg_folio_object_policy_set (struct folio *folio, int object, - struct object_policy policy) +vg_folio_object_policy_set (struct vg_folio *folio, int object, + struct vg_object_policy policy) { #ifdef RM_INTERN assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -221,7 +221,7 @@ vg_folio_object_policy_set (struct folio *folio, int object, #include <bit-array.h> static inline bool -folio_object_wait_queue_p (struct folio *folio, int object) +folio_object_wait_queue_p (struct vg_folio *folio, int object) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -229,7 +229,7 @@ folio_object_wait_queue_p (struct folio *folio, int object) } static inline void -folio_object_wait_queue_p_set (struct folio *folio, int object, +folio_object_wait_queue_p_set (struct vg_folio *folio, int object, bool valid) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -239,7 +239,7 @@ folio_object_wait_queue_p_set (struct folio *folio, int object, } static inline vg_oid_t -folio_object_wait_queue (struct folio *folio, int object) +folio_object_wait_queue (struct vg_folio *folio, int object) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -247,7 +247,7 @@ folio_object_wait_queue (struct folio *folio, int object) } static inline void -folio_object_wait_queue_set (struct folio *folio, int object, +folio_object_wait_queue_set (struct vg_folio *folio, int object, vg_oid_t head) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -256,7 +256,7 @@ folio_object_wait_queue_set (struct folio *folio, int object, } static inline uint32_t -folio_object_version (struct folio *folio, int object) +folio_object_version (struct vg_folio *folio, int object) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -264,7 +264,7 @@ folio_object_version (struct folio *folio, int object) } static inline void -folio_object_version_set (struct folio *folio, int object, +folio_object_version_set (struct vg_folio *folio, int object, uint32_t version) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -273,7 +273,7 @@ folio_object_version_set (struct folio *folio, int object, } static inline bool -folio_object_content (struct folio *folio, int object) +folio_object_content (struct vg_folio *folio, int object) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -281,7 +281,7 @@ folio_object_content (struct folio *folio, int object) } static inline void -folio_object_content_set (struct folio *folio, int object, +folio_object_content_set (struct vg_folio *folio, int object, bool content) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -290,7 +290,7 @@ folio_object_content_set (struct folio *folio, int object, } static inline bool -folio_object_discarded (struct folio *folio, int object) +folio_object_discarded (struct vg_folio *folio, int object) { assert (object >= 0 && object < VG_FOLIO_OBJECTS); @@ -298,7 +298,7 @@ folio_object_discarded (struct folio *folio, int object) } static inline void -folio_object_discarded_set (struct folio *folio, int object, bool valid) +folio_object_discarded_set (struct vg_folio *folio, int object, bool valid) { assert (object >= 0 && object < VG_FOLIO_OBJECTS); @@ -307,7 +307,7 @@ folio_object_discarded_set (struct folio *folio, int object, bool valid) } static inline bool -folio_object_referenced (struct folio *folio, int object) +folio_object_referenced (struct vg_folio *folio, int object) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -315,7 +315,7 @@ folio_object_referenced (struct folio *folio, int object) } static inline void -folio_object_referenced_set (struct folio *folio, int object, bool p) +folio_object_referenced_set (struct vg_folio *folio, int object, bool p) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -323,7 +323,7 @@ folio_object_referenced_set (struct folio *folio, int object, bool p) } static inline bool -folio_object_dirty (struct folio *folio, int object) +folio_object_dirty (struct vg_folio *folio, int object) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -331,7 +331,7 @@ folio_object_dirty (struct folio *folio, int object) } static inline void -folio_object_dirty_set (struct folio *folio, int object, bool p) +folio_object_dirty_set (struct vg_folio *folio, int object, bool p) { assert (object >= -1 && object < VG_FOLIO_OBJECTS); @@ -351,20 +351,20 @@ folio_object_dirty_set (struct folio *folio, int object, bool p) __foc_cap.version = folio_object_version (__foc_folio, \ __foc_object); \ \ - struct vg_cap_properties __foc_cap_properties \ + struct vg_cap_properties __foc_cap_properties \ = VG_CAP_PROPERTIES (vg_folio_object_policy (__foc_folio, __foc_object), \ VG_CAP_ADDR_TRANS_VOID); \ VG_CAP_PROPERTIES_SET (&__foc_cap, __foc_cap_properties); \ \ __foc_cap.oid \ - = object_to_object_desc ((struct object *) __foc_folio)->oid \ + = object_to_object_desc ((struct vg_object *) __foc_folio)->oid \ + 1 + __foc_object; \ \ __foc_cap; \ }) #else static inline struct vg_cap -vg_folio_object_cap (struct folio *folio, int object) +vg_folio_object_cap (struct vg_folio *folio, int object) { assert (0 <= object && object < VG_FOLIO_OBJECTS); return folio->objects[object]; @@ -389,7 +389,7 @@ enum policy. */ RPC(folio_alloc, 1, 0, 1, /* cap_t, principal, cap_t, activity, */ - struct folio_policy, policy, cap_t, folio) + struct vg_folio_policy, policy, cap_t, folio) /* Free the folio designated by FOLIO. */ RPC(folio_free, 0, 0, 0 @@ -407,7 +407,7 @@ RPC(folio_free, 0, 0, 0 RPC(folio_object_alloc, 4, 0, 2, /* cap_t, principal, cap_t, folio, */ uintptr_t, index, uintptr_t, type, - struct object_policy, policy, uintptr_t, return_code, + struct vg_object_policy, policy, uintptr_t, return_code, /* Out: */ cap_t, object, cap_t, object_weak) @@ -432,9 +432,9 @@ enum set, set the corresponding values based on the value of POLICY. */ RPC(folio_policy, 2, 1, 0, /* cap_t, principal, cap_t, folio, */ - uintptr_t, flags, struct folio_policy, policy, + uintptr_t, flags, struct vg_folio_policy, policy, /* Out: */ - struct folio_policy, old) + struct vg_folio_policy, old) #undef RPC_STUB_PREFIX #undef RPC_ID_PREFIX diff --git a/libviengoos/viengoos/thread.h b/libviengoos/viengoos/thread.h index 2c95f49..a61859f 100644 --- a/libviengoos/viengoos/thread.h +++ b/libviengoos/viengoos/thread.h @@ -138,36 +138,6 @@ enum #define VG_THREAD_SLOTS_LOG2 2 enum -{ - HURD_EXREGS_SET_UTCB = 0x2000, - HURD_EXREGS_SET_EXCEPTION_MESSENGER = 0x1000, - HURD_EXREGS_SET_ASPACE = 0x800, - HURD_EXREGS_SET_ACTIVITY = 0x400, - HURD_EXREGS_SET_SP = _L4_XCHG_REGS_SET_SP, - HURD_EXREGS_SET_IP = _L4_XCHG_REGS_SET_IP, - HURD_EXREGS_SET_SP_IP = _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP, - HURD_EXREGS_SET_EFLAGS = _L4_XCHG_REGS_SET_FLAGS, - HURD_EXREGS_SET_USER_HANDLE = _L4_XCHG_REGS_SET_USER_HANDLE, - HURD_EXREGS_SET_REGS = (HURD_EXREGS_SET_UTCB - | HURD_EXREGS_SET_EXCEPTION_MESSENGER - | HURD_EXREGS_SET_ASPACE - | HURD_EXREGS_SET_ACTIVITY - | HURD_EXREGS_SET_SP - | HURD_EXREGS_SET_IP - | HURD_EXREGS_SET_EFLAGS - | HURD_EXREGS_SET_USER_HANDLE), - - HURD_EXREGS_GET_REGS = _L4_XCHG_REGS_DELIVER, - - HURD_EXREGS_START = _L4_XCHG_REGS_SET_HALT, - HURD_EXREGS_STOP = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_HALT, - - HURD_EXREGS_ABORT_SEND = _L4_XCHG_REGS_CANCEL_SEND, - HURD_EXREGS_ABORT_RECEIVE = _L4_XCHG_REGS_CANCEL_RECV, - HURD_EXREGS_ABORT_IPC = HURD_EXREGS_ABORT_SEND | _L4_XCHG_REGS_CANCEL_RECV, -}; - -enum { VG_thread_exregs = 600, VG_thread_id, @@ -186,7 +156,37 @@ typedef vg_addr_t vg_thread_t; #include <viengoos/rpc.h> -struct hurd_thread_exregs_in +enum +{ + VG_EXREGS_SET_UTCB = 0x2000, + VG_EXREGS_SET_EXCEPTION_MESSENGER = 0x1000, + VG_EXREGS_SET_ASPACE = 0x800, + VG_EXREGS_SET_ACTIVITY = 0x400, + VG_EXREGS_SET_SP = _L4_XCHG_REGS_SET_SP, + VG_EXREGS_SET_IP = _L4_XCHG_REGS_SET_IP, + VG_EXREGS_SET_SP_IP = _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP, + VG_EXREGS_SET_EFLAGS = _L4_XCHG_REGS_SET_FLAGS, + VG_EXREGS_SET_USER_HANDLE = _L4_XCHG_REGS_SET_USER_HANDLE, + VG_EXREGS_SET_REGS = (VG_EXREGS_SET_UTCB + | VG_EXREGS_SET_EXCEPTION_MESSENGER + | VG_EXREGS_SET_ASPACE + | VG_EXREGS_SET_ACTIVITY + | VG_EXREGS_SET_SP + | VG_EXREGS_SET_IP + | VG_EXREGS_SET_EFLAGS + | VG_EXREGS_SET_USER_HANDLE), + + VG_EXREGS_GET_REGS = _L4_XCHG_REGS_DELIVER, + + VG_EXREGS_START = _L4_XCHG_REGS_SET_HALT, + VG_EXREGS_STOP = _L4_XCHG_REGS_SET_HALT | _L4_XCHG_REGS_HALT, + + VG_EXREGS_ABORT_SEND = _L4_XCHG_REGS_CANCEL_SEND, + VG_EXREGS_ABORT_RECEIVE = _L4_XCHG_REGS_CANCEL_RECV, + VG_EXREGS_ABORT_IPC = VG_EXREGS_ABORT_SEND | _L4_XCHG_REGS_CANCEL_RECV, +}; + +struct vg_thread_exregs_in { uintptr_t aspace_cap_properties_flags; struct vg_cap_properties aspace_cap_properties; @@ -197,7 +197,7 @@ struct hurd_thread_exregs_in uintptr_t user_handle; }; -struct hurd_thread_exregs_out +struct vg_thread_exregs_out { uintptr_t sp; uintptr_t ip; @@ -208,50 +208,53 @@ struct hurd_thread_exregs_out /* l4_exregs wrapper. */ RPC (thread_exregs, 6, 1, 4, /* cap_t principal, cap_t thread, */ - uintptr_t, control, struct hurd_thread_exregs_in, in, + uintptr_t, control, struct vg_thread_exregs_in, in, cap_t, aspace, cap_t, activity, cap_t, utcb, cap_t, exception_messenger, /* Out: */ - struct hurd_thread_exregs_out, out, + struct vg_thread_exregs_out, out, cap_t, aspace_out, cap_t, activity_out, cap_t, utcb_out, cap_t, exception_messenger_out) static inline error_t vg_thread_start (vg_addr_t thread) { - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; return vg_thread_exregs (VG_ADDR_VOID, thread, - HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC, - in, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, + VG_EXREGS_START | VG_EXREGS_ABORT_IPC, + in, VG_ADDR_VOID, VG_ADDR_VOID, + VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); } static inline error_t vg_thread_start_sp_ip (vg_addr_t thread, uintptr_t sp, uintptr_t ip) { - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; in.sp = sp; in.ip = ip; return vg_thread_exregs (VG_ADDR_VOID, thread, - HURD_EXREGS_START | HURD_EXREGS_ABORT_IPC - | HURD_EXREGS_SET_SP_IP, - in, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, + VG_EXREGS_START | VG_EXREGS_ABORT_IPC + | VG_EXREGS_SET_SP_IP, + in, VG_ADDR_VOID, VG_ADDR_VOID, + VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); } static inline error_t vg_thread_stop (vg_addr_t thread) { - struct hurd_thread_exregs_in in; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_in in; + struct vg_thread_exregs_out out; return vg_thread_exregs (VG_ADDR_VOID, thread, - HURD_EXREGS_STOP | HURD_EXREGS_ABORT_IPC, - in, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, VG_ADDR_VOID, + VG_EXREGS_STOP | VG_EXREGS_ABORT_IPC, + in, VG_ADDR_VOID, VG_ADDR_VOID, + VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); } @@ -266,7 +269,7 @@ RPC(thread_activation_collect, 0, 0, 0 #undef RPC_STUB_PREFIX #undef RPC_ID_PREFIX - + static inline vg_thread_id_t vg_myself (void) { @@ -277,14 +280,14 @@ vg_myself (void) return tid; } -#define RPC_STUB_PREFIX activation -#define RPC_ID_PREFIX ACTIVATION +#define RPC_STUB_PREFIX vg_activation +#define RPC_ID_PREFIX VG_ACTIVATION #include <viengoos/rpc.h> /* Activation message ids. */ enum { - ACTIVATION_fault = 10, + VG_ACTIVATION_fault = 10, }; /* Return a string corresponding to a message id. */ @@ -293,7 +296,7 @@ vg_activation_method_id_string (uintptr_t id) { switch (id) { - case ACTIVATION_fault: + case VG_ACTIVATION_fault: return "fault"; default: return "unknown"; diff --git a/ruth/ruth.c b/ruth/ruth.c index c6b4d5d..82be037 100644 --- a/ruth/ruth.c +++ b/ruth/ruth.c @@ -170,8 +170,9 @@ main (int argc, char *argv[]) struct storage shadow_storage = storage_alloc (activity, vg_cap_page, STORAGE_EPHEMERAL, VG_OBJECT_POLICY_DEFAULT, VG_ADDR_VOID); - struct object *shadow = VG_ADDR_TO_PTR (vg_addr_extend (shadow_storage.addr, - 0, PAGESIZE_LOG2)); + struct vg_object *shadow + = VG_ADDR_TO_PTR (vg_addr_extend (shadow_storage.addr, + 0, PAGESIZE_LOG2)); vg_addr_t f = vg_addr_extend (root, i, bits); as_ensure_use (f, @@ -335,7 +336,7 @@ main (int argc, char *argv[]) vg_addr_t storage = storage_alloc (activity, vg_cap_thread, STORAGE_LONG_LIVED, VG_OBJECT_POLICY_DEFAULT, thread).addr; - struct hurd_thread_exregs_in in; + struct vg_thread_exregs_in in; in.aspace_cap_properties = VG_CAP_PROPERTIES_DEFAULT; in.aspace_cap_properties_flags = VG_CAP_COPY_COPY_SOURCE_GUARD; @@ -343,12 +344,12 @@ main (int argc, char *argv[]) in.sp = (l4_word_t) ((void *) stack + sizeof (stack)); in.ip = (l4_word_t) &start; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_out out; vg_thread_exregs (activity, thread, - HURD_EXREGS_SET_ASPACE | HURD_EXREGS_SET_ACTIVITY - | HURD_EXREGS_SET_SP_IP | HURD_EXREGS_START - | HURD_EXREGS_ABORT_IPC, + VG_EXREGS_SET_ASPACE | VG_EXREGS_SET_ACTIVITY + | VG_EXREGS_SET_SP_IP | VG_EXREGS_START + | VG_EXREGS_ABORT_IPC, in, VG_ADDR (0, 0), activity, VG_ADDR_VOID, VG_ADDR_VOID, &out, NULL, NULL, NULL, NULL); @@ -746,7 +747,7 @@ main (int argc, char *argv[]) VG_CAP_COPY_WEAKEN, VG_CAP_PROPERTIES_VOID); assert (! err); - struct activity_policy in, out; + struct vg_activity_policy in, out; in.sibling_rel.priority = 2; in.sibling_rel.weight = 3; in.child_rel = VG_ACTIVITY_MEMORY_POLICY_VOID; @@ -980,9 +981,9 @@ main (int argc, char *argv[]) uint32_t frames; do { - struct activity_info info; + struct vg_activity_info info; error_t err = vg_activity_info (VG_ADDR_VOID, activity, - activity_info_stats, 1, &info); + vg_activity_info_stats, 1, &info); assert_perror (err); assert (info.stats.count >= 1); diff --git a/viengoos/activity.c b/viengoos/activity.c index 36e9096..d931154 100644 --- a/viengoos/activity.c +++ b/viengoos/activity.c @@ -35,7 +35,7 @@ void activity_create (struct activity *parent, struct activity *child) { - struct object *old_parent = vg_cap_to_object (parent, &child->parent_cap); + struct vg_object *old_parent = vg_cap_to_object (parent, &child->parent_cap); if (old_parent) /* CHILD is live. Destroy it first. */ { @@ -50,14 +50,14 @@ activity_create (struct activity *parent, } /* Set child's parent pointer. */ - child->parent_cap = object_to_cap ((struct object *) parent); + child->parent_cap = object_to_cap ((struct vg_object *) parent); /* Connect to PARENT's activity list. */ child->sibling_next_cap = parent->children_cap; child->sibling_prev_cap.type = vg_cap_void; - parent->children_cap = object_to_cap ((struct object *) child); + parent->children_cap = object_to_cap ((struct vg_object *) child); - struct object *old_head = vg_cap_to_object (parent, &child->sibling_next_cap); + struct vg_object *old_head = vg_cap_to_object (parent, &child->sibling_next_cap); if (old_head) { assert (object_type (old_head) == vg_cap_activity_control); @@ -66,7 +66,7 @@ activity_create (struct activity *parent, (parent, &((struct activity *) old_head)->sibling_prev_cap)); ((struct activity *) old_head)->sibling_prev_cap - = object_to_cap ((struct object *) child); + = object_to_cap ((struct vg_object *) child); } activity_prepare (parent, child); @@ -76,10 +76,10 @@ void activity_destroy (struct activity *activity, struct activity *victim) { debug (0, "Destroying activity " OBJECT_NAME_FMT, - OBJECT_NAME_PRINTF ((struct object *) victim)); + OBJECT_NAME_PRINTF ((struct vg_object *) victim)); - assert (object_type ((struct object *) activity) == vg_cap_activity_control); - assert (object_type ((struct object *) victim) == vg_cap_activity_control); + assert (object_type ((struct vg_object *) activity) == vg_cap_activity_control); + assert (object_type ((struct vg_object *) victim) == vg_cap_activity_control); profile_stats_dump (); @@ -108,7 +108,7 @@ activity_destroy (struct activity *activity, struct activity *victim) /* XXX: Rewrite this to avoid recusion!!! */ /* Destroy all folios allocated to this activity. */ - struct object *o; + struct vg_object *o; while ((o = vg_cap_to_object (activity, &victim->folios))) { /* If O was destroyed, it should have been removed from its @@ -118,7 +118,7 @@ activity_destroy (struct activity *activity, struct activity *victim) struct object_desc *desc = object_to_object_desc (o); assert (desc->type == vg_cap_folio); - folio_free (activity, (struct folio *) o); + folio_free (activity, (struct vg_folio *) o); } /* Activities that are sub-activities of ACTIVITY are not @@ -208,8 +208,8 @@ activity_destroy (struct activity *activity, struct activity *victim) assert (desc->eviction_candidate); #ifndef NDEBUG struct object_desc *adesc, *vdesc; - adesc = object_to_object_desc ((struct object *) desc->activity); - vdesc = object_to_object_desc ((struct object *) victim); + adesc = object_to_object_desc ((struct vg_object *) desc->activity); + vdesc = object_to_object_desc ((struct vg_object *) victim); assertx (desc->activity == victim, VG_OID_FMT " != " VG_OID_FMT, @@ -228,7 +228,7 @@ activity_destroy (struct activity *activity, struct activity *victim) if (victim->frames_total != count || victim->frames_local != count) { debug (0, "activity (%llx), total = %d, local: %d, count: %d", - object_to_object_desc ((struct object *) victim)->oid, + object_to_object_desc ((struct vg_object *) victim)->oid, victim->frames_total, victim->frames_local, count); activity_dump (root_activity); } @@ -242,16 +242,16 @@ activity_destroy (struct activity *activity, struct activity *victim) /* Remove from parent's activity list. */ struct activity *parent = victim->parent; - assert ((struct object *) parent + assert ((struct vg_object *) parent == vg_cap_to_object (activity, &victim->parent_cap)); - struct object *prev_object = vg_cap_to_object (activity, + struct vg_object *prev_object = vg_cap_to_object (activity, &victim->sibling_prev_cap); assert (! prev_object || object_to_object_desc (prev_object)->type == vg_cap_activity_control); struct activity *prev = (struct activity *) prev_object; - struct object *next_object = vg_cap_to_object (activity, + struct vg_object *next_object = vg_cap_to_object (activity, &victim->sibling_next_cap); assert (! next_object || object_to_object_desc (next_object)->type == vg_cap_activity_control); @@ -263,7 +263,7 @@ activity_destroy (struct activity *activity, struct activity *victim) /* VICTIM is the head of PARENT's child list. */ { assert (vg_cap_to_object (activity, &parent->children_cap) - == (struct object *) victim); + == (struct vg_object *) victim); parent->children_cap = victim->sibling_next_cap; } @@ -379,7 +379,7 @@ activity_deprepare (struct activity *principal, struct activity *victim) void activity_policy_update (struct activity *activity, - struct activity_policy policy) + struct vg_activity_policy policy) { int priority = policy.sibling_rel.priority; @@ -453,7 +453,7 @@ do_activity_dump (struct activity *activity, int indent) "pending eviction: %d/%d); total: %d; " "%d free allocs, %d karma, %d excluded, s:%d/%d; c:%d/%d\n", indent_string, - OBJECT_NAME_PRINTF ((struct object *) activity), + OBJECT_NAME_PRINTF ((struct vg_object *) activity), activity->frames_local, active, inactive, clean, dirty, activity->frames_total, activity->free_allocations, diff --git a/viengoos/activity.h b/viengoos/activity.h index 0bbb62d..3140a84 100644 --- a/viengoos/activity.h +++ b/viengoos/activity.h @@ -52,7 +52,7 @@ struct activity struct vg_cap folios; /* Policy. */ - struct activity_policy policy; + struct vg_activity_policy policy; /* Number of folios allocated to this activity (including children). */ @@ -113,7 +113,7 @@ struct activity /* Statistics. */ /* The current period. */ unsigned char current_period; - struct activity_stats stats[ACTIVITY_STATS_PERIODS + 1]; + struct vg_activity_stats stats[VG_ACTIVITY_STATS_PERIODS + 1]; /* When an activity is choosen to yield pages, we first send it a signal asking it to free memory. We exclude it from eviction for @@ -130,7 +130,7 @@ struct activity when looking for a process to page. */ uintptr_t frames_excluded; - struct object_name name; + struct vg_object_name name; }; LIST_CLASS(activity_children, struct activity, sibling, false) @@ -187,7 +187,7 @@ extern void activity_deprepare (struct activity *principal, /* Set ACTIVITY's policy to POLICY. */ extern void activity_policy_update (struct activity *activity, - struct activity_policy policy); + struct vg_activity_policy policy); /* Starting with ACTIVITY and for each direct ancestor execute CODE. diff --git a/viengoos/ager.c b/viengoos/ager.c index 340410d..fe5b2d0 100644 --- a/viengoos/ager.c +++ b/viengoos/ager.c @@ -74,7 +74,7 @@ update_stats (void) damping factor and the pressure. */ void stats (struct activity *activity, uint32_t frames) { - struct activity_stats *s = ACTIVITY_STATS (activity); + struct vg_activity_stats *s = ACTIVITY_STATS (activity); s->period = period / FREQ; @@ -102,7 +102,7 @@ update_stats (void) debug (5, "Due to pressure (%d), decreasing frames available " "to " OBJECT_NAME_FMT " from %d to %d", ACTIVITY_STATS (activity)->pressure, - OBJECT_NAME_PRINTF ((struct object *) activity), + OBJECT_NAME_PRINTF ((struct vg_object *) activity), frames, frames - dec); frames -= dec; @@ -301,7 +301,7 @@ update_stats (void) "share: %d, excess: %d, unused: %d, " "could steal: %d, could use: %d, free: %d, avail: %d", period / FREQ, - OBJECT_NAME_PRINTF ((struct object *) activity), + OBJECT_NAME_PRINTF ((struct vg_object *) activity), my_alloced, alloced, priority, my_weight, weight, frames, my_claimed, my_disowned, share, excess, unused, could_steal, could_use, free, avail); @@ -326,7 +326,7 @@ update_stats (void) debug (5, "Due to local pressure (%d), decreasing frames " "available to " OBJECT_NAME_FMT " from %d to %d", ACTIVITY_STATS (activity)->pressure_local, - OBJECT_NAME_PRINTF ((struct object *) activity), + OBJECT_NAME_PRINTF ((struct vg_object *) activity), avail, avail - dec); avail -= dec; @@ -360,8 +360,8 @@ update_stats (void) ACTIVITY_STATS (p)->claimed, ACTIVITY_STATS (p)->disowned)); - struct activity_stats *stats = ACTIVITY_STATS (activity); - struct activity_stats *cstats = ACTIVITY_STATS (activity); + struct vg_activity_stats *stats = ACTIVITY_STATS (activity); + struct vg_activity_stats *cstats = ACTIVITY_STATS (activity); stats->clean += cstats->clean; stats->dirty += cstats->dirty; @@ -381,7 +381,7 @@ update_stats (void) debug (5, OBJECT_NAME_FMT " (s: %d/%d; c: %d/%d): " "%d/%d frames, %d/%d avail, %d free goal, %d bad_karma " "(" OBJECT_NAME_FMT ")", - OBJECT_NAME_PRINTF ((struct object *) activity), + OBJECT_NAME_PRINTF ((struct vg_object *) activity), activity->policy.sibling_rel.priority, activity->policy.sibling_rel.weight, activity->policy.child_rel.priority, @@ -391,11 +391,11 @@ update_stats (void) ACTIVITY_STATS (activity)->available_local, ACTIVITY_STATS (activity)->available, activity->free_goal, activity->free_bad_karma, - OBJECT_NAME_PRINTF ((struct object *) + OBJECT_NAME_PRINTF ((struct vg_object *) (activity->parent ?: root_activity))); activity->current_period ++; - if (activity->current_period == ACTIVITY_STATS_PERIODS + 1) + if (activity->current_period == VG_ACTIVITY_STATS_PERIODS + 1) activity->current_period = 0; memset (ACTIVITY_STATS (activity), @@ -403,29 +403,29 @@ update_stats (void) /* Wake anyone waiting for this statistic. */ struct messenger *messenger; - object_wait_queue_for_each (activity, (struct object *) activity, + object_wait_queue_for_each (activity, (struct vg_object *) activity, messenger) if (messenger->wait_reason == MESSENGER_WAIT_ACTIVITY_INFO - && (messenger->wait_reason_arg & activity_info_stats) + && (messenger->wait_reason_arg & vg_activity_info_stats) && messenger->wait_reason_arg2 <= period / FREQ) { object_wait_queue_unlink (activity, messenger); /* XXX: Only return valid stat buffers. */ - struct activity_info info; - info.event = activity_info_stats; + struct vg_activity_info info; + info.event = vg_activity_info_stats; int i; - for (i = 0; i < ACTIVITY_STATS_PERIODS; i ++) + for (i = 0; i < VG_ACTIVITY_STATS_PERIODS; i ++) { int period = activity->current_period - 1 - i; if (period < 0) - period = (ACTIVITY_STATS_PERIODS + 1) + period; + period = (VG_ACTIVITY_STATS_PERIODS + 1) + period; info.stats.stats[i] = activity->stats[period]; } - info.stats.count = ACTIVITY_STATS_PERIODS; + info.stats.count = VG_ACTIVITY_STATS_PERIODS; vg_activity_info_reply (root_activity, messenger, info); } @@ -454,7 +454,7 @@ ager_loop (void) #define BATCH_SIZE (L4_NUM_MRS / 2) struct object_desc *descs[BATCH_SIZE]; - struct object *objects[BATCH_SIZE]; + struct vg_object *objects[BATCH_SIZE]; l4_fpage_t fpages[BATCH_SIZE]; bool also_unmap; diff --git a/viengoos/cap.c b/viengoos/cap.c index fcd92d8..80c5d34 100644 --- a/viengoos/cap.c +++ b/viengoos/cap.c @@ -37,7 +37,7 @@ const int cap_type_num_slots[] = { [vg_cap_void] = 0, [vg_cap_activity_control] = 0, [vg_cap_thread] = VG_THREAD_SLOTS }; -static struct object * +static struct vg_object * cap_to_object_internal (struct activity *activity, struct vg_cap *cap, bool hard) { @@ -46,7 +46,7 @@ cap_to_object_internal (struct activity *activity, struct vg_cap *cap, /* XXX: If CAP does not grant write access, then we need to flatten the discardable bit. */ - struct object *object; + struct vg_object *object; if (hard) { object = object_find (activity, cap->oid, VG_CAP_POLICY_GET (*cap)); @@ -73,13 +73,13 @@ cap_to_object_internal (struct activity *activity, struct vg_cap *cap, return object; } -struct object * +struct vg_object * vg_cap_to_object (struct activity *activity, struct vg_cap *cap) { return cap_to_object_internal (activity, cap, true); } -struct object * +struct vg_object * cap_to_object_soft (struct activity *activity, struct vg_cap *cap) { return cap_to_object_internal (activity, cap, false); @@ -95,7 +95,7 @@ cap_shootdown (struct activity *activity, struct vg_cap *root) void doit (struct vg_cap *cap, int remaining) { int i; - struct object *object; + struct vg_object *object; remaining -= VG_CAP_GUARD_BITS (cap); @@ -187,7 +187,7 @@ cap_shootdown (struct activity *activity, struct vg_cap *root) if (! object) return; - struct folio *folio = (struct folio *) object; + struct vg_folio *folio = (struct vg_folio *) object; struct object_desc *fdesc = object_to_object_desc (object); vg_oid_t foid = fdesc->oid; diff --git a/viengoos/cap.h b/viengoos/cap.h index d8da9a3..8ce0820 100644 --- a/viengoos/cap.h +++ b/viengoos/cap.h @@ -33,22 +33,22 @@ static inline bool 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 vg_cap_copy (activity, - VG_ADDR_VOID, target, VG_ADDR_VOID, - VG_ADDR_VOID, source, VG_ADDR_VOID); + return vg_cap_copy_simple (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 vg_cap *cap); /* Return the object designated by CAP, if any. */ -struct object *vg_cap_to_object (struct activity *activity, - struct vg_cap *cap); +struct vg_object *vg_cap_to_object (struct activity *activity, + struct vg_cap *cap); /* 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 vg_cap *cap); +struct vg_object *cap_to_object_soft (struct activity *activity, + struct vg_cap *cap); diff --git a/viengoos/memory.c b/viengoos/memory.c index 54997ff..faa50c3 100644 --- a/viengoos/memory.c +++ b/viengoos/memory.c @@ -381,7 +381,7 @@ memory_frame_allocate (struct activity *activity) assert (desc->live); assert (desc->eviction_candidate); assert (desc->activity); - assert (object_type ((struct object *) desc->activity) + assert (object_type ((struct vg_object *) desc->activity) == vg_cap_activity_control); assert (! desc->dirty || desc->policy.discardable); assert (! desc->mapped); @@ -389,9 +389,9 @@ memory_frame_allocate (struct activity *activity) 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); + struct vg_object *object = object_desc_to_object (desc); - struct folio *folio = objects_folio (activity, object); + struct vg_folio *folio = objects_folio (activity, object); int offset = objects_folio_offset (object); bool discarded = desc->dirty; diff --git a/viengoos/messenger.c b/viengoos/messenger.c index 03bfb7e..22d5169 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) == vg_cap_messenger); + assert (object_type ((struct vg_object *) target) == vg_cap_messenger); if (source) - assert (object_type ((struct object *) source) == vg_cap_messenger); + assert (object_type ((struct vg_object *) source) == vg_cap_messenger); if (source) assert (! smessage); @@ -77,7 +77,7 @@ messenger_load_internal (struct activity *activity, assert (source); source->wait_reason = MESSENGER_WAIT_TRANSFER_MESSAGE; - object_wait_queue_enqueue (activity, (struct object *) target, source); + object_wait_queue_enqueue (activity, (struct vg_object *) target, source); return true; } @@ -308,10 +308,10 @@ messenger_message_deliver (struct activity *activity, return false; } - if (object_type ((struct object *) thread) != vg_cap_thread) + if (object_type ((struct vg_object *) thread) != vg_cap_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))); + vg_cap_type_string (object_type ((struct vg_object *) thread))); return false; } @@ -327,7 +327,7 @@ messenger_unblock (struct activity *activity, struct messenger *messenger) messenger->blocked = 0; struct messenger *m; - object_wait_queue_for_each (activity, (struct object *) messenger, m) + object_wait_queue_for_each (activity, (struct vg_object *) messenger, m) if (m->wait_reason == MESSENGER_WAIT_TRANSFER_MESSAGE) { object_wait_queue_unlink (activity, m); diff --git a/viengoos/object.c b/viengoos/object.c index 5587731..a5fd815 100644 --- a/viengoos/object.c +++ b/viengoos/object.c @@ -62,9 +62,9 @@ static struct hurd_ihash objects; void object_init (void) { - build_assert (sizeof (struct folio) <= PAGESIZE); + build_assert (sizeof (struct vg_folio) <= PAGESIZE); build_assert (sizeof (struct activity) <= PAGESIZE); - build_assert (sizeof (struct object) <= PAGESIZE); + build_assert (sizeof (struct vg_object) <= PAGESIZE); build_assert (sizeof (struct thread) <= PAGESIZE); /* 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); @@ -103,11 +103,11 @@ object_init (void) /* Allocate and set up a memory object. TYPE, OID and VERSION must correspond to the values storage on disk. */ -static struct object * +static struct vg_object * memory_object_alloc (struct activity *activity, enum vg_cap_type type, vg_oid_t oid, l4_word_t version, - struct object_policy policy) + struct vg_object_policy policy) { debug (5, "Allocating %llx(%d), %s", oid, version, vg_cap_type_string (type)); @@ -115,7 +115,7 @@ memory_object_alloc (struct activity *activity, 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); + struct vg_object *object = (struct vg_object *) memory_frame_allocate (activity); if (! object) { /* XXX: Do some garbage collection. */ @@ -160,7 +160,7 @@ memory_object_alloc (struct activity *activity, } void -memory_object_destroy (struct activity *activity, struct object *object) +memory_object_destroy (struct activity *activity, struct vg_object *object) { assert (activity); @@ -206,21 +206,21 @@ memory_object_destroy (struct activity *activity, struct object *object) #endif } -struct object * +struct vg_object * object_find_soft (struct activity *activity, vg_oid_t oid, - struct object_policy policy) + struct vg_object_policy policy) { struct object_desc *odesc = hurd_ihash_find (&objects, oid); if (! odesc) return NULL; - struct object *object = object_desc_to_object (odesc); + struct vg_object *object = object_desc_to_object (odesc); assert (oid == odesc->oid); if (oid % (VG_FOLIO_OBJECTS + 1) != 0) { #ifndef NDEBUG - struct folio *folio = objects_folio (activity, object); + struct vg_folio *folio = objects_folio (activity, object); int i = objects_folio_offset (object); assertx (vg_folio_object_type (folio, i) == odesc->type, @@ -258,15 +258,15 @@ object_find_soft (struct activity *activity, vg_oid_t oid, return object; } -struct object * +struct vg_object * object_find (struct activity *activity, vg_oid_t oid, - struct object_policy policy) + struct vg_object_policy policy) { - struct object *obj = object_find_soft (activity, oid, policy); + struct vg_object *obj = object_find_soft (activity, oid, policy); if (obj) return obj; - struct folio *folio; + struct vg_folio *folio; int page = (oid % (VG_FOLIO_OBJECTS + 1)) - 1; if (page == -1) @@ -286,7 +286,7 @@ object_find (struct activity *activity, vg_oid_t oid, else { /* Find the folio corresponding to the object. */ - folio = (struct folio *) object_find (activity, oid - page - 1, + folio = (struct vg_folio *) object_find (activity, oid - page - 1, VG_OBJECT_POLICY_DEFAULT); assertx (folio, "Didn't find folio " VG_OID_FMT, @@ -315,12 +315,12 @@ object_find (struct activity *activity, vg_oid_t oid, } void -folio_parent (struct activity *activity, struct folio *folio) +folio_parent (struct activity *activity, struct vg_folio *folio) { /* Some sanity checks. */ assert (({ struct object_desc *desc; - desc = object_to_object_desc ((struct object *) folio); + desc = object_to_object_desc ((struct vg_object *) folio); assert (desc->oid % (VG_FOLIO_OBJECTS + 1) == 0); true; })); @@ -329,7 +329,7 @@ folio_parent (struct activity *activity, struct folio *folio) assert (! vg_cap_to_object (activity, &folio->prev)); assert (({ struct object_desc *desc; - desc = object_to_object_desc ((struct object *) folio); + desc = object_to_object_desc ((struct vg_object *) folio); if (desc->oid != 0) /* Only the very first folio may have objects allocated out of it before it is parented. */ @@ -343,20 +343,20 @@ folio_parent (struct activity *activity, struct folio *folio) })); /* Record the owner. */ - folio->activity = object_to_cap ((struct object *) activity); + folio->activity = object_to_cap ((struct vg_object *) activity); /* Add FOLIO to ACTIVITY's folio list. */ /* Update the old head's previous pointer. */ - struct object *head = vg_cap_to_object (activity, &activity->folios); + struct vg_object *head = vg_cap_to_object (activity, &activity->folios); if (head) { /* It shouldn't have a previous pointer. */ - struct object *prev = vg_cap_to_object (activity, - &((struct folio *) head)->prev); + struct vg_object *prev = vg_cap_to_object (activity, + &((struct vg_folio *) head)->prev); assert (! prev); - ((struct folio *) head)->prev = object_to_cap ((struct object *) folio); + ((struct vg_folio *) head)->prev = object_to_cap ((struct vg_object *) folio); } /* Point FOLIO->NEXT to the old head. */ @@ -366,13 +366,13 @@ folio_parent (struct activity *activity, struct folio *folio) folio->prev.type = vg_cap_void; /* Finally, set ACTIVITY->FOLIOS to the new head. */ - activity->folios = object_to_cap ((struct object *) folio); + activity->folios = object_to_cap ((struct vg_object *) folio); assert (vg_cap_to_object (activity, &activity->folios) - == (struct object *) folio); + == (struct vg_object *) folio); } -struct folio * -folio_alloc (struct activity *activity, struct folio_policy policy) +struct vg_folio * +folio_alloc (struct activity *activity, struct vg_folio_policy policy) { if (! activity) assert (! root_activity); @@ -414,7 +414,7 @@ folio_alloc (struct activity *activity, struct folio_policy policy) /* 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, + struct vg_folio *folio = (struct vg_folio *) object_find (activity, foid, VG_OBJECT_POLICY_DEFAULT); if (activity) @@ -426,19 +426,19 @@ folio_alloc (struct activity *activity, struct folio_policy policy) } void -folio_free (struct activity *activity, struct folio *folio) +folio_free (struct activity *activity, struct vg_folio *folio) { /* Make sure that FOLIO appears on its owner's folio list. */ assert (({ struct activity *owner = (struct activity *) vg_cap_to_object (activity, &folio->activity); assert (owner); - assert (object_type ((struct object *) owner) == vg_cap_activity_control); - struct folio *f; - 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 vg_object *) owner) == vg_cap_activity_control); + struct vg_folio *f; + for (f = (struct vg_folio *) vg_cap_to_object (activity, &owner->folios); + f; f = (struct vg_folio *) vg_cap_to_object (activity, &f->next)) { - assert (object_type ((struct object *) folio) == vg_cap_folio); + assert (object_type ((struct vg_object *) folio) == vg_cap_folio); if (f == folio) break; } @@ -450,7 +450,7 @@ folio_free (struct activity *activity, struct folio *folio) the storage for it. We use it as the entity who should pay for the paging activity, etc. */ - struct object_desc *fdesc = object_to_object_desc ((struct object *) folio); + struct object_desc *fdesc = object_to_object_desc ((struct vg_object *) folio); assert (fdesc->type == vg_cap_folio); assert (fdesc->oid % (VG_FOLIO_OBJECTS + 1) == 0); @@ -477,8 +477,8 @@ folio_free (struct activity *activity, struct folio *folio) folio->activity.type = vg_cap_void; /* Remove FOLIO from its owner's folio list. */ - struct folio *next = (struct folio *) vg_cap_to_object (activity, &folio->next); - struct folio *prev = (struct folio *) vg_cap_to_object (activity, &folio->prev); + struct vg_folio *next = (struct vg_folio *) vg_cap_to_object (activity, &folio->next); + struct vg_folio *prev = (struct vg_folio *) vg_cap_to_object (activity, &folio->prev); if (prev) prev->next = folio->next; @@ -504,17 +504,17 @@ folio_free (struct activity *activity, struct folio *folio) struct vg_cap folio_object_alloc (struct activity *activity, - struct folio *folio, + struct vg_folio *folio, int idx, enum vg_cap_type type, - struct object_policy policy, + struct vg_object_policy policy, uintptr_t return_code) { assert (0 <= idx && idx < VG_FOLIO_OBJECTS); type = vg_cap_type_strengthen (type); - struct object_desc *fdesc = object_to_object_desc ((struct object *) folio); + struct object_desc *fdesc = object_to_object_desc ((struct vg_object *) folio); assert (fdesc->type == vg_cap_folio); assert (fdesc->oid % (1 + VG_FOLIO_OBJECTS) == 0); @@ -524,7 +524,7 @@ folio_object_alloc (struct activity *activity, vg_oid_t oid = fdesc->oid + 1 + idx; - struct object *object = NULL; + struct vg_object *object = NULL; /* Deallocate any existing object. */ @@ -667,9 +667,9 @@ folio_object_alloc (struct activity *activity, void folio_policy (struct activity *activity, - struct folio *folio, - uintptr_t flags, struct folio_policy in, - struct folio_policy *out) + struct vg_folio *folio, + uintptr_t flags, struct vg_folio_policy in, + struct vg_folio_policy *out) { if ((flags & VG_FOLIO_POLICY_DELIVER) && out) { @@ -696,11 +696,11 @@ folio_policy (struct activity *activity, void object_desc_claim (struct activity *activity, struct object_desc *desc, - struct object_policy policy, bool update_accounting) + struct vg_object_policy policy, bool update_accounting) { assert (desc->activity || activity); - struct object_policy o = desc->policy; + struct vg_object_policy o = desc->policy; bool ec = desc->eviction_candidate; #ifndef NDEBUG @@ -775,14 +775,14 @@ object_desc_claim (struct activity *activity, struct object_desc *desc, if (desc->activity) { debug (5, VG_OID_FMT " claims from " VG_OID_FMT, - VG_OID_PRINTF (object_to_object_desc ((struct object *) desc + VG_OID_PRINTF (object_to_object_desc ((struct vg_object *) desc ->activity)->oid), VG_OID_PRINTF (activity - ? object_to_object_desc ((struct object *) + ? object_to_object_desc ((struct vg_object *) activity)->oid : 0)); - assert (object_type ((struct object *) desc->activity) + assert (object_type ((struct vg_object *) desc->activity) == vg_cap_activity_control); if (desc->eviction_candidate) @@ -838,7 +838,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc, /* The activity met the free goal! */ { debug (0, DEBUG_BOLD (OBJECT_NAME_FMT " met goal."), - OBJECT_NAME_PRINTF ((struct object *) desc->activity)); + OBJECT_NAME_PRINTF ((struct vg_object *) desc->activity)); struct activity *ancestor = desc->activity; activity_for_each_ancestor @@ -884,7 +884,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc, debug (0, DEBUG_BOLD (OBJECT_NAME_FMT " failed to free %d pages."), - OBJECT_NAME_PRINTF ((struct object *) activity), + OBJECT_NAME_PRINTF ((struct vg_object *) activity), activity->free_goal); } @@ -906,7 +906,7 @@ object_desc_claim (struct activity *activity, struct object_desc *desc, desc->policy.discardable = policy.discardable; 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 (object_to_object_desc ((struct vg_object *) activity)->oid), VG_OID_PRINTF (desc->oid), vg_cap_type_string (desc->type), desc->policy.discardable ? "discardable" : "precious"); @@ -968,16 +968,16 @@ object_desc_claim (struct activity *activity, struct object_desc *desc, /* Return the first waiter queued on object OBJECT. */ struct messenger * -object_wait_queue_head (struct activity *activity, struct object *object) +object_wait_queue_head (struct activity *activity, struct vg_object *object) { - struct folio *folio = objects_folio (activity, object); + struct vg_folio *folio = objects_folio (activity, object); int i = objects_folio_offset (object); if (! folio_object_wait_queue_p (folio, i)) return NULL; vg_oid_t h = folio_object_wait_queue (folio, i); - struct object *head = object_find (activity, h, VG_OBJECT_POLICY_DEFAULT); + struct vg_object *head = object_find (activity, h, VG_OBJECT_POLICY_DEFAULT); assert (head); assert (object_type (head) == vg_cap_messenger); assert (((struct messenger *) head)->wait_queue_p); @@ -988,7 +988,7 @@ object_wait_queue_head (struct activity *activity, struct object *object) /* Return the last waiter queued on object OBJECT. */ struct messenger * -object_wait_queue_tail (struct activity *activity, struct object *object) +object_wait_queue_tail (struct activity *activity, struct vg_object *object) { struct messenger *head = object_wait_queue_head (activity, object); if (! head) @@ -1002,7 +1002,7 @@ object_wait_queue_tail (struct activity *activity, struct object *object) tail = (struct messenger *) object_find (activity, head->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT); assert (tail); - assert (object_type ((struct object *) tail) == vg_cap_messenger); + assert (object_type ((struct vg_object *) tail) == vg_cap_messenger); assert (tail->wait_queue_p); assert (tail->wait_queue_tail); @@ -1020,7 +1020,7 @@ object_wait_queue_next (struct activity *activity, struct messenger *m) next = (struct messenger *) object_find (activity, m->wait_queue.next, VG_OBJECT_POLICY_DEFAULT); assert (next); - assert (object_type ((struct object *) next) == vg_cap_messenger); + assert (object_type ((struct vg_object *) next) == vg_cap_messenger); assert (next->wait_queue_p); assert (! next->wait_queue_head); @@ -1038,7 +1038,7 @@ object_wait_queue_prev (struct activity *activity, struct messenger *m) prev = (struct messenger *) object_find (activity, m->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT); assert (prev); - assert (object_type ((struct object *) prev) == vg_cap_messenger); + assert (object_type ((struct vg_object *) prev) == vg_cap_messenger); assert (prev->wait_queue_p); assert (! prev->wait_queue_tail); @@ -1064,16 +1064,16 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger) assert (m); assert (m->wait_queue_p); assert (! m->wait_queue_head); - struct object *p = object_find (activity, m->wait_queue.prev, + struct vg_object *p = object_find (activity, m->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT); - assert (p == (struct object *) last); + assert (p == (struct vg_object *) last); last = m; } assert (last->wait_queue_tail); - struct object *o = object_find (activity, last->wait_queue.next, + struct vg_object *o = object_find (activity, last->wait_queue.next, VG_OBJECT_POLICY_DEFAULT); assert (o); assert (folio_object_wait_queue_p (objects_folio (activity, o), @@ -1103,9 +1103,9 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger) assert (m->wait_queue_p); assert (! m->wait_queue_head); - struct object *p = object_find (activity, m->wait_queue.prev, + struct vg_object *p = object_find (activity, m->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT); - assert (p == (struct object *) last); + assert (p == (struct vg_object *) last); last = m; } @@ -1114,10 +1114,10 @@ object_wait_queue_check (struct activity *activity, struct messenger *messenger) void object_wait_queue_push (struct activity *activity, - struct object *object, struct messenger *messenger) + struct vg_object *object, struct messenger *messenger) { debug (5, "Pushing " VG_OID_FMT " onto %p", - VG_OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid), + VG_OID_PRINTF (object_to_object_desc ((struct vg_object *) messenger)->oid), object); object_wait_queue_check (activity, messenger); @@ -1134,10 +1134,10 @@ object_wait_queue_push (struct activity *activity, /* OLDHEAD->PREV = MESSENGER. */ oldhead->wait_queue_head = 0; - oldhead->wait_queue.prev = object_oid ((struct object *) messenger); + oldhead->wait_queue.prev = object_oid ((struct vg_object *) messenger); /* MESSENGER->NEXT = OLDHEAD. */ - messenger->wait_queue.next = object_oid ((struct object *) oldhead); + messenger->wait_queue.next = object_oid ((struct vg_object *) oldhead); messenger->wait_queue_tail = 0; } @@ -1149,7 +1149,7 @@ object_wait_queue_push (struct activity *activity, true); /* MESSENGER->PREV = MESSENGER. */ - messenger->wait_queue.prev = object_oid ((struct object *) messenger); + messenger->wait_queue.prev = object_oid ((struct vg_object *) messenger); /* MESSENGER->NEXT = OBJECT. */ messenger->wait_queue_tail = 1; @@ -1162,17 +1162,18 @@ object_wait_queue_push (struct activity *activity, messenger->wait_queue_head = 1; folio_object_wait_queue_set (objects_folio (activity, object), objects_folio_offset (object), - object_oid ((struct object *) messenger)); + object_oid ((struct vg_object *) messenger)); object_wait_queue_check (activity, messenger); } void object_wait_queue_enqueue (struct activity *activity, - struct object *object, struct messenger *messenger) + struct vg_object *object, struct messenger *messenger) { debug (5, "Enqueueing " VG_OID_FMT " on %p", - VG_OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid), + VG_OID_PRINTF (object_to_object_desc + ((struct vg_object *) messenger)->oid), object); object_wait_queue_check (activity, messenger); @@ -1184,16 +1185,16 @@ object_wait_queue_enqueue (struct activity *activity, { /* HEAD->PREV = MESSENGER. */ struct messenger *head = object_wait_queue_head (activity, object); - head->wait_queue.prev = object_oid ((struct object *) messenger); + head->wait_queue.prev = object_oid ((struct vg_object *) messenger); assert (oldtail->wait_queue_tail); /* MESSENGER->PREV = OLDTAIL. */ - messenger->wait_queue.prev = object_oid ((struct object *) oldtail); + messenger->wait_queue.prev = object_oid ((struct vg_object *) oldtail); /* OLDTAIL->NEXT = MESSENGER. */ oldtail->wait_queue_tail = 0; - oldtail->wait_queue.next = object_oid ((struct object *) messenger); + oldtail->wait_queue.next = object_oid ((struct vg_object *) messenger); /* MESSENGER->NEXT = OBJECT. */ messenger->wait_queue.next = object_oid (object); @@ -1209,7 +1210,7 @@ object_wait_queue_enqueue (struct activity *activity, true); /* MESSENGER->PREV = MESSENGER. */ - messenger->wait_queue.prev = object_oid ((struct object *) messenger); + messenger->wait_queue.prev = object_oid ((struct vg_object *) messenger); /* MESSENGER->NEXT = OBJECT. */ messenger->wait_queue_tail = 1; @@ -1219,7 +1220,7 @@ object_wait_queue_enqueue (struct activity *activity, messenger->wait_queue_head = 1; folio_object_wait_queue_set (objects_folio (activity, object), objects_folio_offset (object), - object_oid ((struct object *) messenger)); + object_oid ((struct vg_object *) messenger)); } messenger->wait_queue_p = true; @@ -1233,7 +1234,8 @@ object_wait_queue_unlink (struct activity *activity, struct messenger *messenger) { debug (5, "Removing " VG_OID_FMT, - VG_OID_PRINTF (object_to_object_desc ((struct object *) messenger)->oid)); + VG_OID_PRINTF (object_to_object_desc + ((struct vg_object *) messenger)->oid)); assert (messenger->wait_queue_p); @@ -1243,7 +1245,7 @@ object_wait_queue_unlink (struct activity *activity, /* MESSENGER is the tail. MESSENGER->NEXT must be the object on which we are queued. */ { - struct object *object; + struct vg_object *object; object = object_find (activity, messenger->wait_queue.next, VG_OBJECT_POLICY_DEFAULT); assert (object); @@ -1257,7 +1259,7 @@ object_wait_queue_unlink (struct activity *activity, { assert (object_find (activity, messenger->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT) - == (struct object *) messenger); + == (struct vg_object *) messenger); folio_object_wait_queue_p_set (objects_folio (activity, object), objects_folio_offset (object), @@ -1271,7 +1273,7 @@ object_wait_queue_unlink (struct activity *activity, /* HEAD->PREV == TAIL. */ assert (object_find (activity, head->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT) - == (struct object *) messenger); + == (struct vg_object *) messenger); /* HEAD->PREV = TAIL->PREV. */ head->wait_queue.prev = messenger->wait_queue.prev; @@ -1282,7 +1284,7 @@ object_wait_queue_unlink (struct activity *activity, messenger->wait_queue.prev, VG_OBJECT_POLICY_DEFAULT); assert (prev); - assert (object_type ((struct object *) prev) == vg_cap_messenger); + assert (object_type ((struct vg_object *) prev) == vg_cap_messenger); prev->wait_queue_tail = 1; prev->wait_queue.next = messenger->wait_queue.next; @@ -1294,8 +1296,8 @@ object_wait_queue_unlink (struct activity *activity, struct messenger *next = object_wait_queue_next (activity, messenger); assert (next); - struct object *p = object_find (activity, messenger->wait_queue.prev, - VG_OBJECT_POLICY_DEFAULT); + struct vg_object *p = object_find (activity, messenger->wait_queue.prev, + VG_OBJECT_POLICY_DEFAULT); assert (p); assert (object_type (p) == vg_cap_messenger); struct messenger *prev = (struct messenger *) p; @@ -1306,8 +1308,9 @@ object_wait_queue_unlink (struct activity *activity, /* MESSENGER->PREV is the tail, TAIL->NEXT the object. */ struct messenger *tail = prev; - struct object *object = object_find (activity, tail->wait_queue.next, - VG_OBJECT_POLICY_DEFAULT); + struct vg_object *object + = object_find (activity, tail->wait_queue.next, + 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 0e7978d..789e35d 100644 --- a/viengoos/object.h +++ b/viengoos/object.h @@ -150,7 +150,7 @@ struct object_desc /* The object's policy. Set when the object is claimed using the value in the capability referencing the object. */ - struct object_policy policy; + struct vg_object_policy policy; /* The object's age. */ uint8_t age; @@ -262,8 +262,8 @@ extern struct available_list available; /* Sort lower priority objects towards the start. */ static int -priority_compare (const struct object_policy *a, - const struct object_policy *b) +priority_compare (const struct vg_object_policy *a, + const struct vg_object_policy *b) { /* XXX: We should actually compare on priority and then on age. To allowing finding an object with a particular priority but any @@ -272,7 +272,7 @@ priority_compare (const struct object_policy *a, } BTREE_CLASS (priorities, struct object_desc, - struct object_policy, policy, priority_node, + struct vg_object_policy, policy, priority_node, priority_compare, true); /* Initialize the object sub-system. Must be called after grabbing @@ -281,14 +281,14 @@ 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, vg_oid_t oid, - struct object_policy policy); +extern struct vg_object *object_find (struct activity *activity, vg_oid_t oid, + struct vg_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, - vg_oid_t oid, - struct object_policy policy); +extern struct vg_object *object_find_soft (struct activity *activity, + vg_oid_t oid, + struct vg_object_policy policy); /* Destroy the object OBJECT. Any changes must have already been flushed to disk. LRU_LOCK must not be held, this function will @@ -296,7 +296,7 @@ extern struct object *object_find_soft (struct activity *activity, responsibility to ensure that memory_frame_free is eventually called. */ extern void memory_object_destroy (struct activity *activity, - struct object *object); + struct vg_object *object); /* Return the object corresponding to the object descriptor DESC. */ #define object_desc_to_object(desc_) \ @@ -310,7 +310,7 @@ extern void memory_object_destroy (struct activity *activity, <= (uintptr_t) &object_descs[(last_frame - first_frame) \ / PAGESIZE]); \ \ - (struct object *) (first_frame \ + (struct vg_object *) (first_frame \ + (((uintptr_t) (desc__) - (uintptr_t) object_descs) \ / sizeof (struct object_desc)) * PAGESIZE); \ }) @@ -319,7 +319,7 @@ extern void memory_object_destroy (struct activity *activity, OBJECT. */ #define object_to_object_desc(object_) \ ({ \ - struct object *object__ = (object_); \ + struct vg_object *object__ = (object_); \ /* Objects better be on a page boundary. */ \ assert (((uintptr_t) (object__) & (PAGESIZE - 1)) == 0); \ /* And they better be in memory. */ \ @@ -352,19 +352,19 @@ object_desc_to_cap (struct object_desc *desc) /* Return a vg_cap referencing the object OBJECT. */ static inline struct vg_cap -object_to_cap (struct object *object) +object_to_cap (struct vg_object *object) { return object_desc_to_cap (object_to_object_desc (object)); } static inline vg_oid_t -object_oid (struct object *object) +object_oid (struct vg_object *object) { return object_to_object_desc (object)->oid; } static inline enum vg_cap_type -object_type (struct object *object) +object_type (struct vg_object *object) { return object_to_object_desc (object)->type; } @@ -378,7 +378,7 @@ object_desc_unmap (struct object_desc *desc) if (desc->mapped) { #ifndef _L4_TEST_ENVIRONMENT - struct object *object = object_desc_to_object (desc); + struct vg_object *object = object_desc_to_object (desc); l4_fpage_t fpage = l4_fpage ((l4_word_t) object, PAGESIZE); fpage = l4_fpage_add_rights (fpage, L4_FPAGE_FULLY_ACCESSIBLE); @@ -406,7 +406,7 @@ object_desc_flush (struct object_desc *desc, bool clear_kernel) /* We only need to see if we dirtied or referenced it. */ { #ifndef _L4_TEST_ENVIRONMENT - struct object *object = object_desc_to_object (desc); + struct vg_object *object = object_desc_to_object (desc); l4_fpage_t fpage = l4_fpage ((l4_word_t) object, PAGESIZE); l4_fpage_t result = l4_flush (fpage); @@ -427,13 +427,13 @@ object_desc_flush (struct object_desc *desc, bool clear_kernel) held. */ extern void object_desc_claim (struct activity *activity, struct object_desc *desc, - struct object_policy policy, + struct vg_object_policy policy, bool update_accounting); /* See object_desc_claim. */ static inline void -object_claim (struct activity *activity, struct object *object, - struct object_policy policy, bool update_accounting) +object_claim (struct activity *activity, struct vg_object *object, + struct vg_object_policy policy, bool update_accounting) { object_desc_claim (activity, object_to_object_desc (object), policy, update_accounting); @@ -457,14 +457,14 @@ object_active (struct object_desc *desc) /* Allocate a folio to activity ACTIVITY. POLICY is the new folio's initial storage policy. Returns NULL if not possible. Otherwise a pointer to the in-memory folio. */ -extern struct folio *folio_alloc (struct activity *activity, - struct folio_policy policy); +extern struct vg_folio *folio_alloc (struct activity *activity, + struct vg_folio_policy policy); /* Assign the storage designated by FOLIO to the activity ACTIVITY. */ -extern void folio_parent (struct activity *activity, struct folio *folio); +extern void folio_parent (struct activity *activity, struct vg_folio *folio); /* Destroy the folio FOLIO. */ -extern void folio_free (struct activity *activity, struct folio *folio); +extern void folio_free (struct activity *activity, struct vg_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. @@ -474,15 +474,15 @@ extern void folio_free (struct activity *activity, struct folio *folio); then the in-memory location of the object is returned in *OBJECTP. */ extern struct vg_cap folio_object_alloc (struct activity *activity, - struct folio *folio, int page, - enum vg_cap_type type, - struct object_policy policy, - uintptr_t return_code); + struct vg_folio *folio, int page, + enum vg_cap_type type, + struct vg_object_policy policy, + uintptr_t return_code); /* Deallocate the object stored in page PAGE of folio FOLIO. */ static inline void folio_object_free (struct activity *activity, - struct folio *folio, int page) + struct vg_folio *folio, int page) { folio_object_alloc (activity, folio, page, vg_cap_void, VG_OBJECT_POLICY_VOID, 0); @@ -490,7 +490,7 @@ folio_object_free (struct activity *activity, /* Return an object's position within its folio. */ static inline int -objects_folio_offset (struct object *object) +objects_folio_offset (struct vg_object *object) { struct object_desc *desc = object_to_object_desc (object); @@ -498,8 +498,8 @@ objects_folio_offset (struct object *object) } /* Return the folio corresponding to the object OBJECT. */ -static inline struct folio * -objects_folio (struct activity *activity, struct object *object) +static inline struct vg_folio * +objects_folio (struct activity *activity, struct vg_object *object) { struct object_desc *odesc = object_to_object_desc (object); @@ -509,20 +509,20 @@ objects_folio (struct activity *activity, struct object *object) if (odesc->maybe_folio_desc && odesc->maybe_folio_desc->live && odesc->maybe_folio_desc->oid == foid) - return (struct folio *) object_desc_to_object (odesc->maybe_folio_desc); + return (struct vg_folio *) object_desc_to_object (odesc->maybe_folio_desc); - struct folio *folio = (struct folio *) object_find (activity, foid, + struct vg_folio *folio = (struct vg_folio *) object_find (activity, foid, VG_OBJECT_POLICY_VOID); assert (folio); - odesc->maybe_folio_desc = object_to_object_desc ((struct object *) folio); + odesc->maybe_folio_desc = object_to_object_desc ((struct vg_object *) folio); return folio; } /* Deallocate the object OBJECT. */ static inline void -object_free (struct activity *activity, struct object *object) +object_free (struct activity *activity, struct vg_object *object) { folio_object_free (activity, objects_folio (activity, object), objects_folio_offset (object)); @@ -531,17 +531,17 @@ object_free (struct activity *activity, struct object *object) /* Get and set folio FOLIO's storage policy according to flags FLAGS, IN and OUT. */ extern void folio_policy (struct activity *activity, - struct folio *folio, - uintptr_t flags, struct folio_policy in, - struct folio_policy *out); + struct vg_folio *folio, + uintptr_t flags, struct vg_folio_policy in, + struct vg_folio_policy *out); /* Return the first waiter queued on object OBJECT. */ extern struct messenger *object_wait_queue_head (struct activity *activity, - struct object *object); + struct vg_object *object); /* Return the last waiter queued on object OBJECT. */ extern struct messenger *object_wait_queue_tail (struct activity *activity, - struct object *object); + struct vg_object *object); /* Return the waiter following MESSENGER. */ extern struct messenger *object_wait_queue_next (struct activity *activity, @@ -554,13 +554,13 @@ extern struct messenger *object_wait_queue_prev (struct activity *activity, /* Push the messenger MESSENGER onto object OBJECT's wait queue (i.e., add it to the front of the wait queue). */ extern void object_wait_queue_push (struct activity *activity, - struct object *object, + struct vg_object *object, struct messenger *messenger); /* Enqueue the messenger MESSENGER on object OBJECT's wait queue (i.e., add it to the end of the wait queue). */ extern void object_wait_queue_enqueue (struct activity *activity, - struct object *object, + struct vg_object *object, struct messenger *messenger); /* Unlink messenger MESSENGER from its wait queue. */ diff --git a/viengoos/pager.c b/viengoos/pager.c index 567950c..e8bf870 100644 --- a/viengoos/pager.c +++ b/viengoos/pager.c @@ -33,7 +33,7 @@ static void is_clean (struct object_desc *desc) { #ifndef NDEBUG - struct object *object = object_desc_to_object (desc); + struct vg_object *object = object_desc_to_object (desc); l4_fpage_t result = l4_unmap_fpage (l4_fpage ((l4_word_t) object, PAGESIZE)); assertx (! l4_was_written (result) && ! l4_was_referenced (result), @@ -94,7 +94,7 @@ reclaim_from (struct activity *victim, int goal) debug (5, "Reclaiming %d from " OBJECT_NAME_FMT ", %d frames " "(global: avail: %d, laundry: %d)", - goal, OBJECT_NAME_PRINTF ((struct object *) victim), + goal, OBJECT_NAME_PRINTF ((struct vg_object *) victim), victim->frames_local, available_list_count (&available), laundry_list_count (&laundry)); @@ -197,7 +197,7 @@ reclaim_from (struct activity *victim, int goal) debug (5, "Reclaimed from " OBJECT_NAME_FMT ": goal: %d; %d frames; " DEBUG_BOLD ("%d in laundry, %d made available (%d discarded)") " " "(now: free: %d, avail: %d, laundry: %d)", - OBJECT_NAME_PRINTF ((struct object *) victim), goal, + OBJECT_NAME_PRINTF ((struct vg_object *) victim), goal, victim->frames_local, laundry_count, count - laundry_count, discarded, zalloc_memory, available_list_count (&available), @@ -251,7 +251,7 @@ pager_collect (int goal) struct activity *victim; struct activity *parent; - struct activity_memory_policy victim_policy; + struct vg_activity_memory_policy victim_policy; int victim_frames; int total_freed = 0; @@ -266,14 +266,14 @@ pager_collect (int goal) /* FRAMES is the number of frames allocated to the activity minus the number of active frames. */ bool process (struct activity *activity, - struct activity_memory_policy activity_policy, + struct vg_activity_memory_policy vg_activity_policy, int activity_frames) { debug (5, "Considering " OBJECT_NAME_FMT ": policy: %d/%d; effective frames: %d (total: %d/%d; " "pending eviction: %d/%d, active: %d/%d, available: %d/%d)", - OBJECT_NAME_PRINTF ((struct object *) activity), - activity_policy.priority, activity_policy.weight, + OBJECT_NAME_PRINTF ((struct vg_object *) activity), + vg_activity_policy.priority, vg_activity_policy.weight, activity_frames, activity->frames_total, activity->frames_local, eviction_list_count (&activity->eviction_dirty), @@ -287,7 +287,7 @@ pager_collect (int goal) /* ACTIVITY has no frames to yield; don't consider it. */ { debug (5, "Not choosing " OBJECT_NAME_FMT, - OBJECT_NAME_PRINTF ((struct object *) activity)); + OBJECT_NAME_PRINTF ((struct vg_object *) activity)); return false; } @@ -295,10 +295,10 @@ pager_collect (int goal) { victim = activity; victim_frames = activity_frames; - victim_policy = activity_policy; + victim_policy = vg_activity_policy; /* Initialize the weight. */ - weight = activity_policy.weight; + weight = vg_activity_policy.weight; frames = activity_frames; return false; @@ -306,8 +306,8 @@ pager_collect (int goal) /* We should be processing the activities in reverse priority order. */ - assertx (activity_policy.priority >= victim_policy.priority, - "%d < %d", activity_policy.priority, victim_policy.priority); + assertx (vg_activity_policy.priority >= victim_policy.priority, + "%d < %d", vg_activity_policy.priority, victim_policy.priority); if (activity->policy.sibling_rel.priority > victim_policy.priority) /* ACTIVITY has a higher absolute priority, we're done. */ @@ -319,10 +319,10 @@ pager_collect (int goal) assert (activity->policy.sibling_rel.priority == victim_policy.priority); - weight += activity_policy.weight; + weight += vg_activity_policy.weight; frames += activity_frames; - if (activity_policy.weight == victim_policy.weight) + if (vg_activity_policy.weight == victim_policy.weight) /* ACTIVITY and VICTIM have the same weight. Prefer the one with more frames. */ { @@ -330,16 +330,16 @@ pager_collect (int goal) { victim = activity; victim_frames = activity_frames; - victim_policy = activity_policy; + victim_policy = vg_activity_policy; } } else { int f = activity_frames + victim_frames; - int w = activity_policy.weight + victim_policy.weight; + int w = vg_activity_policy.weight + victim_policy.weight; int activity_excess = activity_frames - - (activity_policy.weight * f) / w; + - (vg_activity_policy.weight * f) / w; int victim_excess = victim_frames - (victim_policy.weight * f) / w; @@ -348,7 +348,7 @@ pager_collect (int goal) { victim = activity; victim_frames = activity_frames; - victim_policy = activity_policy; + victim_policy = vg_activity_policy; } } @@ -361,7 +361,7 @@ pager_collect (int goal) do { debug (5, "Current victim: " OBJECT_NAME_FMT, - OBJECT_NAME_PRINTF ((struct object *) victim)); + OBJECT_NAME_PRINTF ((struct vg_object *) victim)); parent = victim; victim = NULL; @@ -405,7 +405,7 @@ pager_collect (int goal) else debug (5, "Excluding " OBJECT_NAME_FMT ": %d free frames, %d excluded", - OBJECT_NAME_PRINTF ((struct object *) parent), + OBJECT_NAME_PRINTF ((struct vg_object *) parent), parent->free_allocations, parent->frames_excluded); } @@ -473,7 +473,7 @@ pager_collect (int goal) DEBUG_BOLD ("Revoking from activity " OBJECT_NAME_FMT ", ") "%d/%d frames (pending eviction: %d/%d), share: %d, goal: %d", zalloc_memory + available_list_count (&available), memory_total, - OBJECT_NAME_PRINTF ((struct object *) victim), + OBJECT_NAME_PRINTF ((struct vg_object *) victim), victim->frames_local, victim->frames_total, eviction_list_count (&victim->eviction_dirty), victim->frames_pending_eviction, @@ -486,9 +486,9 @@ pager_collect (int goal) bool need_reclaim = true; struct messenger *m; - object_wait_queue_for_each (victim, (struct object *) victim, m) + object_wait_queue_for_each (victim, (struct vg_object *) victim, m) if (m->wait_reason == MESSENGER_WAIT_ACTIVITY_INFO - && (m->wait_reason_arg & activity_info_pressure)) + && (m->wait_reason_arg & vg_activity_info_pressure)) break; if (m) @@ -496,7 +496,7 @@ pager_collect (int goal) debug (5, DEBUG_BOLD ("Requesting that " OBJECT_NAME_FMT " free " "%d pages.") " Karma: %d, available: %d, frames: %d", - OBJECT_NAME_PRINTF ((struct object *) victim), + OBJECT_NAME_PRINTF ((struct vg_object *) victim), goal, victim->free_bad_karma, ACTIVITY_STATS_LAST (victim)->available_local, victim->frames_local); @@ -522,15 +522,15 @@ pager_collect (int goal) total_freed += goal; - struct activity_info info; - info.event = activity_info_pressure; + struct vg_activity_info info; + info.event = vg_activity_info_pressure; info.pressure.amount = - goal; object_wait_queue_for_each (victim, - (struct object *) victim, + (struct vg_object *) victim, m) if (m->wait_reason == MESSENGER_WAIT_ACTIVITY_INFO - && (m->wait_reason_arg & activity_info_pressure)) + && (m->wait_reason_arg & vg_activity_info_pressure)) { object_wait_queue_unlink (victim, m); vg_activity_info_reply (root_activity, m, info); diff --git a/viengoos/server.c b/viengoos/server.c index 21bc244..26b73d0 100644 --- a/viengoos/server.c +++ b/viengoos/server.c @@ -225,11 +225,13 @@ server_loop (void) DEBUG (1, "Caller has no assigned activity"); continue; } - if (object_type ((struct object *) activity) != vg_cap_activity_control) + if (object_type ((struct vg_object *) activity) + != vg_cap_activity_control) { DEBUG (1, "Caller's activity slot contains a %s," "not an activity_control", - vg_cap_type_string (object_type ((struct object *) activity))); + vg_cap_type_string + (object_type ((struct vg_object *) activity))); continue; } @@ -275,18 +277,18 @@ server_loop (void) cap.discardable = false; } - struct object *page = vg_cap_to_object (activity, &cap); + struct vg_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 vg_cap_to_object. */ { 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, + struct vg_folio *folio + = (struct vg_folio *) object_find (activity, foid, VG_OBJECT_POLICY_DEFAULT); assert (folio); - assert (object_type ((struct object *) folio) == vg_cap_folio); + assert (object_type ((struct vg_object *) folio) == vg_cap_folio); if (cap.version == folio_object_version (folio, object)) { @@ -326,8 +328,9 @@ server_loop (void) info.discarded = discarded; - activation_fault_send_marshal (reply_buffer, VG_PTR_TO_ADDR (fault), - sp, ip, info, VG_ADDR_VOID); + vg_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; @@ -373,7 +376,7 @@ server_loop (void) if (! writable && cap.discardable) cap.discardable = false; - struct object *page = vg_cap_to_object (activity, &cap); + struct vg_object *page = vg_cap_to_object (activity, &cap); if (! page) break; @@ -501,7 +504,7 @@ server_loop (void) error_t OBJECT_ (struct vg_cap *root, vg_addr_t addr, int type, bool require_writable, - struct object **objectp, bool *writable) + struct vg_object **objectp, bool *writable) { bool w = true; struct vg_cap cap; @@ -539,7 +542,7 @@ server_loop (void) } #define OBJECT(root_, addr_, type_, require_writable_, writablep_) \ ({ \ - struct object *OBJECT_ret; \ + struct vg_object *OBJECT_ret; \ error_t err = OBJECT_ (root_, addr_, type_, require_writable_, \ &OBJECT_ret, writablep_); \ if (err) \ @@ -561,7 +564,7 @@ server_loop (void) /* This is annoying: 1) a thread could be in a folio so we \ can't directly lookup the slot, 2) we only want the \ thread if it matches the guard exactly. */ \ - struct object *t_; \ + struct vg_object *t_; \ error_t err = OBJECT_ (&thread->aspace, root_addr_, \ vg_cap_thread, true, &t_, NULL); \ if (! err) \ @@ -655,7 +658,7 @@ server_loop (void) CAP_ (&thread->aspace, send_buf, vg_cap_page, true, &cap); else { - struct object *object = NULL; + struct vg_object *object = NULL; OBJECT_ (&thread->aspace, send_messenger, vg_cap_messenger, true, &object, NULL); if (object) @@ -744,7 +747,7 @@ server_loop (void) } if (unlikely ((flags & VG_IPC_RECEIVE_SET_THREAD_TO_CALLER))) - messenger->thread = object_to_cap ((struct object *) thread); + messenger->thread = object_to_cap ((struct vg_object *) thread); if (unlikely ((flags & VG_IPC_RECEIVE_SET_ASROOT_TO_CALLERS))) messenger->as_root = thread->aspace; @@ -755,7 +758,7 @@ server_loop (void) MESSENGER. */ struct messenger *sender; object_wait_queue_for_each (principal, - (struct object *) messenger, sender) + (struct vg_object *) messenger, sender) if (sender->wait_reason == MESSENGER_WAIT_TRANSFER_MESSAGE) /* There is. Transfer SENDER's message to MESSENGER. */ { @@ -836,7 +839,7 @@ server_loop (void) 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); + source->thread = object_to_cap ((struct vg_object *) thread); if (unlikely ((flags & VG_IPC_SEND_SET_ASROOT_TO_CALLERS))) source->as_root = thread->aspace; @@ -844,10 +847,10 @@ server_loop (void) source->activate_on_send = (flags & VG_IPC_SEND_ACTIVATE); bool target_writable = true; - struct object *target; + struct vg_object *target; /* We special case VOID to mean the current thread. */ if (VG_ADDR_IS_VOID (target_messenger)) - target = (struct object *) thread; + target = (struct vg_object *) thread; else target = OBJECT (&thread->aspace, target_messenger, -1, false, &target_writable); @@ -862,8 +865,8 @@ server_loop (void) message. */ { 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))); + VG_OID_PRINTF (object_oid ((struct vg_object *) source)), + VG_OID_PRINTF (object_oid ((struct vg_object *) target))); if ((flags & VG_IPC_SEND_INLINE)) { @@ -980,7 +983,7 @@ server_loop (void) them. */ struct vg_cap target_root_cap; struct vg_cap *target_root; - if (likely (target == (struct object *) thread)) + if (likely (target == (struct vg_object *) thread)) target_root = &thread->aspace; else if (object_type (target) == vg_cap_thread) target_root = &((struct thread *) target)->aspace; @@ -991,16 +994,16 @@ server_loop (void) } 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)), + VG_OID_PRINTF (object_oid ((struct vg_object *) source)), + vg_cap_type_string (object_type ((struct vg_object *) source)), source->id, - VG_OID_PRINTF (object_oid ((struct object *) target)), + VG_OID_PRINTF (object_oid ((struct vg_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: " VG_OID_FMT "(%llx)", - VG_OID_PRINTF (object_oid ((struct object *) reply)), + VG_OID_PRINTF (object_oid ((struct vg_object *) reply)), reply->id); switch (label) @@ -1079,7 +1082,7 @@ server_loop (void) if (! writable && cap.discardable) cap.discardable = false; - struct object *page = vg_cap_to_object (activity, &cap); + struct vg_object *page = vg_cap_to_object (activity, &cap); if (! page) break; @@ -1125,19 +1128,19 @@ server_loop (void) struct activity *activity = (struct activity *) target; - struct folio_policy policy; + struct vg_folio_policy policy; err = vg_folio_alloc_send_unmarshal (message, &policy, NULL); if (err) REPLY (err); DEBUG (4, "(" VG_ADDR_FMT ")", VG_ADDR_PRINTF (target_messenger)); - struct folio *folio = folio_alloc (activity, policy); + struct vg_folio *folio = folio_alloc (activity, policy); if (! folio) REPLY (ENOMEM); vg_folio_alloc_reply (principal, reply, - object_to_cap ((struct object *) folio)); + object_to_cap ((struct vg_object *) folio)); break; } @@ -1146,7 +1149,7 @@ server_loop (void) if (object_type (target) != vg_cap_folio) REPLY (EINVAL); - struct folio *folio = (struct folio *) target; + struct vg_folio *folio = (struct vg_folio *) target; err = vg_folio_free_send_unmarshal (message, NULL); if (err) @@ -1165,11 +1168,11 @@ server_loop (void) if (object_type (target) != vg_cap_folio) REPLY (EINVAL); - struct folio *folio = (struct folio *) target; + struct vg_folio *folio = (struct vg_folio *) target; uint32_t idx; uint32_t type; - struct object_policy policy; + struct vg_object_policy policy; uintptr_t return_code; err = vg_folio_object_alloc_send_unmarshal (message, @@ -1212,10 +1215,10 @@ server_loop (void) if (object_type (target) != vg_cap_folio) REPLY (EINVAL); - struct folio *folio = (struct folio *) target; + struct vg_folio *folio = (struct vg_folio *) target; uintptr_t flags; - struct folio_policy in, out; + struct vg_folio_policy in, out; err = vg_folio_policy_send_unmarshal (message, &flags, &in, NULL); if (err) @@ -1311,14 +1314,14 @@ server_loop (void) /* The caller changed the policy. Also change it on the object. */ { - struct object *object = cap_to_object_soft (principal, + struct vg_object *object = cap_to_object_soft (principal, target); if (object) { struct object_desc *desc = object_to_object_desc (object); - struct object_policy p = desc->policy; + struct vg_object_policy p = desc->policy; /* XXX: This should only be allowed if TARGET grants writable access to the object. */ @@ -1357,7 +1360,7 @@ server_loop (void) if (target->type == vg_cap_rpage) cap.discardable = false; - struct object *page = cap_to_object_soft (principal, &cap); + struct vg_object *page = cap_to_object_soft (principal, &cap); if (page) { object_to_object_desc (page)->mapped = true; @@ -1454,7 +1457,7 @@ server_loop (void) int idx = (cap.oid % (1 + VG_FOLIO_OBJECTS)) - 1; vg_oid_t foid = cap.oid - idx - 1; - struct folio *folio = (struct folio *) + struct vg_folio *folio = (struct vg_folio *) object_find (activity, foid, VG_OBJECT_POLICY_VOID); if (folio_object_version (folio, idx) != cap.version) @@ -1481,7 +1484,7 @@ server_loop (void) { profile_region ("object_discard-prefault"); - struct object *page = vg_cap_to_object (principal, &cap); + struct vg_object *page = vg_cap_to_object (principal, &cap); if (page) { object_to_object_desc (page)->mapped = true; @@ -1518,7 +1521,7 @@ server_loop (void) DEBUG (4, VG_ADDR_FMT, VG_ADDR_PRINTF (target_messenger)); - struct folio *folio = objects_folio (principal, target); + struct vg_folio *folio = objects_folio (principal, target); folio_object_content_set (folio, objects_folio_offset (target), false); @@ -1538,8 +1541,8 @@ server_loop (void) 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) - | (desc->user_dirty ? object_dirty : 0); + uintptr_t status = (desc->user_referenced ? vg_object_referenced : 0) + | (desc->user_dirty ? vg_object_dirty : 0); if (clear) { @@ -1553,7 +1556,7 @@ server_loop (void) case VG_object_name: { - struct object_name name; + struct vg_object_name name; err = vg_object_name_send_unmarshal (message, &name, NULL); if (object_type (target) == vg_cap_activity_control) @@ -1581,7 +1584,7 @@ server_loop (void) REPLY (EINVAL); struct thread *t = (struct thread *) target; - struct hurd_thread_exregs_in in; + struct vg_thread_exregs_in in; uintptr_t control; vg_addr_t aspace_addr; vg_addr_t activity_addr; @@ -1600,44 +1603,44 @@ server_loop (void) t->name.name[0] ? t->name.name : "", t->name.name[0] ? ": " : "", 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" : "-", - (control & HURD_EXREGS_SET_ACTIVITY) ? "A" : "-", - (control & HURD_EXREGS_SET_SP) ? "S" : "-", - (control & HURD_EXREGS_SET_IP) ? "I" : "-", - (control & HURD_EXREGS_SET_EFLAGS) ? "F" : "-", - (control & HURD_EXREGS_SET_USER_HANDLE) ? "U" : "-", + (control & VG_EXREGS_SET_UTCB) ? "U" : "-", + (control & VG_EXREGS_SET_EXCEPTION_MESSENGER) ? "E" : "-", + (control & VG_EXREGS_SET_ASPACE) ? "R" : "-", + (control & VG_EXREGS_SET_ACTIVITY) ? "A" : "-", + (control & VG_EXREGS_SET_SP) ? "S" : "-", + (control & VG_EXREGS_SET_IP) ? "I" : "-", + (control & VG_EXREGS_SET_EFLAGS) ? "F" : "-", + (control & VG_EXREGS_SET_USER_HANDLE) ? "U" : "-", (control & _L4_XCHG_REGS_CANCEL_RECV) ? "R" : "-", (control & _L4_XCHG_REGS_CANCEL_SEND) ? "S" : "-", (control & _L4_XCHG_REGS_CANCEL_IPC) ? "I" : "-", (control & _L4_XCHG_REGS_HALT) ? "H" : "-", (control & _L4_XCHG_REGS_SET_HALT) ? "Y" : "N"); - if ((control & HURD_EXREGS_SET_UTCB)) + if ((control & VG_EXREGS_SET_UTCB)) DEBUG (d, "utcb: " VG_ADDR_FMT, VG_ADDR_PRINTF (utcb_addr)); - if ((control & HURD_EXREGS_SET_EXCEPTION_MESSENGER)) + if ((control & VG_EXREGS_SET_EXCEPTION_MESSENGER)) DEBUG (d, "exception messenger: " VG_ADDR_FMT, VG_ADDR_PRINTF (exception_messenger_addr)); - if ((control & HURD_EXREGS_SET_ASPACE)) + if ((control & VG_EXREGS_SET_ASPACE)) DEBUG (d, "aspace: " VG_ADDR_FMT, VG_ADDR_PRINTF (aspace_addr)); - if ((control & HURD_EXREGS_SET_ACTIVITY)) + if ((control & VG_EXREGS_SET_ACTIVITY)) DEBUG (d, "activity: " VG_ADDR_FMT, VG_ADDR_PRINTF (activity_addr)); - if ((control & HURD_EXREGS_SET_SP)) + if ((control & VG_EXREGS_SET_SP)) DEBUG (d, "sp: %p", (void *) in.sp); - if ((control & HURD_EXREGS_SET_IP)) + if ((control & VG_EXREGS_SET_IP)) DEBUG (d, "ip: %p", (void *) in.ip); - if ((control & HURD_EXREGS_SET_EFLAGS)) + if ((control & VG_EXREGS_SET_EFLAGS)) DEBUG (d, "eflags: %p", (void *) in.eflags); - if ((control & HURD_EXREGS_SET_USER_HANDLE)) + if ((control & VG_EXREGS_SET_USER_HANDLE)) DEBUG (d, "user_handle: %p", (void *) in.user_handle); struct vg_cap aspace = VG_CAP_VOID; - if ((HURD_EXREGS_SET_ASPACE & control)) + if ((VG_EXREGS_SET_ASPACE & control)) aspace = CAP (&thread->aspace, aspace_addr, -1, false); struct vg_cap a = VG_CAP_VOID; - if ((HURD_EXREGS_SET_ACTIVITY & control)) + if ((VG_EXREGS_SET_ACTIVITY & control)) { /* XXX: Remove this hack... */ if (VG_ADDR_IS_VOID (activity_addr)) @@ -1648,11 +1651,11 @@ server_loop (void) } struct vg_cap utcb = VG_CAP_VOID; - if ((HURD_EXREGS_SET_UTCB & control)) + if ((VG_EXREGS_SET_UTCB & control)) utcb = CAP (&thread->aspace, utcb_addr, vg_cap_page, true); struct vg_cap exception_messenger = VG_CAP_VOID; - if ((HURD_EXREGS_SET_EXCEPTION_MESSENGER & control)) + if ((VG_EXREGS_SET_EXCEPTION_MESSENGER & control)) exception_messenger = CAP (&thread->aspace, exception_messenger_addr, vg_cap_rmessenger, false); @@ -1662,7 +1665,7 @@ server_loop (void) struct vg_cap utcb_out = thread->utcb; struct vg_cap exception_messenger_out = thread->exception_messenger; - struct hurd_thread_exregs_out out; + struct vg_thread_exregs_out out; out.sp = in.sp; out.ip = in.ip; out.eflags = in.eflags; @@ -1724,7 +1727,7 @@ server_loop (void) struct activity *activity = (struct activity *) target; uintptr_t flags; - struct activity_policy in; + struct vg_activity_policy in; err = vg_activity_policy_send_unmarshal (message, &flags, &in, NULL); @@ -1765,7 +1768,7 @@ server_loop (void) | VG_ACTIVITY_POLICY_SIBLING_REL_WEIGHT_SET | VG_ACTIVITY_POLICY_STORAGE_SET))) { - struct activity_policy p = principal->policy; + struct vg_activity_policy p = principal->policy; if ((flags & VG_ACTIVITY_POLICY_CHILD_REL_PRIORITY_SET)) p.child_rel.priority = in.child_rel.priority; @@ -1803,38 +1806,38 @@ server_loop (void) int period = activity->current_period - 1; if (period < 0) - period = (ACTIVITY_STATS_PERIODS + 1) + period; + period = (VG_ACTIVITY_STATS_PERIODS + 1) + period; DEBUG (4, OBJECT_NAME_FMT ": %s%s%s(%d), " "period: %d (current: %d)", - OBJECT_NAME_PRINTF ((struct object *) activity), - flags & activity_info_stats ? "stats" : "", - (flags == (activity_info_pressure|activity_info_stats)) + OBJECT_NAME_PRINTF ((struct vg_object *) activity), + flags & vg_activity_info_stats ? "stats" : "", + (flags == (vg_activity_info_pressure|vg_activity_info_stats)) ? ", " : "", - flags & activity_info_pressure ? "pressure" : "", + flags & vg_activity_info_pressure ? "pressure" : "", flags, until_period, activity->stats[period].period); - if ((flags & activity_info_stats) + if ((flags & vg_activity_info_stats) && activity->stats[period].period > 0 && activity->stats[period].period >= until_period) /* Return the available statistics. */ { /* XXX: Only return valid stat buffers. */ - struct activity_info info; - info.event = activity_info_stats; + struct vg_activity_info info; + info.event = vg_activity_info_stats; int i; - for (i = 0; i < ACTIVITY_STATS_PERIODS; i ++) + for (i = 0; i < VG_ACTIVITY_STATS_PERIODS; i ++) { period = activity->current_period - 1 - i; if (period < 0) - period = (ACTIVITY_STATS_PERIODS + 1) + period; + period = (VG_ACTIVITY_STATS_PERIODS + 1) + period; info.stats.stats[i] = activity->stats[period]; } - info.stats.count = ACTIVITY_STATS_PERIODS; + info.stats.count = VG_ACTIVITY_STATS_PERIODS; vg_activity_info_reply (principal, reply, info); } @@ -1884,8 +1887,8 @@ server_loop (void) case VG_futex: { /* Helper function to wake and requeue waiters. */ - int wake (int to_wake, struct object *object1, int offset1, - int to_requeue, struct object *object2, int offset2) + int wake (int to_wake, struct vg_object *object1, int offset1, + int to_requeue, struct vg_object *object2, int offset2) { int count = 0; struct messenger *m; @@ -1962,7 +1965,7 @@ server_loop (void) char *mode = "unknown"; - struct object *page = vg_cap_to_object (principal, &thread->utcb); + struct vg_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; @@ -1990,7 +1993,7 @@ server_loop (void) }; vg_addr_t addr = vg_addr_chop (VG_PTR_TO_ADDR (addr1), PAGESIZE_LOG2); - struct object *object1 = OBJECT (&thread->aspace, + struct vg_object *object1 = OBJECT (&thread->aspace, addr, vg_cap_page, true, NULL); int offset1 = (uintptr_t) addr1 & (PAGESIZE - 1); int *vaddr1 = (void *) object1 + offset1; @@ -2029,7 +2032,7 @@ server_loop (void) case FUTEX_WAKE_OP: addr = vg_addr_chop (VG_PTR_TO_ADDR (addr2), PAGESIZE_LOG2); - struct object *object2 = OBJECT (&thread->aspace, + struct vg_object *object2 = OBJECT (&thread->aspace, addr, vg_cap_page, true, NULL); int offset2 = (uintptr_t) addr2 & (PAGESIZE - 1); int *vaddr2 = (void *) object2 + offset2; diff --git a/viengoos/t-activity.c b/viengoos/t-activity.c index 371bf81..f3f5d83 100644 --- a/viengoos/t-activity.c +++ b/viengoos/t-activity.c @@ -13,7 +13,7 @@ struct activity *root_activity; /* Current working folio. */ -static struct folio *folio; +static struct vg_folio *folio; static int object; static struct as_allocate_pt_ret @@ -59,7 +59,7 @@ test (void) folio_parent (root_activity, folio); #define N 20 - void try (struct activity *activity, struct folio *folio, int depth) + void try (struct activity *activity, struct vg_folio *folio, int depth) { int i; int obj = 0; @@ -67,8 +67,8 @@ test (void) struct { struct activity *child; - struct folio *folio; - struct object *page; + struct vg_folio *folio; + struct vg_object *page; } a[N]; for (i = 0; i < N; i ++) @@ -100,7 +100,7 @@ test (void) for (i = 0; i < N / 2; i ++) { struct vg_cap cap = object_to_cap (a[i].page); - struct object *o = vg_cap_to_object (activity, &cap); + struct vg_object *o = vg_cap_to_object (activity, &cap); assert (o == a[i].page); /* Destroy the activity. */ @@ -114,7 +114,7 @@ test (void) int i; for (i = 0; i < 10; i ++) { - struct folio *f = folio_alloc (root_activity, VG_FOLIO_POLICY_DEFAULT); + struct vg_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 ffb061f..f68ca6b 100644 --- a/viengoos/t-as.c +++ b/viengoos/t-as.c @@ -13,7 +13,7 @@ struct activity *root_activity; /* Current working folio. */ -static struct folio *folio; +static struct vg_folio *folio; static int object; static struct as_allocate_pt_ret @@ -64,7 +64,7 @@ try (struct alloc *allocs, int count, bool dump) assert (cap->type == caps[i].type); - struct object *object = vg_cap_to_object (root_activity, cap); + struct vg_object *object = vg_cap_to_object (root_activity, cap); struct object_desc *odesc = object_to_object_desc (object); if (caps[i].type != vg_cap_void) assert (odesc->oid == caps[i].oid); @@ -76,7 +76,7 @@ try (struct alloc *allocs, int count, bool dump) { if (cap) { - struct object *object = vg_cap_to_object (root_activity, cap); + struct vg_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 @@ -92,7 +92,7 @@ try (struct alloc *allocs, int count, bool dump) switch (allocs[i].type) { case vg_cap_folio: - caps[i] = object_to_cap ((struct object *) + caps[i] = object_to_cap ((struct vg_object *) folio_alloc (root_activity, VG_FOLIO_POLICY_DEFAULT)); break; @@ -109,7 +109,7 @@ try (struct alloc *allocs, int count, bool dump) assert (! " Bad type"); } - struct object *object = vg_cap_to_object (root_activity, &caps[i]); + struct vg_object *object = vg_cap_to_object (root_activity, &caps[i]); if (caps[i].type == vg_cap_page) memset (object, i, PAGESIZE); @@ -203,7 +203,7 @@ try (struct alloc *allocs, int count, bool dump) { case vg_cap_folio: folio_free (root_activity, - (struct folio *) vg_cap_to_object (root_activity, + (struct vg_folio *) vg_cap_to_object (root_activity, &caps[i])); break; case vg_cap_void: diff --git a/viengoos/thread.c b/viengoos/thread.c index a351264..7f64e72 100644 --- a/viengoos/thread.c +++ b/viengoos/thread.c @@ -74,7 +74,7 @@ thread_lookup (l4_thread_id_t threadid) debug (1, "hash inconsistent: threadid: (%x.%x) " "!= thread (%llx/0x%p)->tid: (%x.%x)", l4_thread_no (threadid), l4_version (threadid), - object_to_object_desc ((struct object *) thread)->oid, thread, + object_to_object_desc ((struct vg_object *) thread)->oid, thread, l4_thread_no (thread->tid), l4_version (thread->tid)); assert (thread->tid == threadid); @@ -110,7 +110,7 @@ thread_init (struct thread *thread) thread->tid = l4_global_id (tid, THREAD_VERSION); debug (4, "Allocated thread 0x%x.%x (%llx/%p)", l4_thread_no (thread->tid), l4_version (thread->tid), - object_to_object_desc ((struct object *) thread)->oid, thread); + object_to_object_desc ((struct vg_object *) thread)->oid, thread); bool had_value; error_t err = hurd_ihash_replace (&tid_to_thread, tid, thread, @@ -260,35 +260,35 @@ thread_exregs (struct activity *principal, uintptr_t *sp, uintptr_t *ip, uintptr_t *eflags, uintptr_t *user_handle) { - if ((control & ~(HURD_EXREGS_SET_REGS - | HURD_EXREGS_GET_REGS - | HURD_EXREGS_START - | HURD_EXREGS_STOP - | HURD_EXREGS_ABORT_IPC))) + if ((control & ~(VG_EXREGS_SET_REGS + | VG_EXREGS_GET_REGS + | VG_EXREGS_START + | VG_EXREGS_STOP + | VG_EXREGS_ABORT_IPC))) { debug (1, "Control word contains invalid bits"); return EINVAL; } - if ((control & HURD_EXREGS_SET_ASPACE)) + if ((control & VG_EXREGS_SET_ASPACE)) 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)) + if ((control & VG_EXREGS_SET_ACTIVITY)) vg_cap_copy_simple (principal, VG_ADDR_VOID, &thread->activity, VG_ADDR_VOID, VG_ADDR_VOID, activity, VG_ADDR_VOID); - if ((control & HURD_EXREGS_SET_UTCB)) + if ((control & VG_EXREGS_SET_UTCB)) vg_cap_copy_simple (principal, VG_ADDR_VOID, &thread->utcb, VG_ADDR_VOID, VG_ADDR_VOID, utcb, VG_ADDR_VOID); - if ((control & HURD_EXREGS_SET_EXCEPTION_MESSENGER)) + if ((control & VG_EXREGS_SET_EXCEPTION_MESSENGER)) vg_cap_copy_simple (principal, VG_ADDR_VOID, &thread->exception_messenger, VG_ADDR_VOID, @@ -299,7 +299,7 @@ thread_exregs (struct activity *principal, l4_thread_id_t tid = thread->tid; /* Clear hurd specific bits so that l4_exchange_registers works. */ - control = control & ~(HURD_EXREGS_SET_ACTIVITY | HURD_EXREGS_SET_ASPACE); + control = control & ~(VG_EXREGS_SET_ACTIVITY | VG_EXREGS_SET_ASPACE); do_debug (4) { @@ -335,32 +335,32 @@ thread_exregs (struct activity *principal, else { l4_word_t t = thread->sp; - if ((control & HURD_EXREGS_SET_SP)) + if ((control & VG_EXREGS_SET_SP)) thread->sp = *sp; - if ((control & HURD_EXREGS_GET_REGS)) + if ((control & VG_EXREGS_GET_REGS)) *sp = t; t = thread->ip; - if ((control & HURD_EXREGS_SET_IP)) + if ((control & VG_EXREGS_SET_IP)) thread->ip = *ip; - if ((control & HURD_EXREGS_GET_REGS)) + if ((control & VG_EXREGS_GET_REGS)) *ip = t; t = thread->eflags; - if ((control & HURD_EXREGS_SET_EFLAGS)) + if ((control & VG_EXREGS_SET_EFLAGS)) thread->eflags = *eflags; - if ((control & HURD_EXREGS_GET_REGS)) + if ((control & VG_EXREGS_GET_REGS)) *eflags = t; t = thread->user_handle; - if ((control & HURD_EXREGS_SET_USER_HANDLE)) + if ((control & VG_EXREGS_SET_USER_HANDLE)) thread->user_handle = *user_handle; - if ((control & HURD_EXREGS_GET_REGS)) + if ((control & VG_EXREGS_GET_REGS)) *user_handle = t; - if ((control & HURD_EXREGS_START) == HURD_EXREGS_START) + if ((control & VG_EXREGS_START) == VG_EXREGS_START) { - struct object *a = vg_cap_to_object (principal, &thread->activity); + struct vg_object *a = vg_cap_to_object (principal, &thread->activity); if (! a) { debug (0, "Thread not schedulable: no activity"); @@ -385,12 +385,12 @@ thread_exregs (struct activity *principal, | _L4_XCHG_REGS_SET_FLAGS | _L4_XCHG_REGS_SET_USER_HANDLE | _L4_XCHG_REGS_SET_HALT; - if ((control & HURD_EXREGS_STOP) == HURD_EXREGS_STOP) + if ((control & VG_EXREGS_STOP) == VG_EXREGS_STOP) c |= _L4_XCHG_REGS_HALT; - if ((control & HURD_EXREGS_ABORT_SEND) == HURD_EXREGS_ABORT_SEND) + if ((control & VG_EXREGS_ABORT_SEND) == VG_EXREGS_ABORT_SEND) c |= _L4_XCHG_REGS_CANCEL_SEND; - if ((control & HURD_EXREGS_ABORT_RECEIVE) - == HURD_EXREGS_ABORT_RECEIVE) + if ((control & VG_EXREGS_ABORT_RECEIVE) + == VG_EXREGS_ABORT_RECEIVE) c |= _L4_XCHG_REGS_CANCEL_RECV; l4_thread_id_t targ = tid; @@ -439,7 +439,7 @@ thread_activate (struct activity *activity, bool may_block) { assert (messenger); - assert (object_type ((struct object *) messenger) == vg_cap_messenger); + assert (object_type ((struct vg_object *) messenger) == vg_cap_messenger); uintptr_t ip = 0; @@ -468,10 +468,10 @@ thread_activate (struct activity *activity, return false; } - if (object_type ((struct object *) utcb) != vg_cap_page) + if (object_type ((struct vg_object *) utcb) != vg_cap_page) { debug (0, "Malformed thread: utcb slot contains a %s, not a page", - vg_cap_type_string (object_type ((struct object *) utcb))); + vg_cap_type_string (object_type ((struct vg_object *) utcb))); return false; } @@ -484,7 +484,7 @@ thread_activate (struct activity *activity, return false; object_wait_queue_enqueue (activity, - (struct object *) thread, messenger); + (struct vg_object *) thread, messenger); messenger->wait_reason = MESSENGER_WAIT_TRANSFER_MESSAGE; utcb->pending_message = 1; @@ -508,7 +508,7 @@ thread_activate (struct activity *activity, utcb->inline_cap_count = messenger->inline_cap_count; } - l4_word_t c = HURD_EXREGS_STOP | _L4_XCHG_REGS_DELIVER + l4_word_t c = VG_EXREGS_STOP | _L4_XCHG_REGS_DELIVER | _L4_XCHG_REGS_CANCEL_SEND | _L4_XCHG_REGS_CANCEL_RECV; do_debug (4) { @@ -557,7 +557,7 @@ thread_activate (struct activity *activity, utcb->saved_ip = ip; } - c = HURD_EXREGS_START | _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP; + c = VG_EXREGS_START | _L4_XCHG_REGS_SET_SP | _L4_XCHG_REGS_SET_IP; sp = utcb->activation_handler_sp; ip = utcb->activation_handler_ip; targ = thread->tid; @@ -604,9 +604,9 @@ thread_raise_exception (struct activity *activity, backtrace_print (); debug (0, "Thread %x has no exception handler.", thread->tid); } - else if (object_type ((struct object *) handler) != vg_cap_messenger) + else if (object_type ((struct vg_object *) handler) != vg_cap_messenger) debug (0, "%s is not a valid exception handler.", - vg_cap_type_string (object_type ((struct object *) handler))); + vg_cap_type_string (object_type ((struct vg_object *) handler))); else { if (! messenger_message_load (activity, handler, message)) @@ -628,10 +628,10 @@ thread_deliver_pending (struct activity *activity, return; } - if (object_type ((struct object *) utcb) != vg_cap_page) + if (object_type ((struct vg_object *) utcb) != vg_cap_page) { debug (0, "Malformed thread: utcb slot contains a %s, not a page", - vg_cap_type_string (object_type ((struct object *) utcb))); + vg_cap_type_string (object_type ((struct vg_object *) utcb))); return; } @@ -643,7 +643,7 @@ thread_deliver_pending (struct activity *activity, struct messenger *m; - object_wait_queue_for_each (activity, (struct object *) thread, m) + object_wait_queue_for_each (activity, (struct vg_object *) thread, m) if (m->wait_reason == MESSENGER_WAIT_TRANSFER_MESSAGE) { if (thread_activate (activity, thread, m, false)) diff --git a/viengoos/thread.h b/viengoos/thread.h index 912137a..b8006e5 100644 --- a/viengoos/thread.h +++ b/viengoos/thread.h @@ -63,7 +63,7 @@ struct thread /* Whether the thread has been commissioned (a tid allocated). */ uint32_t commissioned : 1; - struct object_name name; + struct vg_object_name name; }; /* The hardwired base of the UTCB (2.5GB). */ |