[REVIEW] panic file+line backout patch
Poul-Henning Kamp
phk at phk.freebsd.dk
Fri Jun 4 12:58:49 GMT 2004
Could the platform people please check that this patch does the
right thing in the assembler code ?
Poul-Henning
Index: alpha/alpha/support.s
===================================================================
RCS file: /home/ncvs/src/sys/alpha/alpha/support.s,v
retrieving revision 1.16
diff -u -r1.16 support.s
--- alpha/alpha/support.s 19 Jan 2004 21:27:10 -0000 1.16
+++ alpha/alpha/support.s 4 Jun 2004 12:55:08 -0000
@@ -680,10 +680,8 @@
longjmp_botch:
lda a0, longjmp_botchmsg
- mov 0, a1
- mov 0, a2
- mov ra, a3
- CALL(__panic)
+ mov ra, a1
+ CALL(panic)
call_pal PAL_bugchk
.data
Index: arm/arm/exception.S
===================================================================
RCS file: /home/ncvs/src/sys/arm/arm/exception.S,v
retrieving revision 1.1
diff -u -r1.1 exception.S
--- arm/arm/exception.S 14 May 2004 11:46:42 -0000 1.1
+++ arm/arm/exception.S 4 Jun 2004 12:56:31 -0000
@@ -65,14 +65,10 @@
*/
ASENTRY_NP(reset_entry)
adr r0, Lreset_panicmsg
- adr r1, Lfile
- mov r2, #__LINE__
- bl _C_LABEL(__panic)
+ bl _C_LABEL(panic)
/* NOTREACHED */
Lreset_panicmsg:
.asciz "Reset vector called, LR = 0x%08x"
-Lfile:
- .asciz __FILE__
.balign 4
/*
@@ -122,12 +118,7 @@
.text
abortprefetch:
adr r0, abortprefetchmsg
- adr r1, filee
- mov r2, #__LINE__
- b _C_LABEL(__panic)
-
-filee:
- .asciz __FILE__
+ b _C_LABEL(panic)
abortprefetchmsg:
.asciz "abortprefetch"
@@ -164,14 +155,10 @@
.text
abortdata:
adr r0, abortdatamsg
- adr r1, file
- mov r2, #__LINE__
- b _C_LABEL(__panic)
+ b _C_LABEL(panic)
abortdatamsg:
.asciz "abortdata"
-file:
- .asciz __FILE__
.align 0
/*
Index: arm/arm/in_cksum_arm.S
===================================================================
RCS file: /home/ncvs/src/sys/arm/arm/in_cksum_arm.S,v
retrieving revision 1.1
diff -u -r1.1 in_cksum_arm.S
--- arm/arm/in_cksum_arm.S 14 May 2004 11:46:42 -0000 1.1
+++ arm/arm/in_cksum_arm.S 4 Jun 2004 12:55:08 -0000
@@ -221,11 +221,7 @@
.Lin4_cksum_whoops:
adr r0, .Lin4_cksum_whoops_str
- adr r1, .LFile
- mov r2, #__LINE__
- bl _C_LABEL(__panic)
-.LFile:
- .asciz __FILE__
+ bl _C_LABEL(panic)
.Lin4_cksum_whoops_str:
.asciz "in4_cksum: out of mbufs\n"
.align 5
Index: arm/arm/locore.S
===================================================================
RCS file: /home/ncvs/src/sys/arm/arm/locore.S,v
retrieving revision 1.1
diff -u -r1.1 locore.S
--- arm/arm/locore.S 14 May 2004 11:46:42 -0000 1.1
+++ arm/arm/locore.S 4 Jun 2004 12:55:08 -0000
@@ -153,9 +153,7 @@
bl _C_LABEL(mi_startup) /* call mi_startup()! */
adr r0, .Lmainreturned
- adr r1, .LFile
- mov r2, #__LINE__
- b _C_LABEL(__panic)
+ b _C_LABEL(anic)
/* NOTEACHED */
#ifdef STARTUP_PAGETABLE_ADDR
#define MMU_INIT(va,pa,n_sec,attr) \
@@ -181,8 +179,6 @@
.word _end
.word svcstk + INIT_ARM_STACK_SIZE
-.LFile:
- .asciz __FILE__
.Lmainreturned:
.asciz "main() returned"
.align 0
Index: i386/i386/swtch.s
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/swtch.s,v
retrieving revision 1.145
diff -u -r1.145 swtch.s
--- i386/i386/swtch.s 7 Apr 2004 20:46:04 -0000 1.145
+++ i386/i386/swtch.s 4 Jun 2004 12:56:05 -0000
@@ -299,26 +299,20 @@
#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
Index: kern/kern_shutdown.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_shutdown.c,v
retrieving revision 1.149
diff -u -r1.149 kern_shutdown.c
--- kern/kern_shutdown.c 5 Apr 2004 21:03:35 -0000 1.149
+++ kern/kern_shutdown.c 4 Jun 2004 12:55:08 -0000
@@ -474,7 +474,7 @@
* MPSAFE
*/
void
-__panic(const char *file, int line, const char *fmt, ...)
+panic(const char *fmt, ...)
{
struct thread *td = curthread;
int bootopt, newpanic;
@@ -508,11 +508,11 @@
if (newpanic) {
(void)vsnprintf(buf, sizeof(buf), fmt, ap);
panicstr = buf;
- printf("panic: %s\nat line %d in file %s\n", buf, line, file);
+ printf("panic: %s\n", buf);
} else {
printf("panic: ");
vprintf(fmt, ap);
- printf("\nat line %d in file %s", line, file);
+ printf("\n");
}
va_end(ap);
#ifdef SMP
Index: sparc64/include/asmacros.h
===================================================================
RCS file: /home/ncvs/src/sys/sparc64/include/asmacros.h,v
retrieving revision 1.18
diff -u -r1.18 asmacros.h
--- sparc64/include/asmacros.h 27 Jan 2004 15:02:18 -0000 1.18
+++ sparc64/include/asmacros.h 4 Jun 2004 12:55:08 -0000
@@ -101,10 +101,8 @@
.sect .rodata ; \
9: .asciz msg ; \
.previous ; \
- SET(9b, r1, %o2) ; \
- clr %o1 ; \
- clr %o0 ; \
- call __panic ; \
+ SET(9b, r1, %o0) ; \
+ call panic ; \
nop
#ifdef INVARIANTS
Index: sys/systm.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/systm.h,v
retrieving revision 1.205
diff -u -r1.205 systm.h
--- sys/systm.h 7 Apr 2004 04:19:49 -0000 1.205
+++ sys/systm.h 4 Jun 2004 12:55:08 -0000
@@ -132,13 +132,11 @@
void *phashinit(int count, struct malloc_type *type, u_long *nentries);
#ifdef RESTARTABLE_PANICS
-void __panic(const char *file, int line, const char *, ...) __printflike(3, 4);
+void panic(const char *, ...) __printflike(1, 2);
#else
-void __panic(const char *file, int line, const char *, ...) __dead2 __printflike(3, 4);
+void panic(const char *, ...) __dead2 __printflike(1, 2);
#endif
-#define panic(...) __panic(__FILE__, __LINE__, __VA_ARGS__)
-
void backtrace(void);
void cpu_boot(int);
void cpu_rootconf(void);
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-current
mailing list