summaryrefslogtreecommitdiff
path: root/ruth
diff options
context:
space:
mode:
authorneal <neal>2007-11-19 22:42:36 +0000
committerneal <neal>2007-11-19 22:42:36 +0000
commit5c2c982ba3cfbe34c79cb2096018567ca6cd8fb6 (patch)
tree186d51c98040279981a620affa2fdf4b26dadcff /ruth
parentf38367b6493d6d4a51011a8d0fa81d1f3f49ca9e (diff)
hurd/
2007-11-19 Neal H. Walfield <neal@gnu.org> * addr.h (ADDR_TO_PTR): Assert that the address corresponds to a pointer, not the root of a mapped page. Update callers. (PTR_TO_ADDR): Return an address corresponding to a pointer, not the root of a mapped page. Update callers. libhurd-mm/ 2007-11-19 Neal H. Walfield <neal@gnu.org> * as.c (__hurd_startup_data): Declare. (free_space_desc_slab_alloc): Use ADDR_TO_PTR and PTR_TO_ADDR correctly. (free_space_desc_slab_dealloc): Likewise. (allocate_object): Likewise. (storage_alloc): Likewise. (as_init): Likewise. * capalloc.c (cappage_desc_slab_alloc): Likewise. (cappage_desc_slab_dealloc): Likewise. * storage.c (__hurd_startup_data): Declare. (check_slab_space_reserve): Likewise. (storage_desc_slab_dealloc): Likewise. (shadow_setup): Likewise. (storage_free): Likewise. ruth/ 2007-11-19 Neal H. Walfield <neal@gnu.org> * ruth.c (main): Use ADDR_TO_PTR and PTR_TO_ADDR correctly.
Diffstat (limited to 'ruth')
-rw-r--r--ruth/ChangeLog4
-rw-r--r--ruth/ruth.c18
2 files changed, 16 insertions, 6 deletions
diff --git a/ruth/ChangeLog b/ruth/ChangeLog
index 13c7c37..219de8a 100644
--- a/ruth/ChangeLog
+++ b/ruth/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-19 Neal H. Walfield <neal@gnu.org>
+
+ * ruth.c (main): Use ADDR_TO_PTR and PTR_TO_ADDR correctly.
+
2007-11-16 Neal H. Walfield <neal@gnu.org>
* Makefile.am (ruth_CPPFLAGS): Move value from here...
diff --git a/ruth/ruth.c b/ruth/ruth.c
index 396fe17..006465d 100644
--- a/ruth/ruth.c
+++ b/ruth/ruth.c
@@ -79,7 +79,7 @@ getpagesize()
int
main (int argc, char *argv[])
{
- output_debug = 2;
+ output_debug = 3;
printf ("%s " PACKAGE_VERSION "\n", program_name);
printf ("Hello, here is Ruth, your friendly root server!\n");
@@ -174,7 +174,8 @@ main (int argc, char *argv[])
addr_t shadow_addr
= storage_alloc (activity, cap_page, STORAGE_EPHEMERAL, ADDR_VOID);
- struct object *shadow = ADDR_TO_PTR (shadow_addr);
+ struct object *shadow = ADDR_TO_PTR (addr_extend (shadow_addr,
+ 0, PAGESIZE_LOG2));
cap_set_shadow (slot, shadow);
memset (shadow, 0, PAGESIZE);
@@ -209,7 +210,7 @@ main (int argc, char *argv[])
void *shadow = cap_get_shadow (slot);
assert (shadow);
- storage_free (PTR_TO_ADDR (shadow), 1);
+ storage_free (addr_chop (PTR_TO_ADDR (shadow), PAGESIZE_LOG2), 1);
}
as_free (root, 1);
@@ -233,17 +234,22 @@ main (int argc, char *argv[])
: STORAGE_EPHEMERAL,
ADDR_VOID);
assert (! ADDR_IS_VOID (storage[i]));
- * (int *) (ADDR_TO_PTR (storage[i])) = i;
+ * (int *) (ADDR_TO_PTR (addr_extend (storage[i], 0, PAGESIZE_LOG2)))
+ = i;
int j;
for (j = 0; j <= i; j ++)
- assert (* (int *) (ADDR_TO_PTR (storage[j])) == j);
+ assert (* (int *) (ADDR_TO_PTR (addr_extend (storage[j],
+ 0, PAGESIZE_LOG2)))
+ == j);
}
for (i = 0; i < n; i ++)
{
storage_free (storage[i], true);
}
+
+ printf ("ok.\n");
}
{
@@ -276,7 +282,7 @@ main (int argc, char *argv[])
assert (! ADDR_IS_VOID (storage));
debug (1, "Writing before dealloc...");
- int *buffer = ADDR_TO_PTR (addr);
+ int *buffer = ADDR_TO_PTR (addr_extend (addr, 0, PAGESIZE_LOG2));
*buffer = 0;
storage_free (storage, true);