aboutsummaryrefslogtreecommitdiffstats
path: root/arena.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2001-10-18 21:51:06 +0000
committerH. Peter Anvin <hpa@zytor.com>2001-10-18 21:51:06 +0000
commit6f9d2dab5ff8d60ed805a821e9c7d2272c753e81 (patch)
treed1e4b06be64500b9f6c2c75f360778a3fcf564c4 /arena.c
parent579d4257024dc37f41439f268cc6bb815ada84db (diff)
downloadlpsm-6f9d2dab5ff8d60ed805a821e9c7d2272c753e81.tar.gz
lpsm-6f9d2dab5ff8d60ed805a821e9c7d2272c753e81.tar.xz
lpsm-6f9d2dab5ff8d60ed805a821e9c7d2272c753e81.zip
Add objstore_arena_stats()objstore-0.0.1
Add additional debugging output
Diffstat (limited to 'arena.c')
-rw-r--r--arena.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/arena.c b/arena.c
index 4d3f611..3ebd885 100644
--- a/arena.c
+++ b/arena.c
@@ -115,13 +115,14 @@ static void objstore_sigsegv(int signal, siginfo_t *siginfo, void *ptr)
struct sigcontext *ctxt;
# ifdef __i386__ /* This is so specific to Linux/i386 */
+ /* Don't even begin to ask me where the 0x14 comes from */
+ ctxt = (struct sigcontext *)((char *)ptr + 0x14);
+
if ( siginfo->si_code == 0 ) {
/* Old kernel. Fill in data to the best of our knowledge. */
- /* Don't even begin to ask me where the 0x14 comes from */
- ctxt = (struct sigcontext *)((char *)ptr + 0x14);
- if ( ctxt->trapno == 14 ) {
- /* Linux/i386 uses unmapped pages to mimic PROT_NONE, so we can't
- tell ACCERR and MAPERR apart from the register state */
+ if ( ctxt->trapno == 14 ) {
+ /* Linux/i386 uses unmapped pages to mimic PROT_NONE, so we can't
+ tell ACCERR and MAPERR apart from the register state */
siginfo->si_code = SEGV_ACCERR;
siginfo->si_addr = (void *)ctxt->cr2;
}
@@ -142,6 +143,14 @@ static void objstore_sigsegv(int signal, siginfo_t *siginfo, void *ptr)
sigemptyset(&dfl.sa_mask);
dfl.sa_flags = SA_ONESHOT;
sigaction(SIGSEGV, &dfl, NULL);
+
+#ifdef __linux
+#ifdef __i386__
+ /* Technically unsafe, but who cares at this point... */
+ fprintf(stderr, "SIGSEGV at %p, %%eip = %p\n",
+ siginfo->si_addr, (void *)ctxt->eip);
+#endif
+#endif
errno = old_errno;
return; /* Re-take fault */