Date: Tue, 6 Dec 2005 14:41:35 +0100 From: Marius Strobl <marius@alchemy.franken.de> To: Ruslan Ermilov <ru@FreeBSD.org> Cc: sparc64@FreeBSD.org Subject: Re: [PATCH] Re: sparc64/sparc64/exception.S Message-ID: <20051206144128.J75892@newtrinity.zeist.de> In-Reply-To: <20051206114249.GA62078@ip.net.ua>; from ru@FreeBSD.org on Tue, Dec 06, 2005 at 01:42:49PM %2B0200 References: <20051205212539.GF76163@ip.net.ua> <20051206114249.GA62078@ip.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Dec 06, 2005 at 01:42:49PM +0200, Ruslan Ermilov wrote: > Hi again, > > On Mon, Dec 05, 2005 at 11:25:39PM +0200, Ruslan Ermilov wrote: > > Hi Marius, > > > > Playing with -Wundef reveals the following bug in exceptions.S: > > > > /usr/src/sys/sparc64/sparc64/exception.S:175:5: "KTR_COMPILE" is not defined > > /usr/src/sys/sparc64/sparc64/exception.S:193:5: "KTR_COMPILE" is not defined > > /usr/src/sys/sparc64/sparc64/exception.S:353:5: "KTR_COMPILE" is not defined > > ... > > > > But including <sys/ktr.h> while fixing this also breaks the build > > as there are some KRT_* symbols get defined in assym.s. Can you > > please look into properly fixing this? > > > OK, I found the attached working. Basically, it removes KTR stuff > out from assym.s (genassym.c) and into the files that need it. > But since it affects low-level .S files (the KTR_COMPILE macro is > now defined, and adds some code), I won't risk commiting it myself > (my sparc64 was re-donated to another guy in Ukraine). Please give > it a try, and commit it if it's OK from your perspective. > <...> > Index: sparc64/sparc64/genassym.c > =================================================================== > RCS file: /home/ncvs/src/sys/sparc64/sparc64/genassym.c,v > retrieving revision 1.58 > diff -u -p -r1.58 genassym.c > --- sparc64/sparc64/genassym.c 30 Nov 2005 16:09:10 -0000 1.58 > +++ sparc64/sparc64/genassym.c 6 Dec 2005 11:30:13 -0000 <...> > -ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); > -ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); > -ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file)); > -ASSYM(KTR_DESC, offsetof(struct ktr_entry, ktr_desc)); > -ASSYM(KTR_CPU, offsetof(struct ktr_entry, ktr_cpu)); > -ASSYM(KTR_TIMESTAMP, offsetof(struct ktr_entry, ktr_timestamp)); > -ASSYM(KTR_PARM1, offsetof(struct ktr_entry, ktr_parms[0])); > -ASSYM(KTR_PARM2, offsetof(struct ktr_entry, ktr_parms[1])); > -ASSYM(KTR_PARM3, offsetof(struct ktr_entry, ktr_parms[2])); > -ASSYM(KTR_PARM4, offsetof(struct ktr_entry, ktr_parms[3])); > -ASSYM(KTR_PARM5, offsetof(struct ktr_entry, ktr_parms[4])); > -ASSYM(KTR_PARM6, offsetof(struct ktr_entry, ktr_parms[5])); > - Well, this hardly can work if the KTR macro is defined as these offsets are required for the asm implementation of ktr(4) (see sys/sparc64/include/ktr.h) and we don't get them via <sys/ktr.h>. Actually it already bails out when trying to use <sys/ktr.h> with as(1) when KTR is defined: cc -c -x assembler-with-cpp -DLOCORE -O -pipe -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -fformat-extensions -std=c99 -g -nostdinc -I- -I. -I../../.. -I../../../contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=15000 --param inline-unit-growth=100 --param large-function-growth=1000 -mcmodel=medlow -msoft-float -ffreestanding -Werror ../../../sparc64/sparc64/exception.S ../../../sys/ktr.h: Assembler messages: ../../../sys/ktr.h:127: Error: Unknown opcode: `void' ../../../sys/ktr.h:128: Error: Unknown opcode: `const' ../../../sys/ktr.h:129: Fatal error: Unknown opcode: `u_long arg4,u_long arg5,u_long arg6)' One probably could get away with leaving the KTR_* offset macros in genassym.c and just removing those exporting KTR_CT* etc. from <sys/ktr.h> and extending the scope of #ifndef LOCORE in <sys/ktr.h> so it can be included in asm source. However, the problem of exporting the latter set of KTR_* macros to the asm version of ktr(4) isn't new so I'd just go for adding KTR_COMPILE to genassym.c as suggested before. If you really want to go the route of directly using <sys/ktr.h> in asm source something like the patch below probably is what you want to do (does technically the right thing, not sure about style). Marius Index: sys/ktr.h =================================================================== RCS file: /mnt/futile/usr/data/bsd/cvs/fbsd/src/sys/sys/ktr.h,v retrieving revision 1.33 diff -u -r1.33 ktr.h --- sys/ktr.h 2 Sep 2005 19:34:13 -0000 1.33 +++ sys/ktr.h 6 Dec 2005 12:53:52 -0000 @@ -86,9 +86,14 @@ #define KTR_CT8 0x80000000 /* Trace classes to compile in */ +#ifdef KTR #ifndef KTR_COMPILE #define KTR_COMPILE (KTR_ALL) #endif +#else /* KTR */ +#undef KTR_COMPILE +#define KTR_COMPILE 0 +#endif /* KTR */ /* Trace classes that can not be used with KTR_ALQ */ #define KTR_ALQ_MASK (KTR_WITNESS) @@ -121,7 +126,6 @@ extern volatile int ktr_idx; extern struct ktr_entry ktr_buf[]; -#endif /* !LOCORE */ #ifdef KTR void ktr_tracepoint(u_int mask, const char *file, int line, @@ -141,8 +145,6 @@ #define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0) #define CTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, p2, p3, p4, p5, 0) #else /* KTR */ -#undef KTR_COMPILE -#define KTR_COMPILE 0 #define CTR0(m, d) #define CTR1(m, d, p1) #define CTR2(m, d, p1, p2) @@ -184,4 +186,6 @@ #define ITR6(d, p1, p2, p3, p4, p5, p6) #endif +#endif /* !LOCORE */ + #endif /* !_SYS_KTR_H_ */ Index: sparc64/include/ktr.h =================================================================== RCS file: /mnt/futile/usr/data/bsd/cvs/fbsd/src/sys/sparc64/include/ktr.h,v retrieving revision 1.5 diff -u -r1.5 ktr.h --- sparc64/include/ktr.h 26 Apr 2003 17:00:10 -0000 1.5 +++ sparc64/include/ktr.h 6 Dec 2005 12:49:36 -0000 @@ -32,6 +32,8 @@ #ifndef _MACHINE_KTR_H_ #define _MACHINE_KTR_H_ +#include <sys/ktr.h> + #include <machine/upa.h> #ifndef LOCORE Index: sparc64/sparc64/genassym.c =================================================================== RCS file: /mnt/futile/usr/data/bsd/cvs/fbsd/src/sys/sparc64/sparc64/genassym.c,v retrieving revision 1.58 diff -u -r1.58 genassym.c --- sparc64/sparc64/genassym.c 30 Nov 2005 16:09:10 -0000 1.58 +++ sparc64/sparc64/genassym.c 6 Dec 2005 12:48:26 -0000 @@ -138,20 +138,6 @@ ASSYM(ICA_PA, offsetof(struct ipi_cache_args, ica_pa)); -ASSYM(KTR_PROC, KTR_PROC); -ASSYM(KTR_TRAP, KTR_TRAP); -ASSYM(KTR_SMP, KTR_SMP); -ASSYM(KTR_SYSC, KTR_SYSC); -ASSYM(KTR_INTR, KTR_INTR); -ASSYM(KTR_CT1, KTR_CT1); -ASSYM(KTR_CT2, KTR_CT2); -ASSYM(KTR_CT3, KTR_CT3); -ASSYM(KTR_CT4, KTR_CT4); -ASSYM(KTR_CT5, KTR_CT5); -ASSYM(KTR_CT6, KTR_CT6); -ASSYM(KTR_CT7, KTR_CT7); -ASSYM(KTR_CT8, KTR_CT8); - ASSYM(KTR_SIZEOF, sizeof(struct ktr_entry)); ASSYM(KTR_LINE, offsetof(struct ktr_entry, ktr_line)); ASSYM(KTR_FILE, offsetof(struct ktr_entry, ktr_file)); -- This mail was scanned by AntiVir Milter. This product is licensed for non-commercial use. See www.antivir.de for details.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051206144128.J75892>