summaryrefslogtreecommitdiff
path: root/libhurd-mm
diff options
context:
space:
mode:
authorneal <neal>2008-02-13 14:33:25 +0000
committerneal <neal>2008-02-13 14:33:25 +0000
commit2c6d94ff01c2674c9708fc866b3a2e4103910d77 (patch)
tree2f5acf4862a97bd1b1bd8e9ed64a4f939d77d2ac /libhurd-mm
parenta1b2f4cc72e191b7686e7cdec7ebd9b2fee92c20 (diff)
libhurd-mm/
2008-02-13 Neal H. Walfield <neal@gnu.org> * storage.h (storage_alloc): Take additional parameter policy. Update callers. * storage.c (storage_alloc): Take additional parameter policy. Use it when allocating the object and updating the shadow capability slots. libpthread/ 2008-02-13 Neal H. Walfield <neal@gnu.org> * sysdeps/l4/hurd/pt-thread-alloc.c (__pthread_thread_alloc): Update use of storage_alloc to be consistent with new API. newlib/ 2008-02-13 Neal H. Walfield <neal@gnu.org> * addon/newlib/libc/sys/hurd/getreent.c (slab_alloc): Update use of storage_alloc to be consistent with new API. ruth/ 2008-02-13 Neal H. Walfield <neal@gnu.org> * ruth.c (main): Update use of storage_alloc to be consistent with new API.
Diffstat (limited to 'libhurd-mm')
-rw-r--r--libhurd-mm/ChangeLog8
-rw-r--r--libhurd-mm/anonymous.c6
-rw-r--r--libhurd-mm/capalloc.c6
-rw-r--r--libhurd-mm/exceptions.c9
-rw-r--r--libhurd-mm/storage.c24
-rw-r--r--libhurd-mm/storage.h17
6 files changed, 45 insertions, 25 deletions
diff --git a/libhurd-mm/ChangeLog b/libhurd-mm/ChangeLog
index b1e8d82..bdeec2d 100644
--- a/libhurd-mm/ChangeLog
+++ b/libhurd-mm/ChangeLog
@@ -1,5 +1,13 @@
2008-02-13 Neal H. Walfield <neal@gnu.org>
+ * storage.h (storage_alloc): Take additional parameter policy.
+ Update callers.
+ * storage.c (storage_alloc): Take additional parameter policy.
+ Use it when allocating the object and updating the shadow
+ capability slots.
+
+2008-02-13 Neal H. Walfield <neal@gnu.org>
+
* storage.c (shadow_setup): Only update the shadow if IDX is not
-1.
(storage_alloc_): When allocating an object during initializing,
diff --git a/libhurd-mm/anonymous.c b/libhurd-mm/anonymous.c
index 3942664..d8dc68c 100644
--- a/libhurd-mm/anonymous.c
+++ b/libhurd-mm/anonymous.c
@@ -60,7 +60,8 @@ static error_t
slab_alloc (void *hook, size_t size, void **ptr)
{
struct storage storage = storage_alloc (meta_data_activity, cap_page,
- STORAGE_LONG_LIVED, ADDR_VOID);
+ STORAGE_LONG_LIVED,
+ OBJECT_POLICY_DEFAULT, ADDR_VOID);
if (ADDR_IS_VOID (storage.addr))
panic ("Out of space.");
*ptr = ADDR_TO_PTR (addr_extend (storage.addr, 0, PAGESIZE_LOG2));
@@ -166,7 +167,8 @@ fault (struct pager *pager,
panic ("Failed to ensure slot at " ADDR_FMT, ADDR_PRINTF (page));
struct storage storage = storage_alloc (anon->activity,
- cap_page, STORAGE_UNKNOWN, page);
+ cap_page, STORAGE_UNKNOWN,
+ OBJECT_POLICY_DEFAULT, page);
if (ADDR_IS_VOID (storage.addr))
panic ("Out of memory.");
storage_desc->storage = storage.addr;
diff --git a/libhurd-mm/capalloc.c b/libhurd-mm/capalloc.c
index 014252d..dde4956 100644
--- a/libhurd-mm/capalloc.c
+++ b/libhurd-mm/capalloc.c
@@ -92,7 +92,7 @@ cappage_desc_slab_alloc (void *hook, size_t size, void **ptr)
struct storage storage = storage_alloc (meta_data_activity,
cap_page, STORAGE_LONG_LIVED,
- ADDR_VOID);
+ OBJECT_POLICY_DEFAULT, ADDR_VOID);
if (ADDR_IS_VOID (storage.addr))
panic ("Out of storage");
*ptr = ADDR_TO_PTR (addr_extend (storage.addr, 0, PAGESIZE_LOG2));
@@ -171,7 +171,7 @@ capalloc (void)
expect that the page will be long lived. */
struct storage storage = storage_alloc (meta_data_activity,
cap_cappage, STORAGE_LONG_LIVED,
- ADDR_VOID);
+ OBJECT_POLICY_DEFAULT, ADDR_VOID);
if (ADDR_IS_VOID (storage.addr))
{
cappage_desc_free (area);
@@ -187,7 +187,7 @@ capalloc (void)
/* Then, allocate the shadow object. */
struct storage shadow_storage
= storage_alloc (meta_data_activity, cap_page,
- STORAGE_LONG_LIVED, ADDR_VOID);
+ STORAGE_LONG_LIVED, OBJECT_POLICY_DEFAULT, ADDR_VOID);
if (ADDR_IS_VOID (shadow_storage.addr))
{
/* No memory. */
diff --git a/libhurd-mm/exceptions.c b/libhurd-mm/exceptions.c
index 3135b29..65664e4 100644
--- a/libhurd-mm/exceptions.c
+++ b/libhurd-mm/exceptions.c
@@ -71,9 +71,9 @@ exception_frame_slab_alloc (void *hook, size_t size, void **ptr)
struct exception_frame frame;
utcb_state_save (&frame);
- struct storage storage = storage_alloc (meta_data_activity,
- cap_page, STORAGE_EPHEMERAL,
- ADDR_VOID);
+ struct storage storage = storage_alloc (meta_data_activity,
+ cap_page, STORAGE_EPHEMERAL,
+ OBJECT_POLICY_DEFAULT, ADDR_VOID);
*ptr = ADDR_TO_PTR (addr_extend (storage.addr, 0, PAGESIZE_LOG2));
utcb_state_restore (&frame);
@@ -317,7 +317,8 @@ exception_handler_init (void)
extern struct hurd_startup_data *__hurd_startup_data;
struct storage storage = storage_alloc (ADDR_VOID, cap_page,
- STORAGE_LONG_LIVED, ADDR_VOID);
+ STORAGE_LONG_LIVED,
+ OBJECT_POLICY_DEFAULT, ADDR_VOID);
if (ADDR_IS_VOID (storage.addr))
panic ("Failed to allocate page for exception state");
diff --git a/libhurd-mm/storage.c b/libhurd-mm/storage.c
index b403d90..27000ab 100644
--- a/libhurd-mm/storage.c
+++ b/libhurd-mm/storage.c
@@ -155,7 +155,8 @@ check_slab_space_reserve (void)
/* We don't have a reserve. Allocate one now. */
struct storage storage = storage_alloc (meta_data_activity, cap_page,
- STORAGE_LONG_LIVED, ADDR_VOID);
+ STORAGE_LONG_LIVED,
+ OBJECT_POLICY_DEFAULT, ADDR_VOID);
void *buffer = ADDR_TO_PTR (addr_extend (storage.addr, 0, PAGESIZE_LOG2));
buffer = (void *) atomic_exchange_acq (&slab_space_reserve, buffer);
@@ -288,7 +289,9 @@ shadow_setup (struct cap *cap, struct storage_desc *storage)
assert (! as_init_done);
struct storage storage = storage_alloc (meta_data_activity, cap_page,
- STORAGE_LONG_LIVED, ADDR_VOID);
+ STORAGE_LONG_LIVED,
+ OBJECT_POLICY_DEFAULT,
+ ADDR_VOID);
if (ADDR_IS_VOID (storage.addr))
panic ("Out of storage.");
shadow = ADDR_TO_PTR (addr_extend (storage.addr, 0, PAGESIZE_LOG2));
@@ -324,10 +327,12 @@ storage_shadow_setup (struct cap *cap, addr_t folio)
static bool storage_init_done;
+#undef storage_alloc
struct storage
-storage_alloc_ (addr_t activity,
- enum cap_type type, enum storage_expectancy expectancy,
- addr_t addr)
+storage_alloc (addr_t activity,
+ enum cap_type type, enum storage_expectancy expectancy,
+ struct object_policy policy,
+ addr_t addr)
{
assert (storage_init_done);
@@ -483,7 +488,8 @@ storage_alloc_ (addr_t activity,
ss_mutex_unlock (&storage_descs_lock);
if (! desc)
- /* There are no unlock storage areas available. Allocate one. */
+ /* There are no unlocked storage areas available. Allocate
+ one. */
goto do_allocate;
/* DESC desigantes a storage area from which we can allocate a page.
@@ -527,8 +533,7 @@ storage_alloc_ (addr_t activity,
if (likely (!! shadow))
{
cap = &shadow->caps[idx];
- CAP_PROPERTIES_SET (cap, CAP_PROPERTIES (OBJECT_POLICY_DEFAULT,
- CAP_ADDR_TRANS_VOID));
+ CAP_PROPERTIES_SET (cap, CAP_PROPERTIES (policy, CAP_ADDR_TRANS_VOID));
cap->type = type;
}
else
@@ -536,7 +541,7 @@ storage_alloc_ (addr_t activity,
error_t err = rm_folio_object_alloc (meta_data_activity,
folio, idx, type,
- OBJECT_POLICY_DEFAULT, 0,
+ policy, 0,
addr, ADDR_VOID);
assert (! err);
@@ -567,6 +572,7 @@ storage_alloc_ (addr_t activity,
as_dump (NULL);
assert (cap);
cap->type = type;
+ CAP_POLICY_SET (cap, policy);
}
struct storage storage;
diff --git a/libhurd-mm/storage.h b/libhurd-mm/storage.h
index 3f390a8..fffadea 100644
--- a/libhurd-mm/storage.h
+++ b/libhurd-mm/storage.h
@@ -61,15 +61,18 @@ struct storage
caller wants to use the allocated object for address translation,
the caller must allocate the shadow object. If not, functions
including the cap_lookup family will fail. */
-extern struct storage storage_alloc_ (addr_t activity,
- enum cap_type type,
- enum storage_expectancy expectancy,
- addr_t addr);
-#define storage_alloc(__sa_activity, __sa_type, __sa_expectancy, __sa_addr) \
+extern struct storage storage_alloc (addr_t activity,
+ enum cap_type type,
+ enum storage_expectancy expectancy,
+ struct object_policy policy,
+ addr_t addr);
+#define storage_alloc(__sa_activity, __sa_type, __sa_expectancy, \
+ __sa_policy, __sa_addr) \
({ \
struct storage __sa_storage; \
- __sa_storage = storage_alloc_ (__sa_activity, __sa_type, \
- __sa_expectancy, __sa_addr); \
+ __sa_storage = storage_alloc (__sa_activity, __sa_type, \
+ __sa_expectancy, __sa_policy, \
+ __sa_addr); \
debug (5, "storage_alloc (%s, " ADDR_FMT ") -> " ADDR_FMT, \
cap_type_string (__sa_type), ADDR_PRINTF (__sa_addr), \
ADDR_PRINTF (__sa_storage.addr)); \