Add option EXCEPTION_TRACING, which enables KTR-like functionality

for processor interruptions. This is especially useful to track
unexpected nested TLB faults.

Approved by: re (blanket)
This commit is contained in:
Marcel Moolenaar 2007-07-30 22:42:33 +00:00
parent fe1c66b9d7
commit ea5e2a02af
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171665
3 changed files with 87 additions and 1 deletions

View file

@ -11,6 +11,8 @@ UWX_TRACE_ENABLE opt_global.h
COMPAT_IA32 opt_compat.h
EXCEPTION_TRACING opt_xtrace.h
VGA_ALT_SEQACCESS opt_vga.h
VGA_DEBUG opt_vga.h
VGA_NO_FONT_LOADING opt_vga.h

View file

@ -29,6 +29,8 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <opt_xtrace.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/cons.h>
@ -604,3 +606,29 @@ stack_save(struct stack *st)
* Can unw_create* sleep?
*/
}
#ifdef EXCEPTION_TRACING
extern long xtrace[];
extern long *xhead;
DB_COMMAND(xtrace, db_xtrace)
{
long *p;
p = (*xhead == 0) ? xtrace : xhead;
db_printf("ITC\t\t IVT\t\t IIP\t\t IFA\t\t ISR\n");
if (*p == 0)
return;
do {
db_printf("%016lx %016lx %016lx %016lx %016lx\n", p[0], p[1],
p[2], p[3], p[4]);
p += 5;
if (p == (void *)&xhead)
p = xtrace;
} while (p != xhead);
}
#endif

View file

@ -28,6 +28,8 @@
#include <machine/asm.h>
__FBSDID("$FreeBSD$");
#include <opt_xtrace.h>
#include <machine/pte.h>
#include <assym.s>
@ -38,6 +40,59 @@ __FBSDID("$FreeBSD$");
* ar.k4 = PCPU data
*/
#ifdef EXCEPTION_TRACING
.data
.global xtrace, xhead
xtrace: .space 1024*5*8
xhead: data8 xtrace
#define XTRACE(offset) \
{ .mmi ; \
mov r24=ar.itc ; \
mov r25=cr.iip ; \
mov r27=offset ; \
} ; \
{ .mlx ; \
mov r28=cr.ifa ; \
movl r29=xhead ;; \
} ; \
{ .mmi ; \
ld8 r29=[r29] ;; \
st8 [r29]=r24,8 ; \
nop 0 ;; \
} ; \
{ .mmi ; \
st8 [r29]=r27,8 ;; \
mov r24=cr.isr ; \
add r27=8,r29 ;; \
} ; \
{ .mmi ; \
st8 [r29]=r25,16 ;; \
st8 [r27]=r28,16 ; \
mov r25=pr ;; \
} ; \
{ .mlx ; \
st8 [r29]=r24 ; \
movl r28=xhead ;; \
} ; \
{ .mii ; \
cmp.eq p15,p0=r27,r28 ; \
addl r29=1024*5*8,r0 ;; \
(p15) sub r27=r28,r29 ;; \
} ; \
{ .mib ; \
st8 [r28]=r27 ; \
mov pr=r25,0x1ffff ; \
nop 0 ;; \
}
#else
#define XTRACE(offset)
#endif
.text
/*
@ -606,7 +661,8 @@ END(exception_restore)
.unwabi @svr4, 'I'; \
.save rp, r0; \
.body; \
ivt_##name:
ivt_##name: \
XTRACE(offset)
#define IVT_END(name) \
.endp ivt_##name