diff options
author | neal <neal> | 2005-06-22 10:18:09 +0000 |
---|---|---|
committer | neal <neal> | 2005-06-22 10:18:09 +0000 |
commit | 7591b1a5af58f5e051260df7684c7300d8417a16 (patch) | |
tree | 5de2b7c92681529c4c88242845c7da59bf7b080a /physmem | |
parent | 0acc3da2883a9f05552a3f67ff107deae3e1b8e4 (diff) |
libhurd-slab/
2005-06-22 Neal H. Walfield <neal@gnu.org>
* slab.h: Clean up comments.
(SLAB_CLASS): New macro.
physmem/
2005-06-22 Neal H. Walfield <neal@gnu.org>
* priv.h (frame_entry_init): Declare.
(frame_init): Declare.
* physmem.c (main): Call frame_entry_init and frame_init.
* frame-entry.c: Create a frame_entry slab class. Don't use
HURD_SLAB_SPACE_INITIALIZER to initialize frame_entry_space. Do
it ...
(frame_entry_init): ... here with hurd_frame_entry_slab_init.
(frame_entry_constructor): Update argument type given stronger
type checking.
(frame_entry_alloc): Call hurd_frame_entry_slab_alloc, not
hurd_slab_alloc.
(frame_entry_free): Call hurd_frame_entry_slab_dealloc, not
hurd_slab_dealloc.
* frame.c: Create a frame slab class. Don't use
HURD_SLAB_SPACE_INITIALIZER to initialize frame_space. Do it ...
(frame_init): ... here with hurd_frame_slab_init.
(frame_constructor): Update argument type given stronger type
checking.
(frame_alloc): Call hurd_frame_slab_alloc, not hurd_slab_alloc.
(frame_free): Call hurd_frame_slab_dealloc, not hurd_slab_dealloc.
Diffstat (limited to 'physmem')
-rw-r--r-- | physmem/ChangeLog | 26 | ||||
-rw-r--r-- | physmem/frame-entry.c | 23 | ||||
-rw-r--r-- | physmem/frame.c | 23 | ||||
-rw-r--r-- | physmem/physmem.c | 3 | ||||
-rw-r--r-- | physmem/priv.h | 6 |
5 files changed, 60 insertions, 21 deletions
diff --git a/physmem/ChangeLog b/physmem/ChangeLog index d8aeaf7..51e4f3b 100644 --- a/physmem/ChangeLog +++ b/physmem/ChangeLog @@ -1,6 +1,30 @@ +2005-06-22 Neal H. Walfield <neal@gnu.org> + + * priv.h (frame_entry_init): Declare. + (frame_init): Declare. + * physmem.c (main): Call frame_entry_init and frame_init. + * frame-entry.c: Create a frame_entry slab class. Don't use + HURD_SLAB_SPACE_INITIALIZER to initialize frame_entry_space. Do + it ... + (frame_entry_init): ... here with hurd_frame_entry_slab_init. + (frame_entry_constructor): Update argument type given stronger + type checking. + (frame_entry_alloc): Call hurd_frame_entry_slab_alloc, not + hurd_slab_alloc. + (frame_entry_free): Call hurd_frame_entry_slab_dealloc, not + hurd_slab_dealloc. + * frame.c: Create a frame slab class. Don't use + HURD_SLAB_SPACE_INITIALIZER to initialize frame_space. Do it ... + (frame_init): ... here with hurd_frame_slab_init. + (frame_constructor): Update argument type given stronger type + checking. + (frame_alloc): Call hurd_frame_slab_alloc, not hurd_slab_alloc. + (frame_free): Call hurd_frame_slab_dealloc, not hurd_slab_dealloc. + 2005-04-06 Neal H. Walfield <neal@gnu.org> - * physmem.h: Move from here... * priv.h: ...to here. Improve + * physmem.h: Move from here... + * priv.h: ...to here. Improve comments. (extract_access): New function. (struct frame): Add lock field. Change type of may_be_mapped diff --git a/physmem/frame-entry.c b/physmem/frame-entry.c index 65dbbc0..47617ec 100644 --- a/physmem/frame-entry.c +++ b/physmem/frame-entry.c @@ -36,21 +36,24 @@ #include "zalloc.h" static error_t -frame_entry_constructor (void *hook, void *buffer) +frame_entry_constructor (void *hook, struct frame_entry *frame_entry) { - struct frame_entry *frame_entry = buffer; - frame_entry->shared_next = frame_entry; frame_entry->shared_prevp = &frame_entry->shared_next; return 0; } -static struct hurd_slab_space frame_entry_space - = HURD_SLAB_SPACE_INITIALIZER (struct frame_entry, - NULL, NULL, - frame_entry_constructor, NULL, - NULL); +SLAB_CLASS(frame_entry, struct frame_entry) + +static struct hurd_frame_entry_slab_space frame_entry_space; + +void +frame_entry_init (void) +{ + hurd_frame_entry_slab_init (&frame_entry_space, NULL, NULL, + frame_entry_constructor, NULL, NULL); +} void frame_entry_dump (struct frame_entry *fe) @@ -85,7 +88,7 @@ frame_entry_alloc (void) error_t err; struct frame_entry *frame_entry; - err = hurd_slab_alloc (&frame_entry_space, (void *) &frame_entry); + err = hurd_frame_entry_slab_alloc (&frame_entry_space, &frame_entry); if (err) return 0; @@ -103,7 +106,7 @@ frame_entry_free (struct frame_entry *frame_entry) memset (frame_entry, 0xfe, sizeof (struct frame_entry)); frame_entry_constructor (0, frame_entry); #endif - hurd_slab_dealloc (&frame_entry_space, frame_entry); + hurd_frame_entry_slab_dealloc (&frame_entry_space, frame_entry); } /* If SHARE is non-NULL, add FRAME_ENTRY (which is not attach to any diff --git a/physmem/frame.c b/physmem/frame.c index 44c1462..cd87388 100644 --- a/physmem/frame.c +++ b/physmem/frame.c @@ -52,10 +52,8 @@ frame_dump (struct frame *frame) } static error_t -frame_constructor (void *hook, void *buffer) +frame_constructor (void *hook, struct frame *frame) { - struct frame *frame = buffer; - frame->refs = 1; pthread_mutex_init (&frame->lock, 0); pthread_mutex_lock (&frame->lock); @@ -65,11 +63,16 @@ frame_constructor (void *hook, void *buffer) return 0; } -static struct hurd_slab_space frame_space - = HURD_SLAB_SPACE_INITIALIZER (struct frame, - NULL, NULL, - frame_constructor, NULL, - NULL); +SLAB_CLASS(frame, struct frame) + +static struct hurd_frame_slab_space frame_space; + +void +frame_init (void) +{ + hurd_frame_slab_init (&frame_space, NULL, NULL, + frame_constructor, NULL, NULL); +} struct frame * frame_alloc (size_t size) @@ -80,7 +83,7 @@ frame_alloc (size_t size) /* The size must be a power of 2. */ assert ((size & (size - 1)) == 0); - err = hurd_slab_alloc (&frame_space, (void *) &frame); + err = hurd_frame_slab_alloc (&frame_space, &frame); if (err) /* XXX: Free some memory and try again. */ assert_perror (err); @@ -147,7 +150,7 @@ frame_deref (struct frame *frame) frame->memory = l4_fpage (0xDEAD000, 0); #endif - hurd_slab_dealloc (&frame_space, frame); + hurd_frame_slab_dealloc (&frame_space, frame); } else { diff --git a/physmem/physmem.c b/physmem/physmem.c index 27ca847..b7aa07a 100644 --- a/physmem/physmem.c +++ b/physmem/physmem.c @@ -262,6 +262,9 @@ main (int argc, char *argv[]) create_bootstrap_caps (bucket); + frame_entry_init (); + frame_init (); + /* Create the server thread and start serving RPC requests. */ err = pthread_create_from_l4_tid_np (&manager, NULL, server_thread, physmem_server, bucket); diff --git a/physmem/priv.h b/physmem/priv.h index 5d21341..d86357b 100644 --- a/physmem/priv.h +++ b/physmem/priv.h @@ -182,6 +182,9 @@ struct container hurd_btree_frame_entry_t frame_entries; }; +/* Initialize the frame subsystem. */ +extern void frame_entry_init (void); + /* Allocate an uninitialized frame entry structure. Return NULL if there is insufficient memory. */ extern struct frame_entry *frame_entry_alloc (void); @@ -284,6 +287,9 @@ extern error_t frame_entry_deallocate (struct container *cont, uintptr_t cont_start, size_t length); +/* Initialize the frame subsystem. */ +extern void frame_init (void); + /* Allocate a frame structure holding SIZE bytes. Physical memory must have already been reserved (by, e.g. a prior frame_entry_alloc call). Allocation of the physical memory is deferred until |