mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Verych <olecom@flower.upol.cz>
To: Sam Ravnborg <sam@ravnborg.org>, Rusty Russell <rusty@rustcorp.com.au>
Cc: LKML <linux-kernel@vger.kernel.org>, kbuild-devel@lists.sourceforge.net
Subject: [patch 01/03] kbuild, asm-values: infrastructure
Date: Wed, 13 Jun 2007 01:36:51 +0200	[thread overview]
Message-ID: <20070612234558.648949000@flower.upol.cz> (raw)
In-Reply-To: <20070612233650.486224000@flower.upol.cz>

[-- Attachment #1: kbuild-asm-values-infrastructure.patch --]
[-- Type: text/plain, Size: 3954 bytes --]

	* header with widely used value definitions
	* handle all asm-related things in one file (Makefile.asm)
	* move some asm bits from Makefile.build there
	  (rule %.s:%.c)
	* add script to generate headers from assembles output
	  (hopefully better output, MIPS testing/joining to all arch
	   probably needed)

rfc-by: Oleg Verych
---
 See next patches, to know how to use it

 include/asm-generic/asm-values.h |    7 ++++
 scripts/Makefile.asm             |   26 ++++++++++++++++++
 scripts/Makefile.build           |    6 ----
 scripts/mkasm-values.sh          |   55 +++++++++++++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 6 deletions(-)

Index: linux-2.6.22-rc4-mm2/scripts/Makefile.asm
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.22-rc4-mm2/scripts/Makefile.asm	2007-06-12 23:43:41.070624500 +0200
@@ -0,0 +1,26 @@
+#
+# Help generate definitions needed by assembly language modules.
+#
+ifndef asm-values_h
+    asm-values := $(shell test -e $(srctree)/$(src)/asm-values.c && echo ok)
+    ifneq ($(asm-values),)
+	asm-values_h := asm-values.h
+	asm-values   := asm-values.s
+    endif
+endif
+
+always		+= $(asm-values_h)
+targets		+= $(asm-values_h) $(asm-values)
+mkasm-values	:= $(srctree)/scripts/mkasm-values.sh
+
+quiet_cmd_mkasm-values = GEN     $@
+      cmd_mkasm-values = $(CONFIG_SHELL) $(mkasm-values) $< $@ $(2)
+
+quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@
+      cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
+
+$(obj)/asm-values.h: $(obj)/asm-values.s
+	$(call cmd,mkasm-values,$(ASM_NS))
+
+$(obj)/%.s: $(src)/%.c FORCE
+	$(call if_changed_dep,cc_s_c)
Index: linux-2.6.22-rc4-mm2/scripts/Makefile.build
===================================================================
--- linux-2.6.22-rc4-mm2.orig/scripts/Makefile.build	2007-06-13 00:45:54.195930250 +0200
+++ linux-2.6.22-rc4-mm2/scripts/Makefile.build	2007-06-12 22:10:31.481297000 +0200
@@ -145,10 +145,4 @@ $(multi-objs-y:.o=.s)   : modname = $(mo
 $(multi-objs-y:.o=.lst) : modname = $(modname-multi)
 
-quiet_cmd_cc_s_c = CC $(quiet_modtag)  $@
-cmd_cc_s_c       = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
-
-$(obj)/%.s: $(src)/%.c FORCE
-	$(call if_changed_dep,cc_s_c)
-
 quiet_cmd_cc_i_c = CPP $(quiet_modtag) $@
 cmd_cc_i_c       = $(CPP) $(c_flags)   -o $@ $<
Index: linux-2.6.22-rc4-mm2/scripts/mkasm-values.sh
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.22-rc4-mm2/scripts/mkasm-values.sh	2007-06-12 21:49:05.096903000 +0200
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# Input file "*.s", made by Kbuild from a "*.c" source, where values of
+# interest are calculated, is processed in a suitable output header file.
+#
+# $1 - input filename;
+# $2 - output filename;
+# $3 - generate (private) file with given namespace (optional)
+
+set -e
+
+[ -z "$1" ] || [ -z "$2" ] && {
+	echo "$0:
+
+Two parameters needed. Exiting.
+"
+	exit 1
+}
+
+NS=`echo $3 | tr a-z A-Z`
+case $NS in
+	MIPS)
+SED_SCRIPT='
+/^@@@/{
+s|^@@@||;
+s| #.*$||;
+p;
+}'	;;
+	*)
+TAB="`printf '\t'`"
+SED_SCRIPT="
+/^->/{
+s|^->||;
+s|^\([^ ]*\) [\$#]*\([^ ]*\) \([^$TAB]*\).*|#define \1 \2$TAB/* \3 */|;
+p;
+}"	;;
+esac
+
+NS=__ASM_VALUES_${NS:=H}__
+
+exec 1>$2
+echo "\
+#if !defined($NS)
+#define $NS
+
+/*
+ * $2
+ * was generated from
+ * $1
+ */
+"
+sed -ne "$SED_SCRIPT" $1
+
+echo "
+#endif"
Index: linux-2.6.22-rc4-mm2/include/asm-generic/asm-values.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.22-rc4-mm2/include/asm-generic/asm-values.h	2007-06-12 23:33:34.176696000 +0200
@@ -0,0 +1,7 @@
+#define DEFINE(sym, val) \
+	asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+#define OFFSET(sym, str, mem) \
+	DEFINE(sym, offsetof(struct str, mem));

--


  reply	other threads:[~2007-06-12 23:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-12 23:36 [patch 00/03] kbuild, asm-values: not only offsets, not only for $ARCH Oleg Verych
2007-06-12 23:36 ` Oleg Verych [this message]
2007-06-14  7:41   ` [patch 01/03] kbuild, asm-values: infrastructure Oleg Verych
2007-06-14  9:12     ` Sam Ravnborg
2007-06-14 11:16       ` Need opinions on asm-offsets cleanup (Re: [patch 01/03] kbuild, asm-values: infrastructure) Oleg Verych
2007-06-14 11:23         ` Sam Ravnborg
2007-09-16 18:29   ` [patch 01/03] kbuild, asm-values: infrastructure Sam Ravnborg
2007-09-16 19:32     ` Rename asm-offsets tool or not? (Re: [patch 01/03] kbuild, asm-values: infrastructure) Oleg Verych
2007-09-16 20:12       ` Sam Ravnborg
2007-06-12 23:36 ` [patch 02/03] kbuild, asm-values: successor of asm-offsets Oleg Verych
2007-06-13  8:55   ` Removing of dummy asm-offset files (Re: [patch 02/03] kbuild, asm-values: successor of asm-offsets) Oleg Verych
2007-06-12 23:36 ` [patch 03/03] kbuild, asm-values: private for lguest Oleg Verych

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070612234558.648949000@flower.upol.cz \
    --to=olecom@flower.upol.cz \
    --cc=kbuild-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®