summaryrefslogtreecommitdiff
path: root/ruth/ruth.c
diff options
context:
space:
mode:
authorneal <neal>2008-06-05 13:20:56 +0000
committerneal <neal>2008-06-05 13:20:56 +0000
commit7aeb80b54a28b9b87622debe47a69fd033923383 (patch)
tree00100da227e0ccf3694cd11f34324782d7ce5ef5 /ruth/ruth.c
parent029f94a04e9fc49dfb8b562d403b451c17fe1587 (diff)
viengoos/
2008-06-05 Neal H. Walfield <neal@gnu.org> * cap-lookup.c: Move from here... * ../libhurd-mm/as-lookup.c: ... to here. * as.c: Move from here... * ../libhurd-mm/as-build.c: ... to here. * as-custom.c: Move from here... * ../libhurd-mm/as-build-custom.c: ... to here. * as.h: Move contents... * ../libhurd-mm/as.h: ... to here... * ../libhurd-mm/as-compute-gbits.h: ... and to here. * bits.h: Move from here... * ../libhurd-mm/bits.h: ... to here. * Makefile.am (viengoos_SOURCES): Remove cap-lookup.c, as.h and as.c. (t_as_SOURCES): Likewise. (t_activity_SOURCES): Likewise. (viengoos_LDADD): Add ../libhurd-mm/libas-kernel.a. (t_as_LDADD): Add ../libhurd-mm/libas-check.a. (t_activity_LDADD): Likewise. (lib_LIBRARIES): Remove libhurd-cap.a. (libhurd_cap_a_CPPFLAGS): Remove variable. (libhurd_cap_a_CFLAGS): Likewise. (libhurd_cap_a_SOURCES): Likewise. * server.c (server_loop): Replace use of object_lookup_rel with as_object_lookup_rel. Replace use of slot_lookup_rel with as_slot_lookup_rel_use. Replace use of cap_lookup_rel with as_cap_lookup_rel. * viengoos.c: Don't include "as.h", include <hurd/as.h>. * t-activity.c: Don't include "as.h", include <hurd/as.h>. (allocate_object): Change return type to struct as_allocate_pt_ret. * t-as.c: Don't include "as.h", include <hurd/as.h>. (allocate_object): Change return type to struct as_allocate_pt_ret. (allocate_page_table): New function. (try): Replace use of as_insert with as_insert_full. Replace use of slot_lookup_rel with as_slot_lookup_rel_use. Replace use of object_lookup_rel with as_object_lookup_rel. (test): Likewise. * t-guard.c: Don't include "as.h", include <hurd/as.h>. Include "../libhurd-mm/as-compute-gbits.h". libhurd-mm/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * as.h: Include <hurd/exceptions.h>. [! RM_INTERN]: Include <hurd/storage.h> and <pthread.h>. (as_lock_ensure_stack) [! RM_INTERN]: New function. (as_lock): New function. (as_lock_readonly): Likewise. (as_unlock): Likewise. (meta_data_activity) [RM_INTERN]: Don't declare. (shadow_root) [RM_INTERN]: Don't declare. (struct as_insert_rt): Rename from this... (struct as_allocate_pt_ret): ... to this. Update users. (as_allocate_page_table_t): New typedef. (as_allocate_page_table): New declaration. (as_build): New declaration. (as_build_custom): Likewise. (as_slot_ensure): Remove declaration. (as_ensure_full): New macro. (as_ensure_use) [! RM_INTERN]: Likewise. (as_ensure) [! RM_INTERN]: New function. (as_insert): Rename from this... (as_insert_full): ... to this. Don't return the capability. Reverse the order of the source address and cap. Replace allocate_object parameter with an allocate_page_table parameter. Update users. (as_insert) [! RM_INTERN]: New function. (as_slot_ensure_full_custom): Rename from this... (as_ensure_full_custom): ... to this. Replace allocate_object parameter with an allocate_page_table parameter. (as_insert_custom): Likewise. (union as_lookup_ret): New definition. (as_lookup_want_cap): New definition. (as_lookup_want_slot): Likewise. (as_lookup_want_object): Likewise. (as_lookup_rel): New declaration. (slot_lookup): Remove declaration. (as_slot_lookup_rel_use): Replace it with this macro. (as_slot_lookup_use) [! RM_INTERN]: New macro. (as_cap_lookup_rel): New function. (cap_lookup): Rename from this... (as_cap_lookup) [! RM_INTERN]: ... to this. Remove activity parameter. Implement here as a static inline function. (as_object_lookup_rel): New function. (object_lookup): Rename from this... (as_object_lookup) [! RM_INTERN]: ... to this. Remove activity parameter. Implement here as a static inline function. (as_dump_from): New declaration. * as-compute-gbits.h: Include <hurd/folio.h>. * as.c (allocate_object): Rename from this... (as_allocate_page_table): ... to this. Remove static qualifier. Don't take parameter type, just allocate a cap_cappage. (as_slot_ensure): Remove function. (as_init): Replace use of slot_lookup_rel with as_slot_lookup_use or as_cap_lookup as appropriate. (cap_lookup): Remove function. (object_lookup): Likewise. (slot_lookup): Likewise. (as_dump): Likewise. * as-build.c: Don't include "as.h", but <hurd/as.h>. Include <hurd/rm.h>, "as-compute-gbits.h". [RM_INTERN]: Don't include "object.h" but "../viengoos/object.h". (CUSTOM) [ID_SUFFIX]: Define. (as_build_internal): Rename from this... (as_build): ... to this. Remove static qualifier. Replace parameter allocate_object with allocate_page_table. Use it instead. (as_slot_ensure_full): Remove function. (as_insert): Likewise. * as-build-custom.c (as_object_index_t): Remove definition. (AS_LOCK): Don't define. (AS_UNLOCK): Don't define. (as_ensure_full_custom): New function. (as_insert_custom): Likewise. * as-lookup.c: Include <hurd/as.h>. [RM_INTERN]: Don't include "object.h" but "../viengoos/object.h". [! RM_INTERN]: Include <pthread.h>. (as_lock) [! RM_INTERN]: Rename from this... (as_rwlock) [! RM_INTERN]: ... to this. (ensure_stack) [! RM_INTERN]: Remove function. (AS_LOCK): Don't define. (AS_UNLOCK): Don't define. (lookup): Rename from this... (as_lookup_rel): ... to this. Change mode's type to an enum as_lookup_mode. Change rt's type to a union as_lookup_ret. Don't use want_object but as_lookup_want_object. Don't use want_slot but as_lookup_want_slot. Don't use want_cap but as_lookup_want_cap. (cap_lookup_rel): Remove function. (object_lookup_rel): Likewise. (slot_lookup_rel): Likewise. (print_nr): Move from here... * as-lookup.c (do_walk): Move from here... * as-dump.c (do_walk): ... to here. * as-lookup.c (as_dump_from): Move from here... * as-dump.c (as_dump_from): ... to here. * Makefile.am (lib_LIBRARIES) [ENABLE_TESTS]: Set to libas-check.a (lib_LIBRARIES) [! ENABLE_TESTS]: Add libas-kernel.a. (libhurd_mm_a_SOURCES): Add bits., as-build.c as-build-custom.c, as-lookup.c and as-dump.c. (libas_kernel_a_CPPFLAGS): New variable. (libas_kernel_a_CCASFLAGS): New variable. (libas_kernel_a_CFLAGS): New variable. (libas_kernel_a_SOURCES): New variable. (libas_check_a_CPPFLAGS): New variable. (libas_check_a_CCASFLAGS): New variable. (libas_check_a_CFLAGS): New variable. (libas_check_a_SOURCES): New variable. * anonymous.c (fault): Replace use of as_slot_ensure with as_ensure. * exceptions.c (exception_handler_init): Replace use of as_slot_ensure with as_ensure. * storage.c (storage_check_reserve_internal): Replace use of as_lock with as_rwlock. Replace use of as_slot_ensure with and slot_lookup with as_ensure and as_slot_lookup_use. (storage_alloc): Replace use of slot_lookup with as_slot_lookup_use. hurd/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * cap.h: Don't include <pthread.h>. (as_lock): Remove declaration. (cap_lookup_rel): Likewise. (object_lookup_rel): Likewise. (slot_lookup_rel): Likewise. / 2008-06-05 Neal H. Walfield <neal@gnu.org> * libc.a.in: Remove -lhurd-cap. * Makefile.am (libc-stmp): Remove dependency on viengoos/libhurd-cap.a. 2008-06-05 Neal H. Walfield <neal@gnu.org> * process-spawn.c (as_insert_custom): Replace use of as_insert with as_insert_full. (allocate_object): Change return type to struct as_allocate_pt_ret. Replace use of as_slot_ensure with as_ensure_use. (allocate_page_table): New function. (process_spawn): Update use of as_insert_custom to be consistent with new API, in particular, pass allocate_page_table instead of allocate_object. Replace use of object_lookup_rel with as_object_lookup_rel. libpthread/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * sysdeps/l4/hurd/pt-thread-alloc.c (__pthread_thread_alloc): Replace use of as_slot_ensure with as_ensure. ruth/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * ruth.c (main): Replace use of slot_lookup with as_cap_lookup. Replace use of as_slot_ensure with as_ensure_use. Replace use of slot_lookup with as_slot_lookup_use.
Diffstat (limited to 'ruth/ruth.c')
-rw-r--r--ruth/ruth.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/ruth/ruth.c b/ruth/ruth.c
index 3792882..26c0df9 100644
--- a/ruth/ruth.c
+++ b/ruth/ruth.c
@@ -84,16 +84,15 @@ main (int argc, char *argv[])
bool writable,
void *cookie)
{
- struct cap *slot = slot_lookup (activity, addr, NULL);
+ struct cap cap = as_cap_lookup (addr, -1, NULL);
- assert (slot);
- assert (type == slot->type);
+ assert (type == cap.type);
if (type == cap_cappage || type == cap_rcappage || type == cap_folio)
- assertx (slot->shadow,
+ assertx (cap.shadow,
ADDR_FMT ", %s",
ADDR_PRINTF (addr), cap_type_string (type));
else
- assert (! slot->shadow);
+ assert (! cap.shadow);
if (type == cap_folio)
{
@@ -168,10 +167,6 @@ main (int argc, char *argv[])
{
addr_t f = addr_extend (root, i, bits);
- struct cap *slot = as_slot_ensure (f);
- assert (slot);
- slot->type = cap_folio;
-
error_t err = rm_folio_alloc (activity, f, FOLIO_POLICY_DEFAULT);
assert (! err);
@@ -180,7 +175,13 @@ main (int argc, char *argv[])
OBJECT_POLICY_DEFAULT, ADDR_VOID);
struct object *shadow = ADDR_TO_PTR (addr_extend (shadow_storage.addr,
0, PAGESIZE_LOG2));
- cap_set_shadow (slot, shadow);
+
+ as_ensure_use (f,
+ ({
+ slot->type = cap_folio;
+ cap_set_shadow (slot, shadow);
+ }));
+
memset (shadow, 0, PAGESIZE);
int j;
@@ -195,9 +196,8 @@ main (int argc, char *argv[])
assert (! err);
assert (type == cap_folio);
- struct cap *slot = slot_lookup (activity, f, NULL);
- assert (slot);
- assert (slot->type == cap_folio);
+ struct cap cap = as_cap_lookup (f, -1, NULL);
+ assert (cap.type == cap_folio);
}
}
@@ -208,12 +208,17 @@ main (int argc, char *argv[])
error_t err = rm_folio_free (activity, f);
assert (! err);
- struct cap *slot = slot_lookup (activity, f, NULL);
- assert (slot);
- assert (slot->type == cap_folio);
- slot->type = cap_void;
+ void *shadow = NULL;
+ bool ret = as_slot_lookup_use
+ (f,
+ ({
+ assert (slot->type == cap_folio);
+ slot->type = cap_void;
+
+ shadow = cap_get_shadow (slot);
+ }));
+ assert (ret);
- void *shadow = cap_get_shadow (slot);
assert (shadow);
storage_free (addr_chop (PTR_TO_ADDR (shadow), PAGESIZE_LOG2), 1);
}
@@ -1013,8 +1018,7 @@ main (int argc, char *argv[])
addr_t addr = as_alloc (PAGESIZE_LOG2, 1, true);
assert (! ADDR_IS_VOID (addr));
- bool r = as_slot_ensure (addr);
- assert (r);
+ as_ensure (addr);
addr_t storage = storage_alloc (activity, cap_page,
STORAGE_MEDIUM_LIVED,