summaryrefslogtreecommitdiff
path: root/libhurd-mm/exceptions.c
diff options
context:
space:
mode:
authorneal <neal>2007-12-12 23:32:52 +0000
committerneal <neal>2007-12-12 23:32:52 +0000
commit2bc0ce8855c99d9c05a75b53498abc02e8188d6b (patch)
tree0af5cb9cb160f8e9fddf45e46584c36a868fe6e4 /libhurd-mm/exceptions.c
parentc6db87c3de0012174f1ec96eb4922ab2678b701d (diff)
hurd/
2007-12-13 Neal H. Walfield <neal@gnu.org> * exceptions.h (exception_page_cleanup): New declaration. libhurd-mm/ 2007-12-13 Neal H. Walfield <neal@gnu.org> * exceptions.c (exception_frame_alloc): When allocating the first frame, set EXCEPTION_PAGE->EXCEPTION_STACK_BOTTOM. (exception_page_cleanup): New function. * ia32-exception-entry.S (_exception_handler_end): Correctly adjust the exception page's exception stack. libpthread/ 2007-12-13 Neal H. Walfield <neal@gnu.org> * sysdeps/l4/hurd/pt-thread-halt.c: Include <hurd/exceptions.h>. (__pthread_thread_halt): Call exception_page_cleanup.
Diffstat (limited to 'libhurd-mm/exceptions.c')
-rw-r--r--libhurd-mm/exceptions.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libhurd-mm/exceptions.c b/libhurd-mm/exceptions.c
index 47f9790..71eb16c 100644
--- a/libhurd-mm/exceptions.c
+++ b/libhurd-mm/exceptions.c
@@ -93,6 +93,10 @@ exception_frame_alloc (struct exception_page *exception_page)
exception_frame->next->prev = exception_frame;
exception_page->exception_stack = exception_frame;
+
+ if (! exception_page->exception_stack_bottom)
+ /* This is the first frame we've allocated. */
+ exception_page->exception_stack_bottom = exception_frame;
}
return exception_frame;
@@ -310,3 +314,25 @@ exception_handler_init (void)
if (err)
panic ("Failed to install exception page");
}
+
+void
+exception_page_cleanup (struct exception_page *exception_page)
+{
+ struct exception_frame *f;
+ struct exception_frame *prev = exception_page->exception_stack_bottom;
+
+ int count = 0;
+ while ((f = prev))
+ {
+ prev = f->prev;
+ hurd_slab_dealloc (&exception_frame_slab, f);
+ count ++;
+ }
+
+ assertx (count == exception_page->frame_count,
+ "count: %d, exception_page->frame_count: %d",
+ count, exception_page->frame_count);
+
+ debug (0, "Freed %d frames", count);
+}
+