diff options
Diffstat (limited to 'libhurd-mm/exceptions.c')
-rw-r--r-- | libhurd-mm/exceptions.c | 26 |
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); +} + |