summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--device/intr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/device/intr.c b/device/intr.c
index b0dcd83..0fa43c5 100644
--- a/device/intr.c
+++ b/device/intr.c
@@ -10,6 +10,9 @@
#define sti() __asm__ __volatile__ ("sti": : :"memory")
#define cli() __asm__ __volatile__ ("cli": : :"memory")
+/* The cache which holds our proxy memory objects. */
+static struct kmem_cache intr_entry_cache;
+
struct intr_entry
{
queue_chain_t chain;
@@ -58,7 +61,7 @@ insert_intr_entry (int line, ipc_port_t dest, struct intr_entry **entry)
struct intr_entry *e, *new;
int free = 0;
- new = (struct intr_entry *) kalloc (sizeof (*new));
+ new = (struct intr_entry *) kmem_cache_alloc (&intr_entry_cache);
if (new == NULL)
return D_NO_MEMORY;
new->line = line;
@@ -81,7 +84,7 @@ insert_intr_entry (int line, ipc_port_t dest, struct intr_entry **entry)
out:
sti ();
if (free)
- kfree ((vm_offset_t) new, sizeof (*new));
+ kmem_cache_free (&intr_entry_cache, (vm_offset_t) new);
*entry = new;
return err;
}
@@ -146,6 +149,9 @@ intr_thread ()
queue_init (&intr_queue);
init_mach_intr_notification (&mach_intr_notification_template);
+ kmem_cache_init (&intr_entry_cache, "intr_entry",
+ sizeof (struct intr_entry), 0, NULL, 0);
+
for (;;)
{
assert_wait ((event_t) &intr_thread, FALSE);
@@ -183,7 +189,7 @@ intr_thread ()
assert (!queue_empty (&intr_queue));
queue_remove (&intr_queue, e, struct intr_entry *, chain);
sti ();
- kfree ((vm_offset_t) e, sizeof (*e));
+ kmem_cache_free (&intr_entry_cache, (vm_offset_t) e);
cli ();
}
}