Commit 8ee3dbaa authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Add support for alpha asm offset generation

Now we have three archs and three different prefixes in front of
numbers: #,$,none. We'll see what the others bring...
parent febe1b02
......@@ -447,7 +447,7 @@ define generate-asm-offsets.h
echo " *"; \
echo " */"; \
echo ""; \
sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
echo ""; \
echo "#endif" )
endef
......
......@@ -128,8 +128,6 @@ archmrproper:
rm -f include/asm-alpha/asm_offsets.h
archdep:
$(MAKE) -C arch/alpha/kernel asm_offsets
@$(MAKEBOOT) dep
vmlinux: arch/alpha/vmlinux.lds
......@@ -138,3 +136,19 @@ arch/alpha/vmlinux.lds: arch/alpha/vmlinux.lds.in
bootpfile:
@$(MAKEBOOT) bootpfile
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) < $< > $@
include/asm-$(ARCH)/asm_offsets.h: include/asm-$(ARCH)/asm_offsets.h.tmp
@echo -n ' Generating $@'
@$(update-if-changed)
CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
include/asm-$(ARCH)/offset.h
......@@ -96,6 +96,4 @@ clean:
rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph
rm -f vmlinux.nh ksize.h
dep:
FORCE:
......@@ -94,17 +94,3 @@ endif
endif # GENERIC
include $(TOPDIR)/Rules.make
ASM_OFFSETS_H = $(TOPDIR)/include/asm-alpha/asm_offsets.h
asm_offsets:
$(CC) $(CFLAGS) -S -o - check_asm.c | \
sed -e '/xyzzy/ { s/xyzzy //; p; }; d;' > asm_offsets.tmp
@if cmp -s asm_offsets.tmp $(ASM_OFFSETS_H); then \
set -x; rm asm_offsets.tmp; \
else \
set -x; mv asm_offsets.tmp $(ASM_OFFSETS_H); \
fi
clean::
rm -f check_asm
/*
* Generate definitions needed by assembly language modules.
* This code generates raw asm output which is post-processed to extract
* and format the required data.
*/
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <asm/io.h>
#define DEFINE(sym, val) \
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
#define BLANK() asm volatile("\n->" : : )
void foo(void)
{
DEFINE(TI_TASK, offsetof(struct thread_info, task));
DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
BLANK();
DEFINE(PT_PTRACED, PT_PTRACED);
DEFINE(CLONE_VM, CLONE_VM);
DEFINE(SIGCHLD, SIGCHLD);
BLANK();
DEFINE(HAE_CACHE, offsetof(struct alpha_machine_vector, hae_cache));
DEFINE(HAE_REG, offsetof(struct alpha_machine_vector, hae_register));
}
#include <linux/types.h>
#include <linux/stddef.h>
#include <linux/sched.h>
#include <asm/io.h>
#define OUT(x) \
asm ("\nxyzzy " x)
#define DEF(name, val) \
asm volatile ("\nxyzzy #define " name " %0" : : "i"(val))
void foo(void)
{
OUT("#ifndef __ASM_OFFSETS_H__");
OUT("#define __ASM_OFFSETS_H__");
OUT("");
DEF("TI_TASK", offsetof(struct thread_info, task));
DEF("TI_FLAGS", offsetof(struct thread_info, flags));
DEF("TI_CPU", offsetof(struct thread_info, cpu));
DEF("PT_PTRACED", PT_PTRACED);
DEF("CLONE_VM", CLONE_VM);
DEF("SIGCHLD", SIGCHLD);
DEF("HAE_CACHE", offsetof(struct alpha_machine_vector, hae_cache));
DEF("HAE_REG", offsetof(struct alpha_machine_vector, hae_register));
OUT("");
OUT("#endif /* __ASM_OFFSETS_H__ */");
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment