* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
@ 2001-04-28 2:55 ` David Mosberger
2001-04-28 3:20 ` Keith Owens
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Mosberger @ 2001-04-28 2:55 UTC (permalink / raw)
To: linux-ia64
>>>>> On Sat, 28 Apr 2001 12:49:29 +1000, Keith Owens <kaos@ocs.com.au> said:
Keith> As part of my makefile rewrite for 2.5 I am cleaning up
Keith> problems like this. The patch below deletes
Keith> include/asm-ia64/offsets.h from the shipped tree, restricts
Keith> its use to assembler code only and makes sure that assembler
Keith> code always gets the latest offset values. C code is not a
Keith> problem, the dependency system handles structure and config
Keith> changes for C code.
There is no way I'm going to duplicate those definitions for asm and C
code. Please find a way to make the same file work for both C and
asm.
--david
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
2001-04-28 2:55 ` David Mosberger
@ 2001-04-28 3:20 ` Keith Owens
2001-04-30 4:57 ` [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2 Keith Owens
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Keith Owens @ 2001-04-28 3:20 UTC (permalink / raw)
To: linux-ia64
On Fri, 27 Apr 2001 19:55:57 -0700,
David Mosberger <davidm@hpl.hp.com> wrote:
>>>>>> On Sat, 28 Apr 2001 12:49:29 +1000, Keith Owens <kaos@ocs.com.au> said:
>
> Keith> As part of my makefile rewrite for 2.5 I am cleaning up
> Keith> problems like this. The patch below deletes
> Keith> include/asm-ia64/offsets.h from the shipped tree, restricts
> Keith> its use to assembler code only and makes sure that assembler
> Keith> code always gets the latest offset values. C code is not a
> Keith> problem, the dependency system handles structure and config
> Keith> changes for C code.
>
>There is no way I'm going to duplicate those definitions for asm and C
>code. Please find a way to make the same file work for both C and
>asm.
Duplication is unavoidable. I could add lines like this to ptrace.h
#ifndef __ASSEMBLY__
#define IA64_SWITCH_STACK_AR_UNAT_OFFSET (offsetof(struct switch_stack, ar_unat))
#define IA64_SWITCH_STACK_AR_BSPSTORE_OFFSET (offsetof(struct switch_stack, ar_bspstore))
#endif
and to other C include files but it is still duplication, just moved
from .c files to a .h file.
Assembler is restricted in what it can include or uses the values in
pre-processor context where sizeof() does not work so it needs the
generated offsets. But generating offset.h breaks the kernel
dependency system so it needs explicit dependency information when
offsets.h is used. The only way to do that cleanly is to restrict its
use to assembler code.
^ permalink raw reply [flat|nested] 10+ messages in thread* [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
2001-04-28 2:55 ` David Mosberger
2001-04-28 3:20 ` Keith Owens
@ 2001-04-30 4:57 ` Keith Owens
2001-04-30 15:00 ` David Mosberger
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Keith Owens @ 2001-04-30 4:57 UTC (permalink / raw)
To: linux-ia64
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Content-Type: text/plain; charset=us-ascii
Second version of offsets.h cleanup patch. Instead of changing lots of
C code, define just the 11 IA64_*_OFFSET fields used by C in ptrace.h.
- ----
include/asm-ia64/offsets.h is causing problems for source control
systems and patches. Because it is shipped as part of the ia64 tree
and then overwritten wth values that are based on the local config it
generates spurious changes.
There is also the problem of when offsets.h gets updated. At the
moment it only gets updated by make dep so changes to structures or
config options which affect the offsets are not automatically detected.
Change a config option, forget to run make dep and you get an
inconsistent kernel.
As part of my makefile rewrite for 2.5 I am cleaning up problems like
this. The patch below deletes include/asm-ia64/offsets.h from the
shipped tree, restricts its use to assembler code only and makes sure
that assembler code always gets the latest offset values. C code is
not a problem, the dependency system handles structure and config
changes for C code.
If you have a "don't diff" list, add include/asm-ia64/offsets.h,
include/asm/offsets.h and arch/ia64/tools/offsets.h to that list after
applying this patch.
Against 2.4.3-ia64-010405.
Index: 3.20/include/asm-ia64/ptrace.h
- --- 3.20/include/asm-ia64/ptrace.h Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/t/4_ptrace.h 1.1.4.1 644)
+++ 3.27(w)/include/asm-ia64/ptrace.h Mon, 30 Apr 2001 14:22:32 +1000 kaos (linux-2.4/t/4_ptrace.h 1.1.4.2 644)
@@ -51,7 +51,6 @@
#include <linux/config.h>
#include <asm/fpu.h>
- -#include <asm/offsets.h>
/*
* Base-2 logarithm of number of pages to allocate per task structure
@@ -67,7 +66,11 @@
# define IA64_TASK_STRUCT_LOG_NUM_PAGES 0
#endif
+#ifdef __ASSEMBLY__
#define IA64_RBS_OFFSET ((IA64_TASK_SIZE + 15) & ~15)
+#else
+#define IA64_RBS_OFFSET ((sizeof (struct task_struct) + 15) & ~15)
+#endif
#define IA64_STK_OFFSET ((1 << IA64_TASK_STRUCT_LOG_NUM_PAGES)*PAGE_SIZE)
#define INIT_TASK_SIZE IA64_STK_OFFSET
@@ -210,6 +213,17 @@ struct switch_stack {
unsigned long ar_bspstore; /* RSE dirty base (preserved) */
unsigned long pr; /* 64 predicate registers (1 bit each) */
};
+
+#define IA64_SWITCH_STACK_AR_BSPSTORE_OFFSET (offsetof(struct switch_stack, ar_bspstore))
+#define IA64_SWITCH_STACK_AR_FPSR_OFFSET (offsetof(struct switch_stack, ar_fpsr))
+#define IA64_SWITCH_STACK_AR_LC_OFFSET (offsetof(struct switch_stack, ar_lc))
+#define IA64_SWITCH_STACK_AR_UNAT_OFFSET (offsetof(struct switch_stack, ar_unat))
+#define IA64_SWITCH_STACK_B0_OFFSET (offsetof(struct switch_stack, b0))
+#define IA64_SWITCH_STACK_B1_OFFSET (offsetof(struct switch_stack, b1))
+#define IA64_SWITCH_STACK_F2_OFFSET (offsetof(struct switch_stack, f2))
+#define IA64_SWITCH_STACK_F16_OFFSET (offsetof(struct switch_stack, f16))
+#define IA64_SWITCH_STACK_PR_OFFSET (offsetof(struct switch_stack, pr))
+#define IA64_SWITCH_STACK_R4_OFFSET (offsetof(struct switch_stack, r4))
#ifdef __KERNEL__
/* given a pointer to a task_struct, return the user's pt_regs */
Index: 3.20/include/asm-ia64/processor.h
- --- 3.20/include/asm-ia64/processor.h Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/s/49_processor. 1.1.5.1 644)
+++ 3.27(w)/include/asm-ia64/processor.h Mon, 30 Apr 2001 14:22:32 +1000 kaos (linux-2.4/s/49_processor. 1.1.5.2 644)
@@ -187,7 +187,6 @@
#include <linux/threads.h>
#include <asm/fpu.h>
- -#include <asm/offsets.h>
#include <asm/page.h>
#include <asm/rse.h>
#include <asm/unwind.h>
@@ -787,7 +786,11 @@ thread_saved_pc (struct thread_struct *t
unsigned long ip;
/* XXX ouch: Linus, please pass the task pointer to thread_saved_pc() instead! */
- - struct task_struct *p = (void *) ((unsigned long) t - IA64_TASK_THREAD_OFFSET);
+ /* When thread_saved_pc() gets the task pointer instead, delete
+ * ia64_task_thread_offset below and in arch/ia64/kernel/process.c. KAO
+ */
+ extern const long ia64_task_thread_offset;
+ struct task_struct *p = (void *) ((unsigned long) t - ia64_task_thread_offset);
unw_init_from_blocked_task(&info, p);
if (unw_unwind(&info) < 0)
Index: 3.20/arch/ia64/tools/Makefile
- --- 3.20/arch/ia64/tools/Makefile Fri, 05 Jan 2001 13:42:29 +1100 kaos (linux-2.4/q/c/1_Makefile 1.1 644)
+++ 3.27(w)/arch/ia64/tools/Makefile Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/q/c/1_Makefile 1.2 644)
@@ -2,14 +2,7 @@ CFLAGS = -g -O2 -Wall $(CPPFLAGS)
TARGET = $(TOPDIR)/include/asm-ia64/offsets.h
- -all:
- -
- -mrproper:
- -
- -clean:
- - rm -f print_offsets.s print_offsets offsets.h
- -
- -fastdep: offsets.h
+all: offsets.h
@if ! cmp -s offsets.h ${TARGET}; then \
echo -e "*** Updating ${TARGET}..."; \
cp offsets.h ${TARGET}; \
@@ -17,6 +10,12 @@ fastdep: offsets.h
echo "*** ${TARGET} is up to date"; \
fi
+clean:
+ rm -f print_offsets.s print_offsets offsets.h .tmp_*
+
+mrproper: clean
+ rm -f $(TARGET)
+
#
# If we're cross-compiling, we use the cross-compiler to translate
# print_offsets.c into an assembly file and then awk to translate this
@@ -26,24 +25,30 @@ fastdep: offsets.h
# print_offsets and run it. --davidm
#
+#
+# The offsets depend on several include files which depend on other include
+# files and config options. Instead of trying to list the full dependency chain
+# (which will be obsolete tomorrow), always make offsets.h and it compare with
+# the current version. This Makefile is only invoked from arch/ia64/kernel and
+# arch/ia64/ia32 so the overhead of making offsets.h each time is minimal. KAO
+#
+
ifeq ($(CROSS_COMPILE),)
offsets.h: print_offsets
- - ./print_offsets > offsets.h
+ ./print_offsets > .tmp_offsets.h_$$$$ && mv .tmp_offsets.h_$$$$ $@
- -print_offsets: print_offsets.c FORCE_RECOMPILE
+print_offsets: FORCE_BUILD
$(CC) $(CFLAGS) print_offsets.c -o $@
- -FORCE_RECOMPILE:
- -
else
offsets.h: print_offsets.s
- - $(AWK) -f print_offsets.awk $^ > $@
+ $(AWK) -f print_offsets.awk $^ > .tmp_offsets.h_$$$$ && mv .tmp_offsets.h_$$$$ $@
- -print_offsets.s: print_offsets.c
+print_offsets.s: FORCE_BUILD
$(CC) $(CFLAGS) -S print_offsets.c -o $@
endif
- -.PHONY: all modules modules_install
+.PHONY: all modules modules_install fastdep FORCE_BUILD
Index: 3.20/arch/ia64/kernel/setup.c
- --- 3.20/arch/ia64/kernel/setup.c Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/r/c/48_setup.c 1.1.5.1 644)
+++ 3.27(w)/arch/ia64/kernel/setup.c Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/r/c/48_setup.c 1.1.5.2 644)
@@ -42,10 +42,6 @@
# include <linux/blk.h>
#endif
- -#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
- -# error "struct cpuinfo_ia64 too big!"
- -#endif
- -
extern char _end;
/* cpu_data[0] is data for the bootstrap processor: */
Index: 3.20/arch/ia64/kernel/process.c
- --- 3.20/arch/ia64/kernel/process.c Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/r/c/50_process.c 1.1.5.1 644)
+++ 3.27(w)/arch/ia64/kernel/process.c Mon, 30 Apr 2001 14:11:55 +1000 kaos (linux-2.4/r/c/50_process.c 1.1.5.2 644)
@@ -28,6 +28,11 @@
#include <asm/unwind.h>
#include <asm/user.h>
+/* When thread_saved_pc() gets the task pointer instead, delete
+ * ia64_task_thread_offset below and in include/asm-ia64/processor.h. KAO
+ */
+const long ia64_task_thread_offset = offsetof(struct task_struct, thread);
+
static void
do_show_stack (struct unw_frame_info *info, void *arg)
{
Index: 3.20/arch/ia64/kernel/mca_asm.S
- --- 3.20/arch/ia64/kernel/mca_asm.S Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/s/c/3_mca_asm.S 1.1.6.1 644)
+++ 3.27(w)/arch/ia64/kernel/mca_asm.S Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/s/c/3_mca_asm.S 1.1.6.2 644)
@@ -9,6 +9,7 @@
//
#include <linux/config.h>
+#include <asm/offsets.h>
#include <asm/pgtable.h>
#include <asm/processor.h>
#include <asm/mca_asm.h>
Index: 3.20/arch/ia64/kernel/entry.S
- --- 3.20/arch/ia64/kernel/entry.S Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/s/c/15_entry.S 1.1.5.1 644)
+++ 3.27(w)/arch/ia64/kernel/entry.S Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/s/c/15_entry.S 1.1.5.2 644)
@@ -41,6 +41,10 @@
#include "minstate.h"
+#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
+# error "struct cpuinfo_ia64 too big!"
+#endif
+
/*
* execve() is special because in case of success, we need to
* setup a null register window frame.
Index: 3.20/arch/ia64/kernel/Makefile
- --- 3.20/arch/ia64/kernel/Makefile Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/s/c/19_Makefile 1.1.5.1 644)
+++ 3.27(w)/arch/ia64/kernel/Makefile Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/s/c/19_Makefile 1.1.5.2 644)
@@ -25,4 +25,10 @@ obj-$(CONFIG_SMP) += smp.o smpboot.o
obj-$(CONFIG_IA64_MCA) += mca.o mca_asm.o
obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o
+.PHONY: include/asm/offsets.h
+include/asm/offsets.h:
+ $(MAKE) -C $(TOPDIR)/arch/$(ARCH)/tools
+
+ivt.o head.o entry.o mca_asm.o: include/asm/offsets.h
+
include $(TOPDIR)/Rules.make
Index: 3.20/arch/ia64/ia32/Makefile
- --- 3.20/arch/ia64/ia32/Makefile Fri, 05 Jan 2001 13:42:29 +1100 kaos (linux-2.4/s/c/27_Makefile 1.1 644)
+++ 3.27(w)/arch/ia64/ia32/Makefile Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/s/c/27_Makefile 1.2 644)
@@ -13,6 +13,12 @@ O_TARGET := ia32.o
obj-y := ia32_entry.o sys_ia32.o ia32_ioctl.o ia32_signal.o ia32_support.o ia32_traps.o binfmt_elf32.o
+.PHONY: include/asm/offsets.h
+include/asm/offsets.h:
+ $(MAKE) -C $(TOPDIR)/arch/$(ARCH)/tools
+
+ia32_entry.o: include/asm/offsets.h
+
clean::
include $(TOPDIR)/Rules.make
Index: 3.20/arch/ia64/Makefile
- --- 3.20/arch/ia64/Makefile Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/s/c/42_Makefile 1.1.5.1 644)
+++ 3.27(w)/arch/ia64/Makefile Mon, 30 Apr 2001 10:57:07 +1000 kaos (linux-2.4/s/c/42_Makefile 1.1.5.1.1.1 644)
@@ -87,7 +87,7 @@ endif
HEAD := arch/$(ARCH)/kernel/head.o arch/ia64/kernel/init_task.o
- -SUBDIRS := arch/$(ARCH)/tools arch/$(ARCH)/kernel arch/$(ARCH)/mm arch/$(ARCH)/lib $(SUBDIRS)
+SUBDIRS := arch/$(ARCH)/kernel arch/$(ARCH)/mm arch/$(ARCH)/lib $(SUBDIRS)
CORE_FILES := arch/$(ARCH)/kernel/kernel.o arch/$(ARCH)/mm/mm.o $(CORE_FILES)
LIBS := $(TOPDIR)/arch/$(ARCH)/lib/lib.a $(LIBS) \
Index: 3.27(w)/include/asm-ia64/offsets.h
- --- 3.20/include/asm-ia64/offsets.h Tue, 24 Apr 2001 11:02:09 +1000 kaos (linux-2.4/t/6_offsets.h 1.1.5.1 644)
+++ 3.27(w)/include/asm-ia64/offsets.h Mon, 30 Apr 2001 14:49:52 +1000 kaos ()
@@ -1,134 +0,0 @@
- -#ifndef _ASM_IA64_OFFSETS_H
- -#define _ASM_IA64_OFFSETS_H
- -
- -/*
- - * DO NOT MODIFY
- - *
- - * This file was generated by arch/ia64/tools/print_offsets.
- - *
- - */
- -
- -#define PT_PTRACED_BIT 0
- -#define PT_TRACESYS_BIT 1
- -
- -#define IA64_TASK_SIZE 3904 /* 0xf40 */
- -#define IA64_PT_REGS_SIZE 400 /* 0x190 */
- -#define IA64_SWITCH_STACK_SIZE 560 /* 0x230 */
- -#define IA64_SIGINFO_SIZE 128 /* 0x80 */
- -#define IA64_CPU_SIZE 16384 /* 0x4000 */
- -#define UNW_FRAME_INFO_SIZE 448 /* 0x1c0 */
- -
- -#define IA64_TASK_PTRACE_OFFSET 48 /* 0x30 */
- -#define IA64_TASK_SIGPENDING_OFFSET 16 /* 0x10 */
- -#define IA64_TASK_NEED_RESCHED_OFFSET 40 /* 0x28 */
- -#define IA64_TASK_PROCESSOR_OFFSET 100 /* 0x64 */
- -#define IA64_TASK_THREAD_OFFSET 1456 /* 0x5b0 */
- -#define IA64_TASK_THREAD_KSP_OFFSET 1456 /* 0x5b0 */
- -#define IA64_TASK_THREAD_SIGMASK_OFFSET 3752 /* 0xea8 */
- -#define IA64_TASK_PFM_NOTIFY_OFFSET 3648 /* 0xe40 */
- -#define IA64_TASK_PID_OFFSET 196 /* 0xc4 */
- -#define IA64_TASK_MM_OFFSET 88 /* 0x58 */
- -#define IA64_PT_REGS_CR_IPSR_OFFSET 0 /* 0x0 */
- -#define IA64_PT_REGS_CR_IIP_OFFSET 8 /* 0x8 */
- -#define IA64_PT_REGS_CR_IFS_OFFSET 16 /* 0x10 */
- -#define IA64_PT_REGS_AR_UNAT_OFFSET 24 /* 0x18 */
- -#define IA64_PT_REGS_AR_PFS_OFFSET 32 /* 0x20 */
- -#define IA64_PT_REGS_AR_RSC_OFFSET 40 /* 0x28 */
- -#define IA64_PT_REGS_AR_RNAT_OFFSET 48 /* 0x30 */
- -#define IA64_PT_REGS_AR_BSPSTORE_OFFSET 56 /* 0x38 */
- -#define IA64_PT_REGS_PR_OFFSET 64 /* 0x40 */
- -#define IA64_PT_REGS_B6_OFFSET 72 /* 0x48 */
- -#define IA64_PT_REGS_LOADRS_OFFSET 80 /* 0x50 */
- -#define IA64_PT_REGS_R1_OFFSET 88 /* 0x58 */
- -#define IA64_PT_REGS_R2_OFFSET 96 /* 0x60 */
- -#define IA64_PT_REGS_R3_OFFSET 104 /* 0x68 */
- -#define IA64_PT_REGS_R12_OFFSET 112 /* 0x70 */
- -#define IA64_PT_REGS_R13_OFFSET 120 /* 0x78 */
- -#define IA64_PT_REGS_R14_OFFSET 128 /* 0x80 */
- -#define IA64_PT_REGS_R15_OFFSET 136 /* 0x88 */
- -#define IA64_PT_REGS_R8_OFFSET 144 /* 0x90 */
- -#define IA64_PT_REGS_R9_OFFSET 152 /* 0x98 */
- -#define IA64_PT_REGS_R10_OFFSET 160 /* 0xa0 */
- -#define IA64_PT_REGS_R11_OFFSET 168 /* 0xa8 */
- -#define IA64_PT_REGS_R16_OFFSET 176 /* 0xb0 */
- -#define IA64_PT_REGS_R17_OFFSET 184 /* 0xb8 */
- -#define IA64_PT_REGS_R18_OFFSET 192 /* 0xc0 */
- -#define IA64_PT_REGS_R19_OFFSET 200 /* 0xc8 */
- -#define IA64_PT_REGS_R20_OFFSET 208 /* 0xd0 */
- -#define IA64_PT_REGS_R21_OFFSET 216 /* 0xd8 */
- -#define IA64_PT_REGS_R22_OFFSET 224 /* 0xe0 */
- -#define IA64_PT_REGS_R23_OFFSET 232 /* 0xe8 */
- -#define IA64_PT_REGS_R24_OFFSET 240 /* 0xf0 */
- -#define IA64_PT_REGS_R25_OFFSET 248 /* 0xf8 */
- -#define IA64_PT_REGS_R26_OFFSET 256 /* 0x100 */
- -#define IA64_PT_REGS_R27_OFFSET 264 /* 0x108 */
- -#define IA64_PT_REGS_R28_OFFSET 272 /* 0x110 */
- -#define IA64_PT_REGS_R29_OFFSET 280 /* 0x118 */
- -#define IA64_PT_REGS_R30_OFFSET 288 /* 0x120 */
- -#define IA64_PT_REGS_R31_OFFSET 296 /* 0x128 */
- -#define IA64_PT_REGS_AR_CCV_OFFSET 304 /* 0x130 */
- -#define IA64_PT_REGS_AR_FPSR_OFFSET 312 /* 0x138 */
- -#define IA64_PT_REGS_B0_OFFSET 320 /* 0x140 */
- -#define IA64_PT_REGS_B7_OFFSET 328 /* 0x148 */
- -#define IA64_PT_REGS_F6_OFFSET 336 /* 0x150 */
- -#define IA64_PT_REGS_F7_OFFSET 352 /* 0x160 */
- -#define IA64_PT_REGS_F8_OFFSET 368 /* 0x170 */
- -#define IA64_PT_REGS_F9_OFFSET 384 /* 0x180 */
- -#define IA64_SWITCH_STACK_CALLER_UNAT_OFFSET 0 /* 0x0 */
- -#define IA64_SWITCH_STACK_AR_FPSR_OFFSET 8 /* 0x8 */
- -#define IA64_SWITCH_STACK_F2_OFFSET 16 /* 0x10 */
- -#define IA64_SWITCH_STACK_F3_OFFSET 32 /* 0x20 */
- -#define IA64_SWITCH_STACK_F4_OFFSET 48 /* 0x30 */
- -#define IA64_SWITCH_STACK_F5_OFFSET 64 /* 0x40 */
- -#define IA64_SWITCH_STACK_F10_OFFSET 80 /* 0x50 */
- -#define IA64_SWITCH_STACK_F11_OFFSET 96 /* 0x60 */
- -#define IA64_SWITCH_STACK_F12_OFFSET 112 /* 0x70 */
- -#define IA64_SWITCH_STACK_F13_OFFSET 128 /* 0x80 */
- -#define IA64_SWITCH_STACK_F14_OFFSET 144 /* 0x90 */
- -#define IA64_SWITCH_STACK_F15_OFFSET 160 /* 0xa0 */
- -#define IA64_SWITCH_STACK_F16_OFFSET 176 /* 0xb0 */
- -#define IA64_SWITCH_STACK_F17_OFFSET 192 /* 0xc0 */
- -#define IA64_SWITCH_STACK_F18_OFFSET 208 /* 0xd0 */
- -#define IA64_SWITCH_STACK_F19_OFFSET 224 /* 0xe0 */
- -#define IA64_SWITCH_STACK_F20_OFFSET 240 /* 0xf0 */
- -#define IA64_SWITCH_STACK_F21_OFFSET 256 /* 0x100 */
- -#define IA64_SWITCH_STACK_F22_OFFSET 272 /* 0x110 */
- -#define IA64_SWITCH_STACK_F23_OFFSET 288 /* 0x120 */
- -#define IA64_SWITCH_STACK_F24_OFFSET 304 /* 0x130 */
- -#define IA64_SWITCH_STACK_F25_OFFSET 320 /* 0x140 */
- -#define IA64_SWITCH_STACK_F26_OFFSET 336 /* 0x150 */
- -#define IA64_SWITCH_STACK_F27_OFFSET 352 /* 0x160 */
- -#define IA64_SWITCH_STACK_F28_OFFSET 368 /* 0x170 */
- -#define IA64_SWITCH_STACK_F29_OFFSET 384 /* 0x180 */
- -#define IA64_SWITCH_STACK_F30_OFFSET 400 /* 0x190 */
- -#define IA64_SWITCH_STACK_F31_OFFSET 416 /* 0x1a0 */
- -#define IA64_SWITCH_STACK_R4_OFFSET 432 /* 0x1b0 */
- -#define IA64_SWITCH_STACK_R5_OFFSET 440 /* 0x1b8 */
- -#define IA64_SWITCH_STACK_R6_OFFSET 448 /* 0x1c0 */
- -#define IA64_SWITCH_STACK_R7_OFFSET 456 /* 0x1c8 */
- -#define IA64_SWITCH_STACK_B0_OFFSET 464 /* 0x1d0 */
- -#define IA64_SWITCH_STACK_B1_OFFSET 472 /* 0x1d8 */
- -#define IA64_SWITCH_STACK_B2_OFFSET 480 /* 0x1e0 */
- -#define IA64_SWITCH_STACK_B3_OFFSET 488 /* 0x1e8 */
- -#define IA64_SWITCH_STACK_B4_OFFSET 496 /* 0x1f0 */
- -#define IA64_SWITCH_STACK_B5_OFFSET 504 /* 0x1f8 */
- -#define IA64_SWITCH_STACK_AR_PFS_OFFSET 512 /* 0x200 */
- -#define IA64_SWITCH_STACK_AR_LC_OFFSET 520 /* 0x208 */
- -#define IA64_SWITCH_STACK_AR_UNAT_OFFSET 528 /* 0x210 */
- -#define IA64_SWITCH_STACK_AR_RNAT_OFFSET 536 /* 0x218 */
- -#define IA64_SWITCH_STACK_AR_BSPSTORE_OFFSET 544 /* 0x220 */
- -#define IA64_SWITCH_STACK_PR_OFFSET 552 /* 0x228 */
- -#define IA64_SIGCONTEXT_AR_BSP_OFFSET 72 /* 0x48 */
- -#define IA64_SIGCONTEXT_AR_RNAT_OFFSET 80 /* 0x50 */
- -#define IA64_SIGCONTEXT_FLAGS_OFFSET 0 /* 0x0 */
- -#define IA64_SIGCONTEXT_CFM_OFFSET 48 /* 0x30 */
- -#define IA64_SIGCONTEXT_FR6_OFFSET 560 /* 0x230 */
- -#define IA64_CLONE_VFORK 16384 /* 0x4000 */
- -#define IA64_CLONE_VM 256 /* 0x100 */
- -#define IA64_CPU_IRQ_COUNT_OFFSET 8 /* 0x8 */
- -#define IA64_CPU_BH_COUNT_OFFSET 12 /* 0xc */
- -#define IA64_CPU_SOFTIRQ_ACTIVE_OFFSET 0 /* 0x0 */
- -#define IA64_CPU_SOFTIRQ_MASK_OFFSET 4 /* 0x4 */
- -#define IA64_CPU_PHYS_STACKED_SIZE_P8_OFFSET 16 /* 0x10 */
- -
- -#endif /* _ASM_IA64_OFFSETS_H */
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.3 (GNU/Linux)
Comment: Exmh version 2.1.1 10/15/1999
iD8DBQE67PDIi4UHNye0ZOoRAvyrAKC+bL9IBzz5CkQDpShgOs9dfhFOBACg2e5J
NQ8lk1D0UQIJbVdVR6j32eE=xKTl
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
` (2 preceding siblings ...)
2001-04-30 4:57 ` [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2 Keith Owens
@ 2001-04-30 15:00 ` David Mosberger
2001-04-30 22:31 ` Keith Owens
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: David Mosberger @ 2001-04-30 15:00 UTC (permalink / raw)
To: linux-ia64
>>>>> On Mon, 30 Apr 2001 14:57:45 +1000, Keith Owens <kaos@ocs.com.au> said:
Keith> Second version of offsets.h cleanup patch. Instead of
Keith> changing lots of C code, define just the 11 IA64_*_OFFSET
Keith> fields used by C in ptrace.h.
This is better, but still no cigar: print_tools knows all the symbols
that we might want to use in assembly or C code so I'd rather have it
generate all definitions. I'm OK with using different definitions for
C and asm, _provided_ they have the same name and they are
automatically generated (to ensure consistency). Ideally, I'd like
these #defines to live in the same place (header file).
--david
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
` (3 preceding siblings ...)
2001-04-30 15:00 ` David Mosberger
@ 2001-04-30 22:31 ` Keith Owens
2001-04-30 22:51 ` Don Dugger
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Keith Owens @ 2001-04-30 22:31 UTC (permalink / raw)
To: linux-ia64
On Mon, 30 Apr 2001 08:00:57 -0700,
David Mosberger <davidm@hpl.hp.com> wrote:
>>>>>> On Mon, 30 Apr 2001 14:57:45 +1000, Keith Owens <kaos@ocs.com.au> said:
>
> Keith> Second version of offsets.h cleanup patch. Instead of
> Keith> changing lots of C code, define just the 11 IA64_*_OFFSET
> Keith> fields used by C in ptrace.h.
>
>This is better, but still no cigar: print_tools knows all the symbols
>that we might want to use in assembly or C code so I'd rather have it
>generate all definitions. I'm OK with using different definitions for
>C and asm, _provided_ they have the same name and they are
>automatically generated (to ensure consistency). Ideally, I'd like
>these #defines to live in the same place (header file).
The kernel build system copes reasonably well with shipped files, using
implicit dependencies which take config changes into account. kbuild
has problems with generated files because they require explicit
dependency information to ensure that they are built before any file
that uses a generated file is read.
A single version of offsets.h is a problem because it needs to be
included in several .c files, each of those .c files requires an
explicit dependency on the build of offsets.h. Because offsets.h
depends on config changes, on header changes and possibly on command
line parameters to make, it is impractible to work out if any of the
inputs to offsets.h have changed. Instead it must be generated every
time and checked to see if has changed. That is acceptable for 5
assembler files, it is not acceptable to regenerate offsets.h for every
.c file that might include offsets.h.
There are only 11 IA64_*_OFFSET fields used by .c files. The cleanest
solution is to define those 11 fields in the headers that also define
the structure, which is what I did. There is no justification for
complicating the kernel build system any more than it already is, just
to avoid 11 #defines.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
` (4 preceding siblings ...)
2001-04-30 22:31 ` Keith Owens
@ 2001-04-30 22:51 ` Don Dugger
2001-04-30 23:20 ` Keith Owens
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Don Dugger @ 2001-04-30 22:51 UTC (permalink / raw)
To: linux-ia64
Keith-
The number of defines is not the issue. This issue is that with
the current system these defines are only defined once. If you
create two different definitions that must match then I can
guarantee that some time in the future the definitions will get
out of sync and we'll spend an inordinate amount of time tracking
down a glitch that never would have occurred if we'd kept with
the current scheme of generating `offsets.h'.
If the only solution you can come up with is to create multiple
definitions then I'm with David, let's just keep the current scheme.
On Tue, May 01, 2001 at 08:31:04AM +1000, Keith Owens wrote:
> On Mon, 30 Apr 2001 08:00:57 -0700,
> David Mosberger <davidm@hpl.hp.com> wrote:
> >>>>>> On Mon, 30 Apr 2001 14:57:45 +1000, Keith Owens <kaos@ocs.com.au> said:
> >
> > Keith> Second version of offsets.h cleanup patch. Instead of
> > Keith> changing lots of C code, define just the 11 IA64_*_OFFSET
> > Keith> fields used by C in ptrace.h.
> >
> >This is better, but still no cigar: print_tools knows all the symbols
> >that we might want to use in assembly or C code so I'd rather have it
> >generate all definitions. I'm OK with using different definitions for
> >C and asm, _provided_ they have the same name and they are
> >automatically generated (to ensure consistency). Ideally, I'd like
> >these #defines to live in the same place (header file).
>
> The kernel build system copes reasonably well with shipped files, using
> implicit dependencies which take config changes into account. kbuild
> has problems with generated files because they require explicit
> dependency information to ensure that they are built before any file
> that uses a generated file is read.
>
> A single version of offsets.h is a problem because it needs to be
> included in several .c files, each of those .c files requires an
> explicit dependency on the build of offsets.h. Because offsets.h
> depends on config changes, on header changes and possibly on command
> line parameters to make, it is impractible to work out if any of the
> inputs to offsets.h have changed. Instead it must be generated every
> time and checked to see if has changed. That is acceptable for 5
> assembler files, it is not acceptable to regenerate offsets.h for every
> .c file that might include offsets.h.
>
> There are only 11 IA64_*_OFFSET fields used by .c files. The cleanest
> solution is to define those 11 fields in the headers that also define
> the structure, which is what I did. There is no justification for
> complicating the kernel build system any more than it already is, just
> to avoid 11 #defines.
>
>
> _______________________________________________
> Linux-IA64 mailing list
> Linux-IA64@linuxia64.org
> http://lists.linuxia64.org/lists/listinfo/linux-ia64
--
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano@valinux.com
Ph: 303/938-9838
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
` (5 preceding siblings ...)
2001-04-30 22:51 ` Don Dugger
@ 2001-04-30 23:20 ` Keith Owens
2001-05-01 8:36 ` Doug Rabson
2001-05-07 18:08 ` David Mosberger
8 siblings, 0 replies; 10+ messages in thread
From: Keith Owens @ 2001-04-30 23:20 UTC (permalink / raw)
To: linux-ia64
On Mon, 30 Apr 2001 16:51:46 -0600,
Don Dugger <n0ano@valinux.com> wrote:
>The number of defines is not the issue. This issue is that with
>the current system these defines are only defined once. If you
>create two different definitions that must match then I can
>guarantee that some time in the future the definitions will get
>out of sync and we'll spend an inordinate amount of time tracking
>down a glitch that never would have occurred if we'd kept with
>the current scheme of generating `offsets.h'.
Why is defining a field twice an issue? Both the C and asm definitions
are defined as offsets of fields within a structure by name. Neither
the structure name nor the field names are ever going to change,
switch_stack is as critical a structure as you can get. Do you really
expect this definition to change?
#define IA64_SWITCH_STACK_B0_OFFSET (offsetof(struct switch_stack, b0))
Other architectures accept that they need different definitions for C
and asm. In fact ix86 is even worse, it has these hard coded lines in
arch/i386/kernel/entry.S and everybody lives with it.
/*
* these are offsets into the task-struct.
*/
state = 0
flags = 4
sigpending = 8
addr_limit = 12
exec_domain = 16
need_resched = 20
tsk_ptrace = 24
processor = 52
>If the only solution you can come up with is to create multiple
>definitions then I'm with David, let's just keep the current scheme.
The current scheme relies on users manually running make dep after any
change that might affect the offsets of the fields generated by
print-offsets. Make any change that affects the size of struct
task_struct (including config changes), forget to run make dep and your
kernel build is useless. Relying on *every* user to manually run make
dep after any patch or config change that *might* affect offsets.h is
unacceptable.
You have a choice between a clean kbuild that requires 11 #defines that
will never change or the existing method which relies on human
intervention. The current scheme is an bomb waiting to go off.
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
` (6 preceding siblings ...)
2001-04-30 23:20 ` Keith Owens
@ 2001-05-01 8:36 ` Doug Rabson
2001-05-07 18:08 ` David Mosberger
8 siblings, 0 replies; 10+ messages in thread
From: Doug Rabson @ 2001-05-01 8:36 UTC (permalink / raw)
To: linux-ia64
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1234 bytes --]
On Mon, 30 Apr 2001, Don Dugger wrote:
> Keith-
>
> The number of defines is not the issue. This issue is that with
> the current system these defines are only defined once. If you
> create two different definitions that must match then I can
> guarantee that some time in the future the definitions will get
> out of sync and we'll spend an inordinate amount of time tracking
> down a glitch that never would have occurred if we'd kept with
> the current scheme of generating `offsets.h'.
>
> If the only solution you can come up with is to create multiple
> definitions then I'm with David, let's just keep the current scheme.
We have similar issues in FreeBSD (and all the other BSDs too). Our
current solution is to compile a file which uses offsetof() to determine
the symbol values and then use a script to extract those values. Earlier
versions used to compile and run a program which used offsetof() but that
made cross-builds harder.
For your amusement, I have attached the definitions file for the
FreeBSD/ia64 port and the script which pulls out the values. The script
output is used to make assym.s which is included by all assembler files.
--
Doug Rabson Mail: dfr@nlsystems.com
Phone: +44 20 8348 6160
[-- Attachment #2: Type: TEXT/PLAIN, Size: 5594 bytes --]
/*-
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: @(#)genassym.c 5.11 (Berkeley) 5/10/91
* $FreeBSD: src/sys/ia64/ia64/genassym.c,v 1.12 2001/03/28 02:46:20 jhb Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/assym.h>
#include <sys/proc.h>
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/errno.h>
#include <sys/proc.h>
#include <sys/mount.h>
#include <sys/socket.h>
#include <sys/resource.h>
#include <sys/resourcevar.h>
#include <sys/ucontext.h>
#include <machine/frame.h>
#include <machine/mutex.h>
#include <sys/vmmeter.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <vm/vm_map.h>
#include <sys/user.h>
#include <net/if.h>
#include <netinet/in.h>
#include <nfs/nfsv2.h>
#include <nfs/rpcv2.h>
#include <nfs/nfs.h>
#include <nfs/nfsdiskless.h>
ASSYM(GD_CURPROC, offsetof(struct globaldata, gd_curproc));
ASSYM(GD_FPCURPROC, offsetof(struct globaldata, gd_fpcurproc));
ASSYM(GD_CURPCB, offsetof(struct globaldata, gd_curpcb));
ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime));
ASSYM(GD_CPUID, offsetof(struct globaldata, gd_cpuid));
ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));
ASSYM(MTX_RECURSE, offsetof(struct mtx, mtx_recurse));
ASSYM(MTX_SAVECRIT, offsetof(struct mtx, mtx_savecrit));
ASSYM(MTX_UNOWNED, MTX_UNOWNED);
ASSYM(P_ADDR, offsetof(struct proc, p_addr));
ASSYM(P_MD_FLAGS, offsetof(struct proc, p_md.md_flags));
ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS);
ASSYM(SIZEOF_USER, sizeof(struct user));
ASSYM(FRAME_SYSCALL, FRAME_SYSCALL);
ASSYM(TF_CR_IPSR, offsetof(struct trapframe, tf_cr_ipsr));
ASSYM(TF_CR_IFS, offsetof(struct trapframe, tf_cr_ifs));
ASSYM(TF_NDIRTY, offsetof(struct trapframe, tf_ndirty));
ASSYM(TF_B, offsetof(struct trapframe, tf_b));
ASSYM(TF_R, offsetof(struct trapframe, tf_r));
ASSYM(TF_F, offsetof(struct trapframe, tf_f));
ASSYM(FRAME_R4, FRAME_R4);
ASSYM(FRAME_R5, FRAME_R5);
ASSYM(FRAME_R6, FRAME_R6);
ASSYM(FRAME_R7, FRAME_R7);
ASSYM(FRAME_SP, FRAME_SP);
ASSYM(U_PCB_R4, offsetof(struct user, u_pcb.pcb_r4));
ASSYM(U_PCB_R5, offsetof(struct user, u_pcb.pcb_r5));
ASSYM(U_PCB_R6, offsetof(struct user, u_pcb.pcb_r6));
ASSYM(U_PCB_R7, offsetof(struct user, u_pcb.pcb_r7));
ASSYM(U_PCB_F2, offsetof(struct user, u_pcb.pcb_f2));
ASSYM(U_PCB_F3, offsetof(struct user, u_pcb.pcb_f3));
ASSYM(U_PCB_F4, offsetof(struct user, u_pcb.pcb_f4));
ASSYM(U_PCB_F5, offsetof(struct user, u_pcb.pcb_f5));
ASSYM(U_PCB_B0, offsetof(struct user, u_pcb.pcb_b0));
ASSYM(U_PCB_B1, offsetof(struct user, u_pcb.pcb_b1));
ASSYM(U_PCB_B2, offsetof(struct user, u_pcb.pcb_b2));
ASSYM(U_PCB_B3, offsetof(struct user, u_pcb.pcb_b3));
ASSYM(U_PCB_B4, offsetof(struct user, u_pcb.pcb_b4));
ASSYM(U_PCB_B5, offsetof(struct user, u_pcb.pcb_b5));
ASSYM(U_PCB_OLD_UNAT, offsetof(struct user, u_pcb.pcb_old_unat));
ASSYM(U_PCB_SP, offsetof(struct user, u_pcb.pcb_sp));
ASSYM(U_PCB_PFS, offsetof(struct user, u_pcb.pcb_pfs));
ASSYM(U_PCB_BSPSTORE, offsetof(struct user, u_pcb.pcb_bspstore));
ASSYM(U_PCB_UNAT, offsetof(struct user, u_pcb.pcb_unat));
ASSYM(U_PCB_RNAT, offsetof(struct user, u_pcb.pcb_rnat));
ASSYM(U_PCB_PR, offsetof(struct user, u_pcb.pcb_pr));
ASSYM(U_PCB_ONFAULT, offsetof(struct user, u_pcb.pcb_onfault));
ASSYM(U_PCB_HIGHFP, offsetof(struct user, u_pcb.pcb_highfp));
ASSYM(UC_MCONTEXT_MC_AR_BSP, offsetof(ucontext_t, uc_mcontext.mc_ar_bsp));
ASSYM(UC_MCONTEXT_MC_AR_RNAT, offsetof(ucontext_t, uc_mcontext.mc_ar_rnat));
ASSYM(EFAULT, EFAULT);
ASSYM(ENAMETOOLONG, ENAMETOOLONG);
ASSYM(SIZEOF_TRAPFRAME, sizeof(struct trapframe));
[-- Attachment #3: Type: TEXT/PLAIN, Size: 1117 bytes --]
#!/bin/sh
# $FreeBSD: src/sys/kern/genassym.sh,v 1.2 2001/01/28 06:39:56 marcel Exp $
# Grrr, this should use stdin and stdout, but is encrufted for compatibility.
usage() {
echo "usage: genassym [-o outfile] objfile"
exit 1
}
outfile=/dev/stdout
while getopts "o:" option
do
case "$option" in
o) outfile="$OPTARG";;
*) usage;;
esac
done
shift $(($OPTIND - 1))
case $# in
1) ;;
*) usage;;
esac
${NM:='nm'} "$1" | awk '
/ C .*sign$/ {
sign = substr($1, length($1) - 3, 4)
sub("^0*", "", sign)
if (sign != "")
sign = "-"
}
/ C .*w0$/ {
w0 = substr($1, length($1) - 3, 4)
}
/ C .*w1$/ {
w1 = substr($1, length($1) - 3, 4)
}
/ C .*w2$/ {
w2 = substr($1, length($1) - 3, 4)
}
/ C .*w3$/ {
w3 = substr($1, length($1) - 3, 4)
w = w3 w2 w1 w0
sub("^0*", "", w)
if (w == "")
w = "0"
sub("w3$", "", $3)
# This still has minor problems representing INT_MIN, etc. E.g.,
# with 32-bit 2''s complement ints, this prints -0x80000000, which
# has the wrong type (unsigned int).
printf("#define\t%s\t%s0x%s\n", $3, sign, w)
}
' 3>"$outfile" >&3 3>&-
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Linux-ia64] Cleanup include/asm-ia64/offsets.h - take 2
2001-04-28 2:49 [Linux-ia64] Cleanup include/asm-ia64/offsets.h Keith Owens
` (7 preceding siblings ...)
2001-05-01 8:36 ` Doug Rabson
@ 2001-05-07 18:08 ` David Mosberger
8 siblings, 0 replies; 10+ messages in thread
From: David Mosberger @ 2001-05-07 18:08 UTC (permalink / raw)
To: linux-ia64
>>>>> On Tue, 1 May 2001 09:36:25 +0100 (BST), Doug Rabson <dfr@nlsystems.com> said:
Doug> We have similar issues in FreeBSD (and all the other BSDs
Doug> too). Our current solution is to compile a file which uses
Doug> offsetof() to determine the symbol values and then use a
Doug> script to extract those values.
We do the same when cross-compiling a kernel.
--david
^ permalink raw reply [flat|nested] 10+ messages in thread