summaryrefslogtreecommitdiff
path: root/libhurd-mm/exceptions.c
diff options
context:
space:
mode:
authorneal <neal>2008-06-16 21:27:40 +0000
committerneal <neal>2008-06-16 21:27:40 +0000
commit0cc9b9efcad805a9118c368b72b13417315526c9 (patch)
tree03548e0caa9ec35d3f5326195e9b3ecc30d40679 /libhurd-mm/exceptions.c
parent64639177cfc19f25b4c65ec7a8f8af110264c907 (diff)
libhurd-mm/
2008-06-16 Neal H. Walfield <neal@gnu.org> * map.h: New file. * map.c: New file. * Makefile.am (libhurd_mm_a_SOURCES): Add map.h and map.c. * headers.m4: Link map.h to sysroot/include/hurd/map.h. * pager.h: Rewrite. * pager.c: Likewise. * anonymous.h (ANONYMOUS_STAGING_AREA): New define. (anonymous_pager_fill_t): Don't pass the base of the region. Pass the location of the storage corresponding to the pages on which the faults were raised and the offset into the region. Update users. (struct anonymous_pager): Add fields map_area, map_area_count and lock. Remove field alloced_region. (anonymous_pager_alloc): Replace size parameter with length parameter. Take access parameter indicating the desired access. Update users. * anonymous.c (offset_compare): Compare the values, not the pointers. (fault): Update signature to be consistent with new API. Lock ANON->LOCK. Always look up the storage descriptor corresponding to the faulted page. Copy the storage to the faulted address as required. Update how we call ANON->FILL to be consistent with the new API. (destroy): Free ANON->STAGING_AREA. (anonymous_pager_alloc): Update signature to be consistent with new API. Allocate the staging area if ANONYMOUS_STAGING_AREA is set. Allocate it separately from the main map. Create a map corresponding to the region. (anonymous_pager_destroy): Just lock ANON->LOCK. Don't call destroy, call pager_deinit. * mmap.c: Include <hurd/map.h>. (mmap): Add support for protection other than read/write. (munmap): Rewrite to use new API. Use map_split to support splitting of memory maps. * exceptions.c: Don't include "pager.h", include "map.h". (exception_handler_normal): Don't call pager_fault but map_fault. (exception_handler_activated): Likewise. ruth/ 2008-06-16 Neal H. Walfield <neal@gnu.org> * ruth.c (main): Improve mmap test. Update use of anonymous_pager_alloc to be consistent with new API. Update fill functions to be consistent with new API. Remove redundant test. benchmarks/ 2008-06-16 Neal H. Walfield <neal@gnu.org> * activity-distribution.c (main): Update use of anonymous_pager_alloc to be consistent with new API. Update fill functions to be consistent with new API.
Diffstat (limited to 'libhurd-mm/exceptions.c')
-rw-r--r--libhurd-mm/exceptions.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/libhurd-mm/exceptions.c b/libhurd-mm/exceptions.c
index afdd10e..2eede5f 100644
--- a/libhurd-mm/exceptions.c
+++ b/libhurd-mm/exceptions.c
@@ -29,7 +29,7 @@
#include <signal.h>
#include <string.h>
-#include "pager.h"
+#include "map.h"
#include "as.h"
extern struct hurd_startup_data *__hurd_startup_data;
@@ -190,11 +190,25 @@ exception_handler_normal (struct exception_frame *exception_frame)
if (err)
panic ("Failed to unmarshal exception: %d", err);
- bool r = pager_fault (fault, ip, info);
+ bool r = map_fault (fault, ip, info);
if (! r)
{
- debug (0, "Fault at " ADDR_FMT " (ip: %p)",
- ADDR_PRINTF (fault), ip);
+ debug (0, "SIGSEGV at " ADDR_FMT " (ip: %p, sp: %p, eax: %p, ecx: %p, edx: %p, eflags: %p)",
+ ADDR_PRINTF (fault), ip, sp,
+ exception_frame->regs[0],
+ exception_frame->regs[1],
+ exception_frame->regs[2],
+ exception_frame->regs[3]);
+
+ extern int backtrace (void **array, int size);
+
+ void *a[20];
+ int count = backtrace (a, sizeof (a) / sizeof (a[0]));
+ int i;
+ s_printf ("Backtrace: ");
+ for (i = 0; i < count; i ++)
+ s_printf ("%p ", a[i]);
+ s_printf ("\n");
siginfo_t si;
memset (&si, 0, sizeof (si));
@@ -279,7 +293,7 @@ exception_handler_activated (struct exception_page *exception_page)
"(ip: %x, sp: %x).",
ADDR_PRINTF (fault), ip, sp);
- bool r = pager_fault (fault, ip, info);
+ bool r = map_fault (fault, ip, info);
if (! r)
{
debug (0, "Fault at " ADDR_FMT " (ip: %p)",