lkml.org 
[lkml]   [2001]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] Re: 2.4.0-testX fails to compile on my Athlon
Petr Vandrovec wrote:
>
> Unfortunately, real diff is at home... And it has one bad side effect, that
> you must rerun 'make dep' manually if you modify task_struct in
> linux/sched.h, as asm/asm_offsets.h -> linux/sched.h dependancy is not
> handled by makefiles. But I do not do this modification very often,
> fortunately... Maybe if I placed check_asm somewhere else than where sparc
> tree has it...
>

So diff is not at home anymore... Maybe it should be polished more,
as #ifdef CHECK_ASM in smp.h is not nice (probably generating dummy asm_offsets.h
for check_asm pass), but after I looked at code generated by this patch and
by Tim's patch, I think that Tim's approach with moving in_interrupt() testing
out-of-line from asm/string.h is better.
Best regards,
Petr Vandrovec
vandrove@vc.cvut.cz

diff -urdN linux/arch/i386/Makefile linux/arch/i386/Makefile
--- linux/arch/i386/Makefile Fri Dec 29 22:07:19 2000
+++ linux/arch/i386/Makefile Wed Jan 3 10:07:10 2001
@@ -139,5 +139,8 @@

archmrproper:

-archdep:
+archdep: check_asm
@$(MAKEBOOT) dep
+
+check_asm:
+ $(MAKE) -C arch/i386/kernel check_asm
diff -urdN linux/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile
--- linux/arch/i386/kernel/Makefile Fri Dec 29 22:35:47 2000
+++ linux/arch/i386/kernel/Makefile Wed Jan 3 10:32:20 2001
@@ -7,6 +7,8 @@
#
# Note 2! The CFLAGS definitions are now in the main makefile...

+SH := $(CONFIG_SHELL)
+
.S.o:
$(CC) $(AFLAGS) -traditional -c $< -o $*.o

@@ -40,5 +42,95 @@
obj-$(CONFIG_X86_LOCAL_APIC) += apic.o
obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o
obj-$(CONFIG_X86_VISWS_APIC) += visws_apic.o
+
+check_asm: dummy
+ @if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \
+ touch $(HPATH)/asm/asm_offsets.h ; \
+ fi
+ @echo "/* Automatically generated. Do not edit. */" > asm_offsets.h
+ @echo "#ifndef __ASM_OFFSETS_H__" >> asm_offsets.h
+ @echo "#define __ASM_OFFSETS_H__" >> asm_offsets.h
+ @echo "" >> asm_offsets.h
+ @echo "#include <linux/config.h>" >> asm_offsets.h
+ @echo "" >> asm_offsets.h
+ @echo "#ifndef CONFIG_SMP" >> asm_offsets.h
+ @echo "" >> asm_offsets.h
+ @echo "#include <linux/config.h>" > tmp.c
+ @echo "#undef CONFIG_SMP" >> tmp.c
+ @echo "#include <linux/sched.h>" >> tmp.c
+ $(CPP) $(CPPFLAGS) tmp.c -o tmp.i
+ @echo "/* Automatically generated. Do not edit. */" > check_asm_data.c
+ @echo "#include <linux/config.h>" >> check_asm_data.c
+ @echo "#undef CONFIG_SMP" >> check_asm_data.c
+ @echo "#include <linux/sched.h>" >> check_asm_data.c
+ @echo "unsigned int check_asm_data[] = {" >> check_asm_data.c
+ $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c
+ $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c
+ $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c
+ @echo '};' >> check_asm_data.c
+ $(CC) $(CFLAGS) -DCHECK_ASM -S -o check_asm_data.s check_asm_data.c
+ @echo "/* Automatically generated. Do not edit. */" > check_asm.c
+ @echo 'extern int printf(const char *fmt, ...);' >>check_asm.c
+ @echo "unsigned int check_asm_data[] = {" >> check_asm.c
+ $(SH) ./check_asm.sh -ints check_asm_data.s check_asm.c
+ @echo "};" >> check_asm.c
+ @echo 'int main(void) {' >> check_asm.c
+ @echo 'int i = 0;' >> check_asm.c
+ $(SH) ./check_asm.sh -printf task tmp.i check_asm.c
+ $(SH) ./check_asm.sh -printf mm tmp.i check_asm.c
+ $(SH) ./check_asm.sh -printf thread tmp.i check_asm.c
+ @echo 'return 0; }' >> check_asm.c
+ @rm -f tmp.[ci] check_asm_data.[cs]
+ $(HOSTCC) -o check_asm check_asm.c
+ ./check_asm >> asm_offsets.h
+ @rm -f check_asm check_asm.c
+ @echo "" >> asm_offsets.h
+ @echo "#else /* CONFIG_SMP */" >> asm_offsets.h
+ @echo "" >> asm_offsets.h
+ @echo "#include <linux/config.h>" > tmp.c
+ @echo "#undef CONFIG_SMP" >> tmp.c
+ @echo "#define CONFIG_SMP 1" >> tmp.c
+ @echo "#include <linux/sched.h>" >> tmp.c
+ $(CPP) $(CPPFLAGS) tmp.c -o tmp.i
+ @echo "/* Automatically generated. Do not edit. */" > check_asm_data.c
+ @echo "#include <linux/config.h>" >> check_asm_data.c
+ @echo "#undef CONFIG_SMP" >> check_asm_data.c
+ @echo "#define CONFIG_SMP 1" >> check_asm_data.c
+ @echo "#include <linux/sched.h>" >> check_asm_data.c
+ @echo "unsigned int check_asm_data[] = {" >> check_asm_data.c
+ $(SH) ./check_asm.sh -data task tmp.i check_asm_data.c
+ $(SH) ./check_asm.sh -data mm tmp.i check_asm_data.c
+ $(SH) ./check_asm.sh -data thread tmp.i check_asm_data.c
+ @echo '};' >> check_asm_data.c
+ $(CC) $(CFLAGS) -DCHECK_ASM -S -o check_asm_data.s check_asm_data.c
+ @echo "/* Automatically generated. Do not edit. */" > check_asm.c
+ @echo 'extern int printf(const char *fmt, ...);' >>check_asm.c
+ @echo "unsigned int check_asm_data[] = {" >> check_asm.c
+ $(SH) ./check_asm.sh -ints check_asm_data.s check_asm.c
+ @echo "};" >> check_asm.c
+ @echo 'int main(void) {' >> check_asm.c
+ @echo 'int i = 0;' >> check_asm.c
+ $(SH) ./check_asm.sh -printf task tmp.i check_asm.c
+ $(SH) ./check_asm.sh -printf mm tmp.i check_asm.c
+ $(SH) ./check_asm.sh -printf thread tmp.i check_asm.c
+ @echo 'return 0; }' >> check_asm.c
+ @rm -f tmp.[ci] check_asm_data.[cs]
+ $(HOSTCC) -o check_asm check_asm.c
+ ./check_asm >> asm_offsets.h
+ @rm -f check_asm check_asm.c
+ @echo "" >> asm_offsets.h
+ @echo "#endif /* CONFIG_SMP */" >> asm_offsets.h
+ @echo "" >> asm_offsets.h
+ @echo "#endif /* __ASM_OFFSETS_H__ */" >> asm_offsets.h
+ @if test -r $(HPATH)/asm/asm_offsets.h; then \
+ if cmp -s asm_offsets.h $(HPATH)/asm/asm_offsets.h; then \
+ echo $(HPATH)/asm/asm_offsets.h is unchanged; \
+ rm -f asm_offsets.h; \
+ else \
+ mv -f asm_offsets.h $(HPATH)/asm/asm_offsets.h; \
+ fi; \
+ else \
+ mv -f asm_offsets.h $(HPATH)/asm/asm_offsets.h; \
+ fi

include $(TOPDIR)/Rules.make
diff -urdN linux/arch/i386/kernel/check_asm.sh linux/arch/i386/kernel/check_asm.sh
--- linux/arch/i386/kernel/check_asm.sh Thu Jan 1 00:00:00 1970
+++ linux/arch/i386/kernel/check_asm.sh Wed Jan 3 10:07:10 2001
@@ -0,0 +1,20 @@
+#!/bin/sh
+case $1 in
+ -printf)
+ sed -n -e '/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/\(unsigned\|signed\|struct\|union\)[ ]*//;s/\(\[\|__attribute__\).*;[ ]*$//;s/(\*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/\
+/g' | sed 's/^[ *]*//;s/[ ]*$//;s/^.*$/printf ("#define AOFF_'$2'_\0 0x%08x\\n", check_asm_data[i++]); printf("#define ASIZ_'$2'_\0 0x%08x\\n", check_asm_data[i++]);/' >> $4
+ echo "printf (\"#define ASIZ_$2\\t0x%08x\\n\", check_asm_data[i++]);" >> $4
+ ;;
+ -data)
+ sed -n -e '/struct[ ]*'$2'_struct[ ]*{/,/};/p' < $3 | sed '/struct[ ]*'$2'_struct[ ]*{/d;/:[0-9]*[ ]*;/d;/^[ ]*$/d;/};/d;s/^[ ]*//;s/volatile[ ]*//;s/\(unsigned\|signed\|struct\|union\)[ ]*//;s/\(\[\|__attribute__\).*;[ ]*$//;s/(\*//;s/)(.*)//;s/;[ ]*$//;s/^[^ ]*[ ]*//;s/,/\
+/g' | sed 's/^[ *]*//;s/[ ]*$//;s/^.*$/ ((char *)\&((struct '$2'_struct *)0)->\0) - ((char *)((struct '$2'_struct *)0)), sizeof(((struct '$2'_struct *)0)->\0),/' >> $4
+ echo " sizeof(struct $2_struct)," >> $4
+ ;;
+ -ints)
+ sed -n -e '/check_asm_data:/,/\.size/p' <$2 | sed -e 's/check_asm_data://' -e 's/\.size.*//' -e 's/\.long[ ]\([0-9]*\)/\1,/' >>$3
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+exit 0
diff -urdN linux/include/asm-i386/smp.h linux/include/asm-i386/smp.h
--- linux/include/asm-i386/smp.h Sun Dec 31 19:10:16 2000
+++ linux/include/asm-i386/smp.h Wed Jan 3 10:47:53 2001
@@ -25,6 +25,9 @@
#ifdef CONFIG_SMP
#ifndef ASSEMBLY

+#include <asm/current.h>
+#include <asm/asm_offsets.h>
+
/*
* Private routines/data
*/
@@ -75,7 +78,15 @@
* so this is correct in the x86 case.
*/

-#define smp_processor_id() (current->processor)
+/*
+ * During first check_asm pass no AOFF/ASIZ is defined. As no code is generated by
+ * check_asm pass, we can use just arbitrary value. Needed for 3DNow!(tm) copy.
+ */
+#ifdef CHECK_ASM
+#define smp_processor_id() 0
+#else
+#define smp_processor_id() (*(int*)(((unsigned char*)current) + AOFF_task_processor))
+#endif

extern __inline int hard_smp_processor_id(void)
{
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:52    [W:0.055 / U:13.264 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site