Skip to contentSkip to conversation

trivial: fix up check_asm

2.5 sparc32 Tomas Szepe 2 participants 2 messages Oct 17, 2002 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

The attached patch fixes up sparc32's lunatic check_asm in 2.5:

T.

arch/sparc/kernel/Makefile +3 -3
diff -urN linux-2.5.43/arch/sparc/kernel/Makefile linux-2.5.43.1/arch/sparc/kernel/Makefile
@@ -29,7 +29,7 @@
 
 include $(TOPDIR)/Rules.make
 
-HPATH := $(objtree)/include
+HPATH := $(TOPDIR)/include
 
 check_asm: FORCE
 	@if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \
@@ -46,7 +46,7 @@
 	@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
+	$(CC) $(CFLAGS) -E 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
@@ -79,7 +79,7 @@
 	@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
+	$(CC) $(CFLAGS) -E 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
#1 lore raw

Peter Zaitcev just sent me a patch which handles this differently:

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet 1.793 -> 1.794
# arch/sparc/kernel/wuf.S 1.2 -> 1.3
# arch/sparc/Makefile 1.12 -> 1.13
# arch/sparc/kernel/Makefile 1.9 -> 1.10
# arch/sparc/kernel/rtrap.S 1.7 -> 1.8
# arch/sparc/kernel/entry.S 1.6 -> 1.7
# arch/sparc/kernel/wof.S 1.2 -> 1.3
# arch/sparc/kernel/check_asm.sh 1.4 -> (deleted)
# arch/sparc/kernel/sclow.S 1.2 -> 1.3
# include/asm-sparc/ptrace.h 1.1 -> 1.2
# arch/sparc/kernel/etrap.S 1.2 -> 1.3
# (new) -> 1.1 arch/sparc/kernel/asm-offsets.c
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/10/17 [email protected] 1.794
# [sparc] Use Kai's way to make asm_offsets.h
# --------------------------------------------
#

arch/sparc/Makefile +12 -4
diff -Nru a/arch/sparc/Makefile b/arch/sparc/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.49 2001/07/27 09:42:22 davem Exp $
+#
 # sparc/Makefile
 #
 # Makefile for the architecture dependent flags and dependencies on the
@@ -47,16 +47,24 @@
 	$(MAKE) -C arch/sparc/boot image
 
 archclean:
+	rm -f arch/sparc/kernel/include
 	rm -f $(TOPDIR)/vmlinux.aout
 	-$(MAKE) -C arch/sparc/boot clean
 
 archmrproper:
 	rm -f $(TOPDIR)/include/asm-sparc/asm_offsets.h
 
-prepare: check_asm
+prepare: include/asm-$(ARCH)/asm_offsets.h
+
+arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
+				   include/config/MARKER
+
+include/asm-$(ARCH)/asm_offsets.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
+	@$(generate-asm-offsets.h) < $< > $@
 
-check_asm: include/linux/version.h include/asm include/config/MARKER
-	$(MAKE) -C arch/sparc/kernel check_asm
+include/asm-$(ARCH)/asm_offsets.h: include/asm-$(ARCH)/asm_offsets.h.tmp
+	@echo -n '  Generating $@'
+	@$(update-if-changed)
 
 tftpboot.img:
 	$(MAKE) -C arch/sparc/boot tftpboot.img
arch/sparc/kernel/Makefile +0 -92

95 lines not on this page · raw message

arch/sparc/kernel/asm-offsets.c new file +53 -0

53 lines not on this page · raw message

arch/sparc/kernel/check_asm.sh deleted +0 -19
diff -Nru a/arch/sparc/kernel/check_asm.sh b/arch/sparc/kernel/check_asm.sh
@@ -1,19 +0,0 @@
-#!/bin/sh
-case $1 in
-  -printf)
-    sed -n -e '/^#/d;/struct[ 	]*'$2'_struct[ 	]*{/,/};/p' < $3 | sed '/struct[ 	]*'$2'_struct[ 	]*{/d;/:[0-9]*[ 	]*;/d;/^[ 	]*$/d;/};/d;s/^[ 	]*//;s/volatile[ 	]*//;s/\(unsigned\|signed\|struct\)[ 	]*//;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 '/^#/d;/struct[ 	]*'$2'_struct[ 	]*{/,/};/p' < $3 | sed '/struct[ 	]*'$2'_struct[ 	]*{/d;/:[0-9]*[ 	]*;/d;/^[ 	]*$/d;/};/d;s/^[ 	]*//;s/volatile[ 	]*//;s/\(unsigned\|signed\|struct\)[ 	]*//;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/\.ident.*//' -e 's/\.global.*//' -e 's/\.long[ 	]\([0-9]*\)/\1,/' >>$3  ;;
-  *)
-    exit 1
-  ;;
-esac
-exit 0
arch/sparc/kernel/entry.S +1 -0
diff -Nru a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
@@ -17,6 +17,7 @@
 #include <asm/kgdb.h>
 #include <asm/contregs.h>
 #include <asm/ptrace.h>
+#include <asm/asm_offsets.h>
 #include <asm/psr.h>
 #include <asm/cprefix.h>
 #include <asm/vaddrs.h>
arch/sparc/kernel/etrap.S +1 -0
diff -Nru a/arch/sparc/kernel/etrap.S b/arch/sparc/kernel/etrap.S
@@ -12,6 +12,7 @@
 #include <asm/page.h>
 #include <asm/psr.h>
 #include <asm/ptrace.h>
+#include <asm/asm_offsets.h>
 #include <asm/winmacro.h>
 #include <asm/asmmacro.h>
 #include <asm/thread_info.h>
arch/sparc/kernel/rtrap.S +1 -0
diff -Nru a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S
@@ -7,6 +7,7 @@
 #include <asm/cprefix.h>
 #include <asm/page.h>
 #include <asm/ptrace.h>
+#include <asm/asm_offsets.h>
 #include <asm/psr.h>
 #include <asm/asi.h>
 #include <asm/smp.h>
arch/sparc/kernel/sclow.S +0 -12
diff -Nru a/arch/sparc/kernel/sclow.S b/arch/sparc/kernel/sclow.S
@@ -36,18 +36,6 @@
 LABEL(sunosnop):
 	CC_AND_RETT
 
-#if 0
-/* Not SMP safe */
-	.globl	LABEL(sunosgetpid)
-LABEL(sunosgetpid):
-	LOAD_CURRENT(l4, l5)
-	ld	[%l4 + TI_TASK], %l4
-	ld	[%l4 + AOFF_task_pid], %i0
-	ld	[%l4 + AOFF_task_p_opptr], %l5
-	ld	[%l5 + AOFF_task_pid], %i1
-	CC_AND_RETT
-#endif
-
 #if (ASIZ_task_uid == 2 && ASIZ_task_euid == 2)
 	.globl	LABEL(sunosgetuid)
 LABEL(sunosgetuid):
arch/sparc/kernel/wof.S +1 -0
diff -Nru a/arch/sparc/kernel/wof.S b/arch/sparc/kernel/wof.S
@@ -8,6 +8,7 @@
 #include <asm/contregs.h>
 #include <asm/page.h>
 #include <asm/ptrace.h>
+#include <asm/asm_offsets.h>
 #include <asm/psr.h>
 #include <asm/smp.h>
 #include <asm/asi.h>
arch/sparc/kernel/wuf.S +1 -0
diff -Nru a/arch/sparc/kernel/wuf.S b/arch/sparc/kernel/wuf.S
@@ -8,6 +8,7 @@
 #include <asm/contregs.h>
 #include <asm/page.h>
 #include <asm/ptrace.h>
+#include <asm/asm_offsets.h>
 #include <asm/psr.h>
 #include <asm/smp.h>
 #include <asm/asi.h>
include/asm-sparc/ptrace.h +6 -1
diff -Nru a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h
@@ -73,7 +73,12 @@
 #define REGWIN_SZ         0x40
 #endif
 
-#include <asm/asm_offsets.h>
+/*
+ * The asm_offsets.h is a generated file, so we cannot include it.
+ * It may be OK for glibc headers, but it's utterly pointless for C code.
+ * The assembly code using those offsets has to include it explicitly.
+ */
+/* #include <asm/asm_offsets.h> */
 
 /* These are for pt_regs. */
 #define PT_PSR    0x0