diff options
-rw-r--r-- | sys/alpha/alpha/support.s | 6 | ||||
-rw-r--r-- | sys/i386/i386/swtch.s | 12 | ||||
-rw-r--r-- | sys/kern/kern_shutdown.c | 6 | ||||
-rw-r--r-- | sys/sys/systm.h | 6 |
4 files changed, 20 insertions, 10 deletions
diff --git a/sys/alpha/alpha/support.s b/sys/alpha/alpha/support.s index a340d75..0d485f2 100644 --- a/sys/alpha/alpha/support.s +++ b/sys/alpha/alpha/support.s @@ -680,8 +680,10 @@ LEAF(longjmp, 1) longjmp_botch: lda a0, longjmp_botchmsg - mov ra, a1 - CALL(panic) + mov 0, a1 + mov 0, a2 + mov ra, a3 + CALL(__panic) call_pal PAL_bugchk .data diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index e1d63a6..3782cc9 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -303,20 +303,26 @@ cpu_switch_load_gs: #ifdef INVARIANTS badsw1: pushal + pushl $0 + pushl $0 pushl $sw0_1 - call panic + call __panic sw0_1: .asciz "cpu_throw: no newthread supplied" badsw2: pushal + pushl $0 + pushl $0 pushl $sw0_2 - call panic + call __panic sw0_2: .asciz "cpu_switch: no curthread supplied" badsw3: pushal + pushl $0 + pushl $0 pushl $sw0_3 - call panic + call __panic sw0_3: .asciz "cpu_switch: no newthread supplied" #endif diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 6532972..8778e8a 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -476,7 +476,7 @@ static u_int panic_cpu = NOCPU; * MPSAFE */ void -panic(const char *fmt, ...) +__panic(const char *file, int line, const char *fmt, ...) { struct thread *td = curthread; int bootopt, newpanic; @@ -510,11 +510,11 @@ panic(const char *fmt, ...) if (newpanic) { (void)vsnprintf(buf, sizeof(buf), fmt, ap); panicstr = buf; - printf("panic: %s\n", buf); + printf("panic: %s\nat line %d in file %s\n", buf, line, file); } else { printf("panic: "); vprintf(fmt, ap); - printf("\n"); + printf("\nat line %d in file %s", line, file); } va_end(ap); #ifdef SMP diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 6c1f4b3..8e02a0a 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -136,11 +136,13 @@ void *hashinit(int count, struct malloc_type *type, u_long *hashmask); void *phashinit(int count, struct malloc_type *type, u_long *nentries); #ifdef RESTARTABLE_PANICS -void panic(const char *, ...) __printflike(1, 2); +void __panic(const char *file, int line, const char *, ...) __printflike(3, 4); #else -void panic(const char *, ...) __dead2 __printflike(1, 2); +void __panic(const char *file, int line, const char *, ...) __dead2 __printflike(3, 4); #endif +#define panic(...) __panic(__FILE__, __LINE__, __VA_ARGS__) + void backtrace(void); void cpu_boot(int); void cpu_rootconf(void); |