summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2009-02-23 03:47:27 +0100
committerNeal H. Walfield <neal@gnu.org>2009-02-23 03:47:27 +0100
commite0afbeda30302cb396c31f15ea5556841bd45ece (patch)
tree703e4a7fcb785a7549acf063380beec413882964
parent50c25bb3200d344dffa683c31770d4f921faa890 (diff)
Correctly deal allocating a new folio prior to AS initialization.
-rw-r--r--libhurd-mm/as.c6
-rw-r--r--libhurd-mm/storage.c21
2 files changed, 22 insertions, 5 deletions
diff --git a/libhurd-mm/as.c b/libhurd-mm/as.c
index cbe2bc7..b899e46 100644
--- a/libhurd-mm/as.c
+++ b/libhurd-mm/as.c
@@ -375,9 +375,9 @@ as_allocate_page_table (vg_addr_t addr)
#define DESC_ADDITIONAL ((PAGESIZE + sizeof (struct hurd_object_desc) - 1) \
/ sizeof (struct hurd_object_desc))
-static struct hurd_object_desc __attribute__((aligned(PAGESIZE)))
+struct hurd_object_desc __attribute__((aligned(PAGESIZE)))
desc_additional[DESC_ADDITIONAL];
-static int desc_additional_count;
+int desc_additional_count;
/* Find an appropriate slot for an object. */
struct hurd_object_desc *
@@ -467,7 +467,7 @@ as_alloc_slow (int width)
assertx ((((uintptr_t) &desc_additional[0]) & (PAGESIZE - 1)) == 0,
"%p", &desc_additional[0]);
- debug (5, "Allocating space for " VG_ADDR_FMT
+ debug (5, "Allocating slot for " VG_ADDR_FMT
"; using additional descriptor %d",
VG_ADDR_PRINTF (slot), desc_additional_count);
diff --git a/libhurd-mm/storage.c b/libhurd-mm/storage.c
index e6b915b..862fa44 100644
--- a/libhurd-mm/storage.c
+++ b/libhurd-mm/storage.c
@@ -538,6 +538,9 @@ storage_check_reserve (bool i_may_have_lock)
i_may_have_lock);
}
+extern struct hurd_object_desc desc_additional[];
+extern int desc_additional_count;
+
#undef storage_alloc
struct storage
storage_alloc (vg_addr_t activity,
@@ -667,7 +670,7 @@ storage_alloc (vg_addr_t activity,
struct vg_object *shadow = desc->shadow;
struct vg_cap *cap = NULL;
- if (likely (!! shadow))
+ if (likely (shadow))
{
cap = &shadow->caps[idx];
VG_CAP_PROPERTIES_SET (cap, VG_CAP_PROPERTIES (policy,
@@ -675,7 +678,15 @@ storage_alloc (vg_addr_t activity,
cap->type = type;
}
else
- assert (! as_init_done);
+ {
+ assert (! as_init_done);
+
+ struct hurd_object_desc *desc = &desc_additional[desc_additional_count];
+ desc_additional_count ++;
+
+ desc->object = desc->storage = object;
+ desc->type = type;
+ }
/* We drop DESC->LOCK. */
assert (desc->owner == hurd_myself ());
@@ -694,6 +705,8 @@ storage_alloc (vg_addr_t activity,
/* We also have to update the shadow for VG_ADDR. Unfortunately, we
don't have the cap although the caller might. */
{
+ assert (as_init_done);
+
bool ret = as_slot_lookup_use
(addr,
({
@@ -751,6 +764,10 @@ storage_free_ (vg_addr_t object, bool unmap_now)
assert (storage->owner == vg_niltid);
storage->owner = hurd_myself ();
+ debug (5, "Folio: "VG_ADDR_FMT", shadow: %p, %d free, mode: %d",
+ VG_ADDR_PRINTF (storage->folio),
+ storage->shadow, storage->free, storage->mode);
+
atomic_increment (&free_count);
storage->free ++;