diff options
author | neal <neal> | 2008-06-05 13:20:56 +0000 |
---|---|---|
committer | neal <neal> | 2008-06-05 13:20:56 +0000 |
commit | 7aeb80b54a28b9b87622debe47a69fd033923383 (patch) | |
tree | 00100da227e0ccf3694cd11f34324782d7ce5ef5 /libc-parts/process-spawn.c | |
parent | 029f94a04e9fc49dfb8b562d403b451c17fe1587 (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 'libc-parts/process-spawn.c')
-rw-r--r-- | libc-parts/process-spawn.c | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/libc-parts/process-spawn.c b/libc-parts/process-spawn.c index b7dafd3..52560d8 100644 --- a/libc-parts/process-spawn.c +++ b/libc-parts/process-spawn.c @@ -96,9 +96,9 @@ process_spawn (addr_t activity, ({ \ debug (5, "Copying " ADDR_FMT " to " ADDR_FMT , \ ADDR_PRINTF (saddr_), ADDR_PRINTF (taddr_)); \ - as_insert (root_activity, \ - ADDR_VOID, as_root_cap_, taddr_, \ - ADDR_VOID, scap_, ADDR_VOID, alloc_); \ + as_insert_full (root_activity, \ + ADDR_VOID, as_root_cap_, taddr_, \ + ADDR_VOID, ADDR_VOID, scap_, alloc_); \ }) #else @@ -311,7 +311,7 @@ process_spawn (addr_t activity, /* Next unallocated object in folio. */ int folio_index; - struct as_insert_rt allocate_object (enum cap_type type, addr_t addr) + struct as_allocate_pt_ret allocate_object (enum cap_type type, addr_t addr) { debug (5, "(%s, 0x%llx/%d)", cap_type_string (type), addr_prefix (addr), addr_depth (addr)); @@ -345,11 +345,10 @@ process_spawn (addr_t activity, if (ADDR_IS_VOID (folio_local_addr)) panic ("Failed to allocate address space for folio"); - struct cap *slot = as_slot_ensure (folio_local_addr); - if (! slot) - panic ("Failed to allocate page tables"); - - slot->type = cap_folio; + as_ensure_use (folio_local_addr, + ({ + slot->type = cap_folio; + })); error_t err = rm_folio_alloc (activity, folio_local_addr, FOLIO_POLICY_DEFAULT); @@ -381,7 +380,7 @@ process_spawn (addr_t activity, #endif } - struct as_insert_rt rt; + struct as_allocate_pt_ret rt; memset (&rt, 0, sizeof (rt)); int index = folio_index ++; @@ -424,7 +423,12 @@ process_spawn (addr_t activity, return rt; } - struct as_insert_rt rt; + struct as_allocate_pt_ret allocate_page_table (addr_t addr) + { + return allocate_object (cap_cappage, addr); + } + + struct as_allocate_pt_ret rt; #ifdef RM_INTERN /* XXX: Boostrap problem. To allocate a folio we need to assign it @@ -472,7 +476,7 @@ process_spawn (addr_t activity, struct cap *slot = as_insert_custom (ADDR_VOID, as_root, as_root_cap, desc->object, ADDR_VOID, cap, activity, - allocate_object, do_index); + allocate_page_table, do_index); /* Weaken the capability. */ r = cap_copy_x (root_activity, as_root, slot, desc->object, as_root, *slot, desc->object, @@ -514,22 +518,22 @@ process_spawn (addr_t activity, addr_t addr = addr_chop (PTR_TO_ADDR (ptr), PAGESIZE_LOG2); - struct as_insert_rt rt = allocate_object (ro ? cap_rpage : cap_page, - addr); - - struct cap *cap = as_insert_custom (ADDR_VOID, - as_root, as_root_cap, addr, - ADDR_VOID, rt.cap, rt.storage, - allocate_object, do_index); + struct as_allocate_pt_ret rt = allocate_object (cap_page, addr); + as_insert_custom (root_activity, + as_root, as_root_cap, addr, + ADDR_VOID, rt.cap, rt.storage, + allocate_page_table, do_index); if (ro) - { - bool r = cap_copy_x (root_activity, - as_root, cap, addr, - as_root, *cap, addr, - CAP_COPY_WEAKEN, CAP_PROPERTIES_VOID); - assert (r); - } + as_slot_lookup_rel_use (root_activity, as_root_cap, addr, + ({ + bool r = cap_copy_x (root_activity, + as_root, slot, addr, + as_root, *slot, addr, + CAP_COPY_WEAKEN, + CAP_PROPERTIES_VOID); + assert (r); + })); void *local = rt_to_object (rt); @@ -558,9 +562,9 @@ process_spawn (addr_t activity, #ifdef RM_INTERN addr_t addr = addr_chop (PTR_TO_ADDR (ptr), PAGESIZE_LOG2); - struct cap cap = object_lookup_rel (root_activity, - as_root_cap, addr, - cap_rpage, NULL); + struct cap cap = as_object_lookup_rel (root_activity, + as_root_cap, addr, + cap_rpage, NULL); local = cap_to_object (root_activity, &cap); #else local = hurd_ihash_find (&map, ptr); @@ -608,7 +612,7 @@ process_spawn (addr_t activity, as_insert_custom (ADDR_VOID, as_root, as_root_cap, desc->object, ADDR_VOID, cap, desc->storage, - allocate_object, do_index); + allocate_page_table, do_index); #ifndef RM_INTERN /* Free the address space that we allocated to access @@ -633,13 +637,13 @@ process_spawn (addr_t activity, addr_t addr = ADDR (STARTUP_DATA_ADDR + page * PAGESIZE, ADDR_BITS - PAGESIZE_LOG2); - struct as_insert_rt rt = allocate_object (cap_page, addr); + struct as_allocate_pt_ret rt = allocate_object (cap_page, addr); pages[page] = rt_to_object (rt); as_insert_custom (ADDR_VOID, as_root, as_root_cap, addr, ADDR_VOID, rt.cap, rt.storage, - allocate_object, do_index); + allocate_page_table, do_index); } } |