Commit abffad5d authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.make

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 9dcbdb7e a95ca5a9
...@@ -145,7 +145,8 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) ...@@ -145,7 +145,8 @@ ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
.config: .config:
@echo '***' @echo '***'
@echo '*** You have not yet configured your kernel!' @echo '*** You have not yet configured your kernel!'
@echo '*** Please run "make xconfig/menuconfig/config/oldconfig"' @echo '*** Please run some configurator (do "make xconfig" or'
@echo '*** "make menuconfig" or "make oldconfig" or "make config").'
@echo '***' @echo '***'
@exit 1 @exit 1
...@@ -330,18 +331,16 @@ scripts: ...@@ -330,18 +331,16 @@ scripts:
# The targets are still named depend / dep for traditional # The targets are still named depend / dep for traditional
# reasons, but the only thing we do here is generating # reasons, but the only thing we do here is generating
# the module version checksums. # the module version checksums.
# FIXME: For now, we are also calling "archdep" from here,
# which should be replaced by a more sensible solution.
.PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS)) .PHONY: depend dep $(patsubst %,_sfdep_%,$(SUBDIRS))
depend dep: .hdepend depend dep: .hdepend
# .hdepend is our (misnomed) marker for whether we've run # .hdepend is our (misnomed) marker for whether we've run
# generated module versions and made archdep # generated module versions
.hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE) .hdepend: $(if $(filter dep depend,$(MAKECMDGOALS)),FORCE)
@$(MAKE) archdep include/linux/modversions.h @$(MAKE) include/linux/modversions.h
@touch $@ @touch $@
ifdef CONFIG_MODVERSIONS ifdef CONFIG_MODVERSIONS
...@@ -420,8 +419,8 @@ $(patsubst %, _modinst_%, $(SUBDIRS)) : ...@@ -420,8 +419,8 @@ $(patsubst %, _modinst_%, $(SUBDIRS)) :
else # CONFIG_MODULES else # CONFIG_MODULES
# ---------------------------------------------------------------------------
# Modules not configured # Modules not configured
# ---------------------------------------------------------------------------
modules modules_install: FORCE modules modules_install: FORCE
@echo @echo
...@@ -433,6 +432,25 @@ modules modules_install: FORCE ...@@ -433,6 +432,25 @@ modules modules_install: FORCE
endif # CONFIG_MODULES endif # CONFIG_MODULES
# Generate asm-offsets.h
# ---------------------------------------------------------------------------
define generate-asm-offsets.h
(set -e; \
echo "#ifndef __ASM_OFFSETS_H__"; \
echo "#define __ASM_OFFSETS_H__"; \
echo "/*"; \
echo " * DO NOT MODIFY."; \
echo " *"; \
echo " * This file was generated by arch/$(ARCH)/Makefile"; \
echo " *"; \
echo " */"; \
echo ""; \
sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
echo ""; \
echo "#endif" )
endef
# RPM target # RPM target
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -461,6 +479,8 @@ rpm: clean spec ...@@ -461,6 +479,8 @@ rpm: clean spec
else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),) else # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# Targets which don't need .config # Targets which don't need .config
# =========================================================================== # ===========================================================================
# #
...@@ -519,23 +539,6 @@ allmodconfig: ...@@ -519,23 +539,6 @@ allmodconfig:
defconfig: defconfig:
yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in yes '' | $(CONFIG_SHELL) scripts/Configure -d arch/$(ARCH)/config.in
# How we generate .config depends on which *config the
# user chose when calling make
.config: $(filter oldconfig xconfig menuconfig config,$(MAKECMDGOALS)) ;
# If the user gave commands from both the need / need not
# .config sections, we need to call make again after
# .config is generated, now to take care of the remaining
# targets we know nothing about in this section
remaining_targets := $(filter-out $(noconfig_targets),$(MAKECMDGOALS))
$(remaining_targets) : make_with_config
make_with_config: .config
@$(MAKE) $(remaining_targets)
# Cleaning up # Cleaning up
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -604,7 +607,8 @@ clean: archclean ...@@ -604,7 +607,8 @@ clean: archclean
mrproper: clean archmrproper mrproper: clean archmrproper
@echo 'Making mrproper' @echo 'Making mrproper'
@find . \( -size 0 -o -name .depend \) -type f -print | xargs rm -f @find . \( -size 0 -o -name .depend -o -name .\*.cmd \) \
-type f -print | xargs rm -f
@rm -f $(MRPROPER_FILES) @rm -f $(MRPROPER_FILES)
@rm -rf $(MRPROPER_DIRS) @rm -rf $(MRPROPER_DIRS)
@$(MAKE) -C Documentation/DocBook mrproper @$(MAKE) -C Documentation/DocBook mrproper
...@@ -639,8 +643,6 @@ sgmldocs psdocs pdfdocs htmldocs: ...@@ -639,8 +643,6 @@ sgmldocs psdocs pdfdocs htmldocs:
@$(MAKE) -C Documentation/DocBook $@ @$(MAKE) -C Documentation/DocBook $@
endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# Scripts to check various things for consistency # Scripts to check various things for consistency
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -653,6 +655,18 @@ checkhelp: ...@@ -653,6 +655,18 @@ checkhelp:
checkincludes: checkincludes:
find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl find * -name '*.[hcS]' -type f -print | sort | xargs $(PERL) -w scripts/checkincludes.pl
else # ifneq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
# We're called with both targets which do and do not need
# .config included. Handle them one after the other.
# ===========================================================================
%:: FORCE
$(MAKE) $@
endif # ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
endif # ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
# FIXME Should go into a make.lib or something # FIXME Should go into a make.lib or something
# =========================================================================== # ===========================================================================
......
...@@ -131,9 +131,13 @@ else ...@@ -131,9 +131,13 @@ else
genksyms_smp_prefix := genksyms_smp_prefix :=
endif endif
$(MODVERDIR)/$(real-objs-y:.o=.ver): modkern_cflags := $(CFLAGS_KERNEL) # Don't include modversions.h, we're just about to generate it here.
$(MODVERDIR)/$(real-objs-m:.o=.ver): modkern_cflags := $(CFLAGS_MODULE)
$(MODVERDIR)/$(export-objs:.o=.ver): export_flags := -D__GENKSYMS__ CFLAGS_MODULE := $(filter-out -include $(HPATH)/linux/modversions.h,$(CFLAGS_MODULE))
$(addprefix $(MODVERDIR)/,$(real-objs-y:.o=.ver)): modkern_cflags := $(CFLAGS_KERNEL)
$(addprefix $(MODVERDIR)/,$(real-objs-m:.o=.ver)): modkern_cflags := $(CFLAGS_MODULE)
$(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)): export_flags := -D__GENKSYMS__
c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \ $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
...@@ -145,18 +149,34 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \ ...@@ -145,18 +149,34 @@ c_flags = -Wp,-MD,$(depfile) $(CFLAGS) $(NOSTDINC_FLAGS) \
# files changes # files changes
quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
define cmd_cc_ver_c cmd_cc_ver_c = $(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
mkdir -p $(dir $@); \ -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
$(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \ # Okay, let's explain what's happening in rule_make_cc_ver_c:
# o echo the command
# o execute the command
# o If the $(CPP) fails, we won't notice because it's output is piped
# to $(GENKSYMS) which does not fail. We recognize this case by
# looking if the generated $(depfile) exists, though.
# o If the .ver file changed, touch modversions.h, which is our maker
# of any changed .ver files.
# o Move command line and deps into their normal .*.cmd place.
define rule_cc_ver_c
$(if $($(quiet)cmd_cc_ver_c),echo ' $($(quiet)cmd_cc_ver_c)';) \
$(cmd_cc_ver_c); \
if [ ! -r $(depfile) ]; then exit 1; fi; \
$(TOPDIR)/scripts/fixdep $(depfile) $@ $(TOPDIR) '$(cmd_cc_ver_c)' > $(@D)/.$(@F).tmp; \
rm -f $(depfile); \
if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \ if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \
touch $(TOPDIR)/include/linux/modversions.h; \ touch $(TOPDIR)/include/linux/modversions.h; \
fi; \ fi; \
mv -f $@.tmp $@ mv -f $@.tmp $@
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
endef endef
$(MODVERDIR)/%.ver: %.c FORCE $(MODVERDIR)/%.ver: %.c FORCE
@$(call if_changed_dep,cc_ver_c) @$(call if_changed_rule,cc_ver_c)
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver)) targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
...@@ -446,7 +466,7 @@ if_changed = $(if $(strip $? \ ...@@ -446,7 +466,7 @@ if_changed = $(if $(strip $? \
# execute the command and also postprocess generated .d dependencies # execute the command and also postprocess generated .d dependencies
# file # file
if_changed_dep = $(if $(strip $? \ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\
$(filter-out $(cmd_$(1)),$(cmd_$@))\ $(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\ $(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \ @set -e; \
...@@ -456,6 +476,17 @@ if_changed_dep = $(if $(strip $? \ ...@@ -456,6 +476,17 @@ if_changed_dep = $(if $(strip $? \
rm -f $(depfile); \ rm -f $(depfile); \
mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
# Usage: $(call if_changed_rule,foo)
# will check if $(cmd_foo) changed, or any of the prequisites changed,
# and if so will execute $(rule_foo)
if_changed_rule = $(if $(strip $? \
$(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$@),$(cmd_$(1)))),\
@set -e; \
mkdir -p $(dir $@); \
$(rule_$(1)))
# If quiet is set, only print short version of command # If quiet is set, only print short version of command
cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) cmd = @$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1))
...@@ -127,10 +127,6 @@ archmrproper: ...@@ -127,10 +127,6 @@ archmrproper:
rm -f arch/alpha/vmlinux.lds rm -f arch/alpha/vmlinux.lds
rm -f include/asm-alpha/asm_offsets.h rm -f include/asm-alpha/asm_offsets.h
archdep:
$(MAKE) -C arch/alpha/kernel asm_offsets
@$(MAKEBOOT) dep
vmlinux: arch/alpha/vmlinux.lds vmlinux: arch/alpha/vmlinux.lds
arch/alpha/vmlinux.lds: arch/alpha/vmlinux.lds.in arch/alpha/vmlinux.lds: arch/alpha/vmlinux.lds.in
...@@ -138,3 +134,19 @@ arch/alpha/vmlinux.lds: arch/alpha/vmlinux.lds.in ...@@ -138,3 +134,19 @@ arch/alpha/vmlinux.lds: arch/alpha/vmlinux.lds.in
bootpfile: bootpfile:
@$(MAKEBOOT) 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: ...@@ -96,6 +96,4 @@ clean:
rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph rm -f tools/mkbb tools/bootlx tools/lxboot tools/bootph
rm -f vmlinux.nh ksize.h rm -f vmlinux.nh ksize.h
dep:
FORCE: FORCE:
...@@ -94,17 +94,3 @@ endif ...@@ -94,17 +94,3 @@ endif
endif # GENERIC endif # GENERIC
include $(TOPDIR)/Rules.make 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__ */");
}
...@@ -65,6 +65,4 @@ __divlu.o: $(ev6)divide.S ...@@ -65,6 +65,4 @@ __divlu.o: $(ev6)divide.S
__remlu.o: $(ev6)divide.S __remlu.o: $(ev6)divide.S
$(CC) $(AFLAGS) -DREM -DINTSIZE -c -o __remlu.o $(ev6)divide.S $(CC) $(AFLAGS) -DREM -DINTSIZE -c -o __remlu.o $(ev6)divide.S
dep:
include $(TOPDIR)/Rules.make include $(TOPDIR)/Rules.make
...@@ -195,29 +195,25 @@ endif ...@@ -195,29 +195,25 @@ endif
MAKEBOOT =$(MAKE) -C arch/$(ARCH)/boot MAKEBOOT =$(MAKE) -C arch/$(ARCH)/boot
MAKETOOLS =$(MAKE) -C arch/$(ARCH)/tools MAKETOOLS =$(MAKE) -C arch/$(ARCH)/tools
# The following is a hack to get 'constants.h' up
# to date before starting compilation
$(patsubst %,_dir_%, $(SUBDIRS)): maketools
$(patsubst %,_modsubdir_%,$(MOD_DIRS)): maketools
# Update machine arch and proc symlinks if something which affects # Update machine arch and proc symlinks if something which affects
# them changed. We use .arch and .proc to indicate when they were # them changed. We use .arch and .proc to indicate when they were
# updated last, otherwise make uses the target directory mtime. # updated last, otherwise make uses the target directory mtime.
include/asm-arm/.arch: $(wildcard include/config/arch/*.h) include/asm-arm/.arch: $(wildcard include/config/arch/*.h)
@echo 'Making asm-arm/arch -> asm-arm/arch-$(INCDIR) symlink' @echo ' Making asm-arm/arch -> asm-arm/arch-$(INCDIR) symlink'
@rm -f include/asm-arm/arch @rm -f include/asm-arm/arch
@ln -sf arch-$(INCDIR) include/asm-arm/arch @ln -sf arch-$(INCDIR) include/asm-arm/arch
@touch $@ @touch $@
include/asm-arm/.proc: $(wildcard include/config/cpu/32.h) $(wildcard include/config/cpu/26.h) include/asm-arm/.proc: $(wildcard include/config/cpu/32.h) $(wildcard include/config/cpu/26.h)
@echo 'Making asm-arm/proc -> asm-arm/proc-$(PROCESSOR) symlink' @echo ' Making asm-arm/proc -> asm-arm/proc-$(PROCESSOR) symlink'
@rm -f include/asm-arm/proc @rm -f include/asm-arm/proc
@ln -sf proc-$(PROCESSOR) include/asm-arm/proc @ln -sf proc-$(PROCESSOR) include/asm-arm/proc
@touch $@ @touch $@
.hdepend: include/asm-arm/.arch include/asm-arm/.proc prepare: include/asm-arm/.arch include/asm-arm/.proc \
include/asm-arm/constants.h
@$(MAKETOOLS)
vmlinux: arch/arm/vmlinux.lds vmlinux: arch/arm/vmlinux.lds
...@@ -234,7 +230,6 @@ CLEAN_FILES += \ ...@@ -234,7 +230,6 @@ CLEAN_FILES += \
arch/arm/vmlinux.lds arch/arm/vmlinux.lds
MRPROPER_FILES += \ MRPROPER_FILES += \
arch/arm/tools/constants.h* \
include/asm-arm/arch include/asm-arm/.arch \ include/asm-arm/arch include/asm-arm/.arch \
include/asm-arm/proc include/asm-arm/.proc \ include/asm-arm/proc include/asm-arm/.proc \
include/asm-arm/constants.h* \ include/asm-arm/constants.h* \
...@@ -247,13 +242,9 @@ archmrproper: FORCE ...@@ -247,13 +242,9 @@ archmrproper: FORCE
archclean: FORCE archclean: FORCE
@$(MAKEBOOT) clean @$(MAKEBOOT) clean
archdep: FORCE
@$(MAKETOOLS) dep
@$(MAKEBOOT) dep
# we need version.h # we need version.h
maketools: include/linux/version.h FORCE maketools: include/linux/version.h FORCE
@$(MAKETOOLS) all @$(MAKETOOLS)
# My testing targets (that short circuit a few dependencies) # My testing targets (that short circuit a few dependencies)
zImg:; @$(MAKEBOOT) zImage zImg:; @$(MAKEBOOT) zImage
...@@ -277,3 +268,13 @@ bp:; @$(MAKEBOOT) bootpImage ...@@ -277,3 +268,13 @@ bp:; @$(MAKEBOOT) bootpImage
echo "$$CFG does not exist"; \ echo "$$CFG does not exist"; \
fi; \ fi; \
) )
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER
include/asm-$(ARCH)/constants.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/constants.h: include/asm-$(ARCH)/constants.h.tmp
@echo -n ' Generating $@'
@$(update-if-changed)
...@@ -125,7 +125,7 @@ zImage: compressed/vmlinux ...@@ -125,7 +125,7 @@ zImage: compressed/vmlinux
bootpImage: bootp/bootp bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@ $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
compressed/vmlinux: $(TOPDIR)/vmlinux dep compressed/vmlinux: $(TOPDIR)/vmlinux
@$(MAKE) -C compressed vmlinux @$(MAKE) -C compressed vmlinux
bootp/bootp: zImage initrd bootp/bootp: zImage initrd
...@@ -145,5 +145,3 @@ clean: ...@@ -145,5 +145,3 @@ clean:
$(RM) Image zImage bootpImage $(RM) Image zImage bootpImage
@$(MAKE) -C compressed clean @$(MAKE) -C compressed clean
@$(MAKE) -C bootp clean @$(MAKE) -C bootp clean
dep:
/* /*
* linux/arch/arm/tools/getconsdata.c * Copyright (C) 1995-2001 Russell King
* * 2001-2002 Keith Owens
* Copyright (C) 1995-2001 Russell King *
* Generate definitions needed by assembly language modules.
* This code generates raw asm output which is post-processed to extract
* and format the required data.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/config.h> #include <linux/config.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/mm.h> #include <linux/mm.h>
...@@ -31,45 +35,48 @@ ...@@ -31,45 +35,48 @@
#warning GCC 2.95.2 and earlier miscompiles kernels. #warning GCC 2.95.2 and earlier miscompiles kernels.
#endif #endif
#define OFF_TSK(n) (unsigned long)&(((struct task_struct *)0)->n) /* Use marker if you need to separate the values later */
#define OFF_VMA(n) (unsigned long)&(((struct vm_area_struct *)0)->n)
#define DEFN(name,off) asm("\n#define "name" %0" :: "I" (off))
void func(void)
{
DEFN("TSK_USED_MATH", OFF_TSK(used_math));
DEFN("TSK_ACTIVE_MM", OFF_TSK(active_mm));
DEFN("VMA_VM_MM", OFF_VMA(vm_mm)); #define DEFINE(sym, val) \
DEFN("VMA_VM_FLAGS", OFF_VMA(vm_flags)); asm volatile("\n->" #sym " %0 " #val : : "i" (val))
DEFN("VM_EXEC", VM_EXEC); #define BLANK() asm volatile("\n->" : : )
int main(void)
{
DEFINE(TSK_USED_MATH, offsetof(struct task_struct, used_math));
DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
BLANK();
DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
DEFINE(VMA_VM_FLAGS, offsetof(struct vm_area_struct, vm_flags));
BLANK();
DEFINE(VM_EXEC, VM_EXEC);
BLANK();
#ifdef CONFIG_CPU_32 #ifdef CONFIG_CPU_32
DEFN("HPTE_TYPE_SMALL", PTE_TYPE_SMALL); DEFINE(HPTE_TYPE_SMALL, PTE_TYPE_SMALL);
DEFN("HPTE_AP_READ", PTE_AP_READ); DEFINE(HPTE_AP_READ, PTE_AP_READ);
DEFN("HPTE_AP_WRITE", PTE_AP_WRITE); DEFINE(HPTE_AP_WRITE, PTE_AP_WRITE);
BLANK();
DEFN("LPTE_PRESENT", L_PTE_PRESENT); DEFINE(LPTE_PRESENT, L_PTE_PRESENT);
DEFN("LPTE_YOUNG", L_PTE_YOUNG); DEFINE(LPTE_YOUNG, L_PTE_YOUNG);
DEFN("LPTE_BUFFERABLE", L_PTE_BUFFERABLE); DEFINE(LPTE_BUFFERABLE, L_PTE_BUFFERABLE);
DEFN("LPTE_CACHEABLE", L_PTE_CACHEABLE); DEFINE(LPTE_CACHEABLE, L_PTE_CACHEABLE);
DEFN("LPTE_USER", L_PTE_USER); DEFINE(LPTE_USER, L_PTE_USER);
DEFN("LPTE_WRITE", L_PTE_WRITE); DEFINE(LPTE_WRITE, L_PTE_WRITE);
DEFN("LPTE_EXEC", L_PTE_EXEC); DEFINE(LPTE_EXEC, L_PTE_EXEC);
DEFN("LPTE_DIRTY", L_PTE_DIRTY); DEFINE(LPTE_DIRTY, L_PTE_DIRTY);
#endif #endif
BLANK();
#ifdef CONFIG_CPU_26 #ifdef CONFIG_CPU_26
DEFN("PAGE_PRESENT", _PAGE_PRESENT); DEFINE(PAGE_PRESENT, _PAGE_PRESENT);
DEFN("PAGE_READONLY", _PAGE_READONLY); DEFINE(PAGE_READONLY, _PAGE_READONLY);
DEFN("PAGE_NOT_USER", _PAGE_NOT_USER); DEFINE(PAGE_NOT_USER, _PAGE_NOT_USER);
DEFN("PAGE_OLD", _PAGE_OLD); DEFINE(PAGE_OLD, _PAGE_OLD);
DEFN("PAGE_CLEAN", _PAGE_CLEAN); DEFINE(PAGE_CLEAN, _PAGE_CLEAN);
#endif #endif
BLANK();
DEFN("PAGE_SZ", PAGE_SIZE); DEFINE(PAGE_SZ, PAGE_SIZE);
BLANK();
DEFN("SYS_ERROR0", 0x9f0000); DEFINE(SYS_ERROR0, 0x9f0000);
return 0;
} }
...@@ -4,40 +4,9 @@ ...@@ -4,40 +4,9 @@
# Copyright (C) 2001 Russell King # Copyright (C) 2001 Russell King
# #
all: $(TOPDIR)/include/asm-arm/mach-types.h \ all: $(TOPDIR)/include/asm-arm/mach-types.h
$(TOPDIR)/include/asm-arm/constants.h
$(TOPDIR)/include/asm-arm/mach-types.h: mach-types gen-mach-types $(TOPDIR)/include/asm-arm/mach-types.h: mach-types gen-mach-types
awk -f gen-mach-types mach-types > $@ awk -f gen-mach-types mach-types > $@
# Generate the constants.h header file using the compiler. We get .PHONY: all
# the compiler to spit out assembly code, and then mundge it into
# what we want. We do this in several stages so make picks up on
# any errors that occur along the way.
constants.h: constants-hdr getconstants.c
$(CC) $(CFLAGS) -S -o $@.tmp.1 getconstants.c
sed 's/^\(#define .* \)[#$$]\(.*\)/\1\2/;/^#define/!d' $@.tmp.1 > $@.tmp.2
cat constants-hdr $@.tmp.2 > $@
$(RM) $@.tmp*
# Only update include/asm-arm/constants.h when it has actually changed.
$(TOPDIR)/include/asm-arm/constants.h: constants.h
cmp constants.h $@ >/dev/null 2>&1 || cp -p constants.h $@
# Build our dependencies, and then generate the constants and
# mach-types header files. If we do it now, mkdep will pick
# the dependencies up later on when it runs through the other
# directories
dep:
$(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- getconstants.c |\
sed s,getconstants.o,constants.h, > .depend
$(MAKE) all
.PHONY: all dep
ifneq ($(wildcard .depend),)
include .depend
endif
/*
* This file is automatically generated from arch/arm/tools/getconstants.c.
* Do not edit! Only include this file in assembly (.S) files!
*/
...@@ -100,6 +100,3 @@ archclean: ...@@ -100,6 +100,3 @@ archclean:
rm -rf $(LD_SCRIPT).tmp rm -rf $(LD_SCRIPT).tmp
archmrproper: archmrproper:
archdep:
@$(MAKEBOOT) dep
...@@ -7,8 +7,6 @@ zImage: compressed/vmlinuz ...@@ -7,8 +7,6 @@ zImage: compressed/vmlinuz
compressed/vmlinuz: $(TOPDIR)/vmlinux compressed/vmlinuz: $(TOPDIR)/vmlinux
@$(MAKE) -C compressed vmlinuz @$(MAKE) -C compressed vmlinuz
dep:
clean: clean:
rm -f zImage tools/build compressed/vmlinux.out rm -f zImage tools/build compressed/vmlinux.out
@$(MAKE) -C compressed clean @$(MAKE) -C compressed clean
...@@ -108,7 +108,7 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot ...@@ -108,7 +108,7 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/i386/vmlinux.lds vmlinux: arch/i386/vmlinux.lds
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper archdep clean archclean archmrproper
zImage: vmlinux zImage: vmlinux
@$(MAKEBOOT) zImage @$(MAKEBOOT) zImage
...@@ -140,6 +140,3 @@ archclean: ...@@ -140,6 +140,3 @@ archclean:
@$(MAKEBOOT) clean @$(MAKEBOOT) clean
archmrproper: archmrproper:
archdep:
@$(MAKEBOOT) dep
...@@ -97,8 +97,6 @@ bsetup.o: bsetup.s ...@@ -97,8 +97,6 @@ bsetup.o: bsetup.s
bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h
$(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ $(CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
dep:
clean: clean:
@echo 'Cleaning up (boot)' @echo 'Cleaning up (boot)'
@rm -f tools/build @rm -f tools/build
......
...@@ -127,8 +127,11 @@ archmrproper: ...@@ -127,8 +127,11 @@ archmrproper:
rm -f arch/$(ARCH)/vmlinux.lds rm -f arch/$(ARCH)/vmlinux.lds
@$(MAKE) -C arch/$(ARCH)/tools mrproper @$(MAKE) -C arch/$(ARCH)/tools mrproper
archdep:
@$(MAKEBOOT) dep
bootpfile: bootpfile:
@$(MAKEBOOT) bootpfile @$(MAKEBOOT) bootpfile
prepare: $(TOPDIR)/include/asm-ia64/offsets.h
$(TOPDIR)/include/asm-ia64/offsets.h: include/asm include/linux/version.h \
include/config/MARKER
@$(MAKE) -C arch/$(ARCH)/tools $@
\ No newline at end of file
...@@ -23,5 +23,3 @@ bootloader: $(OBJECTS) ...@@ -23,5 +23,3 @@ bootloader: $(OBJECTS)
clean: clean:
rm -f $(TARGETS) rm -f $(TARGETS)
dep:
...@@ -9,7 +9,7 @@ mrproper: ...@@ -9,7 +9,7 @@ mrproper:
clean: clean:
rm -f print_offsets.s print_offsets offsets.h rm -f print_offsets.s print_offsets offsets.h
fastdep: offsets.h $(TARGET): offsets.h
@if ! cmp -s offsets.h ${TARGET}; then \ @if ! cmp -s offsets.h ${TARGET}; then \
echo -e "*** Updating ${TARGET}..."; \ echo -e "*** Updating ${TARGET}..."; \
cp offsets.h ${TARGET}; \ cp offsets.h ${TARGET}; \
......
...@@ -172,5 +172,3 @@ archclean: ...@@ -172,5 +172,3 @@ archclean:
rm -f arch/m68k/kernel/m68k_defs.h arch/m68k/kernel/m68k_defs.d rm -f arch/m68k/kernel/m68k_defs.h arch/m68k/kernel/m68k_defs.d
archmrproper: archmrproper:
archdep:
...@@ -308,9 +308,3 @@ archclean: ...@@ -308,9 +308,3 @@ archclean:
archmrproper: archmrproper:
@$(MAKEBOOT) mrproper @$(MAKEBOOT) mrproper
$(MAKE) -C arch/$(ARCH)/tools mrproper $(MAKE) -C arch/$(ARCH)/tools mrproper
archdep:
if [ ! -f $(TOPDIR)/include/asm-$(ARCH)/offset.h ]; then \
touch $(TOPDIR)/include/asm-$(ARCH)/offset.h; \
fi;
@$(MAKEBOOT) dep
...@@ -35,9 +35,6 @@ elf2ecoff: elf2ecoff.c ...@@ -35,9 +35,6 @@ elf2ecoff: elf2ecoff.c
addinitrd: addinitrd.c addinitrd: addinitrd.c
$(HOSTCC) -o $@ $^ $(HOSTCC) -o $@ $^
# Don't build dependencies, this may die if $(CC) isn't gcc
dep:
clean: clean:
rm -f vmlinux.ecoff rm -f vmlinux.ecoff
rm -f zImage zImage.tmp rm -f zImage zImage.tmp
......
...@@ -176,9 +176,3 @@ archclean: ...@@ -176,9 +176,3 @@ archclean:
archmrproper: archmrproper:
@$(MAKEBOOT) mrproper @$(MAKEBOOT) mrproper
$(MAKE) -C arch/$(ARCH)/tools mrproper $(MAKE) -C arch/$(ARCH)/tools mrproper
archdep:
if [ ! -f $(TOPDIR)/include/asm-$(ARCH)/offset.h ]; then \
touch $(TOPDIR)/include/asm-$(ARCH)/offset.h; \
fi;
@$(MAKEBOOT) dep
...@@ -26,9 +26,6 @@ elf2ecoff: elf2ecoff.c ...@@ -26,9 +26,6 @@ elf2ecoff: elf2ecoff.c
addinitrd: addinitrd.c addinitrd: addinitrd.c
$(HOSTCC) -o $@ $^ $(HOSTCC) -o $@ $^
# Don't build dependencies, this may die if $(CC) isn't gcc
dep:
clean: clean:
rm -f vmlinux.ecoff rm -f vmlinux.ecoff
......
...@@ -78,5 +78,3 @@ install: ...@@ -78,5 +78,3 @@ install:
archclean: archclean:
archmrproper: archmrproper:
archdep:
...@@ -116,6 +116,3 @@ archclean: ...@@ -116,6 +116,3 @@ archclean:
@$(MAKEBOOT) clean @$(MAKEBOOT) clean
archmrproper: archmrproper:
archdep: scripts/mkdep
$(MAKEBOOT) fastdep
...@@ -66,5 +66,5 @@ archclean: ...@@ -66,5 +66,5 @@ archclean:
archmrproper: archmrproper:
archdep: prepare:
$(MAKEBOOT) fastdep $(MAKEBOOT) dep
...@@ -121,9 +121,6 @@ imagesize.c: vmlinux.gz ...@@ -121,9 +121,6 @@ imagesize.c: vmlinux.gz
clean: clean:
rm -f piggyback note addnote $(OBJS) zImage zImage.initrd vmlinux.gz no_initrd.o imagesize.c addSystemMap vmlinux.sm addRamDisk vmlinux.initrd vmlinux.sminitrd rm -f piggyback note addnote $(OBJS) zImage zImage.initrd vmlinux.gz no_initrd.o imagesize.c addSystemMap vmlinux.sm addRamDisk vmlinux.initrd vmlinux.sminitrd
fastdep:
$(TOPDIR)/scripts/mkdep *.[Sch] > .depend
dep: dep:
$(CPP) $(CPPFLAGS) -M *.S *.c > .depend $(CPP) $(CPPFLAGS) -M *.S *.c > .depend
...@@ -58,8 +58,5 @@ archclean: ...@@ -58,8 +58,5 @@ archclean:
archmrproper: archmrproper:
archdep:
@$(MAKEBOOT) dep
install: vmlinux install: vmlinux
@$(MAKEBOOT) BOOTIMAGE=image install @$(MAKEBOOT) BOOTIMAGE=image install
...@@ -22,8 +22,6 @@ image: $(TOPDIR)/vmlinux \ ...@@ -22,8 +22,6 @@ image: $(TOPDIR)/vmlinux \
listing: ../../../vmlinux listing: ../../../vmlinux
$(OBJDUMP) --disassemble --disassemble-all --disassemble-zeroes --reloc $(TOPDIR)/vmlinux > listing $(OBJDUMP) --disassemble --disassemble-all --disassemble-zeroes --reloc $(TOPDIR)/vmlinux > listing
dep:
clean: clean:
rm -f image listing iplfba.boot ipleckd.boot ipldump.boot rm -f image listing iplfba.boot ipleckd.boot ipldump.boot
......
...@@ -56,6 +56,3 @@ archclean: ...@@ -56,6 +56,3 @@ archclean:
$(MAKE) -C arch/$(ARCH)/kernel clean $(MAKE) -C arch/$(ARCH)/kernel clean
archmrproper: archmrproper:
archdep:
@$(MAKEBOOT) dep
...@@ -24,8 +24,6 @@ image: $(TOPDIR)/vmlinux \ ...@@ -24,8 +24,6 @@ image: $(TOPDIR)/vmlinux \
listing: ../../../vmlinux listing: ../../../vmlinux
$(OBJDUMP) --disassemble --disassemble-all --disassemble-zeroes --reloc $(TOPDIR)/vmlinux > listing $(OBJDUMP) --disassemble --disassemble-all --disassemble-zeroes --reloc $(TOPDIR)/vmlinux > listing
dep:
clean: clean:
rm -f image listing iplfba.boot ipleckd.boot ipldump.boot rm -f image listing iplfba.boot ipleckd.boot ipldump.boot
......
...@@ -94,6 +94,3 @@ archclean: ...@@ -94,6 +94,3 @@ archclean:
archmrproper: archmrproper:
rm -f arch/sh/vmlinux.lds rm -f arch/sh/vmlinux.lds
archdep:
@$(MAKEBOOT) dep
...@@ -25,8 +25,6 @@ install: Image ...@@ -25,8 +25,6 @@ install: Image
zinstall: zImage zinstall: zImage
sh -x ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" sh -x ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
dep:
clean: clean:
rm -f tools/build rm -f tools/build
rm -f setup bootsect zImage compressed/vmlinux.out rm -f setup bootsect zImage compressed/vmlinux.out
......
...@@ -58,9 +58,9 @@ archclean: ...@@ -58,9 +58,9 @@ archclean:
archmrproper: archmrproper:
rm -f $(TOPDIR)/include/asm-sparc/asm_offsets.h rm -f $(TOPDIR)/include/asm-sparc/asm_offsets.h
archdep: check_asm prepare: check_asm
check_asm: include/linux/version.h check_asm: include/linux/version.h include/linux/asm include/config/MARKER
$(MAKE) -C arch/sparc/kernel check_asm $(MAKE) -C arch/sparc/kernel check_asm
tftpboot.img: tftpboot.img:
......
...@@ -85,7 +85,5 @@ archclean: ...@@ -85,7 +85,5 @@ archclean:
archmrproper: archmrproper:
archdep:
tftpboot.img: tftpboot.img:
$(MAKE) -C arch/sparc64/boot tftpboot.img $(MAKE) -C arch/sparc64/boot tftpboot.img
...@@ -18,6 +18,3 @@ tftpboot.img: piggyback $(TOPDIR)/vmlinux $(ROOT_IMG) ...@@ -18,6 +18,3 @@ tftpboot.img: piggyback $(TOPDIR)/vmlinux $(ROOT_IMG)
piggyback: piggyback.c piggyback: piggyback.c
$(HOSTCC) $(HOSTCFLAGS) -o piggyback piggyback.c $(HOSTCC) $(HOSTCFLAGS) -o piggyback piggyback.c
dep:
...@@ -48,7 +48,7 @@ CFLAGS += -finline-limit=2000 ...@@ -48,7 +48,7 @@ CFLAGS += -finline-limit=2000
HEAD := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o HEAD := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
SUBDIRS := arch/x86_64/tools $(SUBDIRS) arch/x86_64/kernel arch/x86_64/mm arch/x86_64/lib SUBDIRS += arch/x86_64/kernel arch/x86_64/mm arch/x86_64/lib
CORE_FILES := arch/x86_64/kernel/kernel.o $(CORE_FILES) CORE_FILES := arch/x86_64/kernel/kernel.o $(CORE_FILES)
CORE_FILES += arch/x86_64/mm/mm.o CORE_FILES += arch/x86_64/mm/mm.o
LIBS := $(TOPDIR)/arch/x86_64/lib/lib.a $(LIBS) LIBS := $(TOPDIR)/arch/x86_64/lib/lib.a $(LIBS)
...@@ -70,38 +70,43 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot ...@@ -70,38 +70,43 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/x86_64/vmlinux.lds vmlinux: arch/x86_64/vmlinux.lds
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \ .PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper archdep checkoffset clean archclean archmrproper
checkoffset: FORCE include/asm bzImage: vmlinux
make -C arch/$(ARCH)/tools $(TOPDIR)/include/asm-x86_64/offset.h
bzImage: checkoffset vmlinux
@$(MAKEBOOT) bzImage @$(MAKEBOOT) bzImage
bzImage-padded: checkoffset vmlinux bzImage-padded: vmlinux
@$(MAKEBOOT) bzImage-padded @$(MAKEBOOT) bzImage-padded
tmp: tmp:
@$(MAKEBOOT) BOOTIMAGE=bzImage zlilo @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
bzlilo: checkoffset vmlinux bzlilo: vmlinux
@$(MAKEBOOT) BOOTIMAGE=bzImage zlilo @$(MAKEBOOT) BOOTIMAGE=bzImage zlilo
bzdisk: checkoffset vmlinux bzdisk: vmlinux
@$(MAKEBOOT) BOOTIMAGE=bzImage zdisk @$(MAKEBOOT) BOOTIMAGE=bzImage zdisk
install: checkoffset vmlinux install: vmlinux
@$(MAKEBOOT) BOOTIMAGE=bzImage install @$(MAKEBOOT) BOOTIMAGE=bzImage install
archclean: archclean:
@$(MAKEBOOT) clean @$(MAKEBOOT) clean
@$(MAKE) -C $(TOPDIR)/arch/x86_64/tools clean
archmrproper: archmrproper:
rm -f $(TOPDIR)/arch/x86_64/tools/offset.h
rm -f $(TOPDIR)/arch/x86_64/tools/offset.tmp
rm -f $(TOPDIR)/include/asm-x86_64/offset.h
archdep:
@$(MAKE) -C $(TOPDIR)/arch/x86_64/tools all prepare: include/asm-$(ARCH)/offset.h
@$(MAKEBOOT) dep
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER
include/asm-$(ARCH)/offset.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/offset.h: include/asm-$(ARCH)/offset.h.tmp
@echo -n ' Generating $@'
@$(update-if-changed)
CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
include/asm-$(ARCH)/offset.h
\ No newline at end of file
...@@ -96,12 +96,8 @@ bsetup.o: bsetup.s ...@@ -96,12 +96,8 @@ bsetup.o: bsetup.s
bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h bsetup.s: setup.S video.S Makefile $(BOOT_INCL) $(TOPDIR)/include/linux/version.h $(TOPDIR)/include/linux/compile.h
$(IA32_CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@ $(IA32_CPP) $(CPPFLAGS) -D__BIG_KERNEL__ -D__ASSEMBLY__ -traditional $(SVGA_MODE) $(RAMDISK) $< -o $@
dep:
clean: clean:
rm -f tools/build rm -f tools/build
rm -f setup bootsect zImage compressed/vmlinux.out rm -f setup bootsect zImage compressed/vmlinux.out
rm -f bsetup bbootsect bzImage compressed/bvmlinux.out rm -f bsetup bbootsect bzImage compressed/bvmlinux.out
@$(MAKE) -C compressed clean @$(MAKE) -C compressed clean
/* Written 2000 by Andi Kleen */ /*
/* This program is never executed, just its assembly is examined for offsets * Generate definitions needed by assembly language modules.
(this trick is needed to get cross compiling right) */ * This code generates raw asm output which is post-processed to extract
/* $Id: offset.c,v 1.13 2002/01/08 15:19:57 ak Exp $ */ * and format the required data.
#define ASM_OFFSET_H 1 */
#ifndef __KERNEL__
#define __KERNEL__
#endif
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -15,26 +13,26 @@ ...@@ -15,26 +13,26 @@
#include <asm/segment.h> #include <asm/segment.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#define output(x) asm volatile ("--- " x) #define DEFINE(sym, val) \
#define outconst(x,y) asm volatile ("--- " x : : "i" (y)) asm volatile("\n->" #sym " %0 " #val : : "i" (val))
int main(void) #define BLANK() asm volatile("\n->" : : )
{
output("/* Auto generated by arch/../tools/offset.c at " __DATE__ ". Do not edit. */\n");
output("#ifndef ASM_OFFSET_H\n");
output("#define ASM_OFFSET_H 1\n");
#define ENTRY(entry) outconst("#define tsk_" #entry " %0", offsetof(struct task_struct, entry)) int main(void)
{
#define ENTRY(entry) DEFINE(tsk_ ## entry, offsetof(struct task_struct, entry))
ENTRY(state); ENTRY(state);
ENTRY(flags); ENTRY(flags);
ENTRY(thread); ENTRY(thread);
BLANK();
#undef ENTRY #undef ENTRY
#define ENTRY(entry) outconst("#define threadinfo_" #entry " %0", offsetof(struct thread_info, entry)) #define ENTRY(entry) DEFINE(threadinfo__ ## entry, offsetof(struct thread_info, entry))
ENTRY(flags); ENTRY(flags);
ENTRY(addr_limit); ENTRY(addr_limit);
ENTRY(preempt_count); ENTRY(preempt_count);
BLANK();
#undef ENTRY #undef ENTRY
#define ENTRY(entry) outconst("#define pda_" #entry " %0", offsetof(struct x8664_pda, entry)) #define ENTRY(entry) DEFINE(pda__ ## entry, offsetof(struct x8664_pda, entry))
ENTRY(kernelstack); ENTRY(kernelstack);
ENTRY(oldrsp); ENTRY(oldrsp);
ENTRY(pcurrent); ENTRY(pcurrent);
...@@ -42,8 +40,7 @@ int main(void) ...@@ -42,8 +40,7 @@ int main(void)
ENTRY(irqcount); ENTRY(irqcount);
ENTRY(cpunumber); ENTRY(cpunumber);
ENTRY(irqstackptr); ENTRY(irqstackptr);
BLANK();
#undef ENTRY #undef ENTRY
output("#endif\n"); return 0;
}
return(0);
}
TARGET = $(TOPDIR)/include/asm-x86_64/offset.h
all:
mrproper:
fastdep: $(TARGET)
.PHONY: all
$(TARGET): offset.h
cmp -s $^ $@ || (cp $^ $(TARGET).new && mv $(TARGET).new $(TARGET))
.PHONY : offset.h all modules modules_install
offset.h: offset.sed offset.c FORCE
$(CC) $(CFLAGS) -S -o offset.tmp offset.c
sed -n -f offset.sed < offset.tmp > offset.h
clean:
rm -f offset.[hs] $(TARGET).new offset.tmp
mrproper:
rm -f offset.[hs] $(TARGET)
rm -f $(TARGET)
include $(TOPDIR)/Rules.make
/---/ {
s/---//
s/\$//
s/^ //
s/^ //
p
}
...@@ -143,7 +143,7 @@ void grow_config(int len) ...@@ -143,7 +143,7 @@ void grow_config(int len)
size_config = 2048; size_config = 2048;
str_config = realloc(str_config, size_config *= 2); str_config = realloc(str_config, size_config *= 2);
if (str_config == NULL) if (str_config == NULL)
{ perror("malloc"); exit(1); } { perror("fixdep:malloc"); exit(1); }
} }
} }
...@@ -259,6 +259,7 @@ void do_config_file(char *filename) ...@@ -259,6 +259,7 @@ void do_config_file(char *filename)
fd = open(filename, O_RDONLY); fd = open(filename, O_RDONLY);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(filename); perror(filename);
exit(2); exit(2);
} }
...@@ -269,7 +270,7 @@ void do_config_file(char *filename) ...@@ -269,7 +270,7 @@ void do_config_file(char *filename)
} }
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) { if ((long) map == -1) {
perror("mmap"); perror("fixdep: mmap");
close(fd); close(fd);
return; return;
} }
...@@ -292,7 +293,7 @@ void parse_dep_file(void *map, size_t len) ...@@ -292,7 +293,7 @@ void parse_dep_file(void *map, size_t len)
exit(1); exit(1);
} }
memcpy(s, m, p-m); s[p-m] = 0; memcpy(s, m, p-m); s[p-m] = 0;
printf("%s: \\\n", target); printf("deps_%s := \\\n", target);
m = p+1; m = p+1;
clear_config(); clear_config();
...@@ -314,7 +315,8 @@ void parse_dep_file(void *map, size_t len) ...@@ -314,7 +315,8 @@ void parse_dep_file(void *map, size_t len)
} }
m = p + 1; m = p + 1;
} }
printf("\n"); printf("\n%s: $(deps_%s)\n\n", target, target);
printf("$(deps_%s):\n", target);
} }
void print_deps(void) void print_deps(void)
...@@ -325,6 +327,7 @@ void print_deps(void) ...@@ -325,6 +327,7 @@ void print_deps(void)
fd = open(depfile, O_RDONLY); fd = open(depfile, O_RDONLY);
if (fd < 0) { if (fd < 0) {
fprintf(stderr, "fixdep: ");
perror(depfile); perror(depfile);
exit(2); exit(2);
} }
...@@ -336,7 +339,7 @@ void print_deps(void) ...@@ -336,7 +339,7 @@ void print_deps(void)
} }
map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0); map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) { if ((long) map == -1) {
perror("mmap"); perror("fixdep: mmap");
close(fd); close(fd);
return; return;
} }
......
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