summaryrefslogtreecommitdiff
path: root/libhurd-mm/anonymous.c
diff options
context:
space:
mode:
authorneal <neal>2007-11-22 16:01:52 +0000
committerneal <neal>2007-11-22 16:01:52 +0000
commit6445f7bf5bf8e97e653655ae74fbde26610c42ed (patch)
tree288a9c355bbad58a649af4bd3f485bd7c589fdc1 /libhurd-mm/anonymous.c
parent89fbedd456ab281fd697b4eca2ae3e2e0c744dac (diff)
libhurd-mm/
2007-11-22 Neal H. Walfield <neal@gnu.org> * storage.h (struct storage): New struct. (storage_alloc): Return a struct storage, not an addr. Update all callers. * storage.c (struct storage_desc): Remove field shadow. Add field cap. (shadow_setup): Save the cap. (storage_alloc): Return a struct storage, not an addr. (storage_free): Correctly free the shadow if not used. Update STORAGE->CAP to reflect that the folio has been removed. * capalloc.c (struct cappage_desc): Add field cap. (capalloc): Stash CAP. When allocating a cappage, allocate a shadow object. (capfree): Really free CAPPAGE if there is another page available. If freeing CAPPAGE, unlink DESC and update DESC->CAP to reflect that the page has been deallocated, deallocate the shadow, and deallocate CAPPAGE. * exceptions.c (exception_thread): Print IP when a fault cannot be resolved. * mmap.c (mmap): Cast addr to a uintptr_t to elide warning. ruth/ 2007-11-22 Neal H. Walfield <neal@gnu.org> * ruth.c (main): Update uses of stroage_alloc to its new interface.
Diffstat (limited to 'libhurd-mm/anonymous.c')
-rw-r--r--libhurd-mm/anonymous.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libhurd-mm/anonymous.c b/libhurd-mm/anonymous.c
index 933b562..07a5a15 100644
--- a/libhurd-mm/anonymous.c
+++ b/libhurd-mm/anonymous.c
@@ -58,10 +58,11 @@ BTREE_CLASS (storage_desc, struct storage_desc,
static error_t
slab_alloc (void *hook, size_t size, void **ptr)
{
- addr_t storage = storage_alloc (meta_data_activity,
- cap_page, STORAGE_LONG_LIVED, ADDR_VOID);
-
- *ptr = ADDR_TO_PTR (addr_extend (storage, 0, PAGESIZE_LOG2));
+ struct storage storage = storage_alloc (meta_data_activity, cap_page,
+ STORAGE_LONG_LIVED, ADDR_VOID);
+ if (ADDR_IS_VOID (storage.addr))
+ panic ("Out of space.");
+ *ptr = ADDR_TO_PTR (addr_extend (storage.addr, 0, PAGESIZE_LOG2));
return 0;
}
@@ -161,10 +162,11 @@ fault (struct pager *pager,
if (! r)
panic ("Failed to ensure slot at " ADDR_FMT, ADDR_PRINTF (page));
- storage_desc->storage = storage_alloc (anon->activity,
- cap_page, STORAGE_UNKNOWN, page);
- if (ADDR_IS_VOID (storage_desc->storage))
+ struct storage storage = storage_alloc (anon->activity,
+ cap_page, STORAGE_UNKNOWN, page);
+ if (ADDR_IS_VOID (storage.addr))
panic ("Out of memory.");
+ storage_desc->storage = storage.addr;
struct storage_desc *conflict;
conflict = hurd_btree_storage_desc_insert (storage_descs, storage_desc);