Re: [PATCH] TASK_PTRACE in arch/alpha/kernel/entry.S

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Tue Jul 25 2000 - 09:30:13 EST


On Mon, Jul 24, 2000 at 09:05:10AM -0400, Pat O'Rourke wrote:
> the offset of the task_struct's ptrace field as 104, or right after the
> 'processor' field. This appears incorrect because the 'ptrace' field is
> actually after 'need_resched'. This patch will adjust the definition of
> TASK_PTRACE accordingly.

Damn. Thanks.
So the `ptrace' field was silently moved since test1-ac...

> +#define TASK_PTRACE 48
> #define TASK_PROCESSOR 100
> -#define TASK_PTRACE 104

I think we should better fix the asm_offsets stuff, just to
prevent such a mess in future.

Ivan.

diff -urN 240t5p4/arch/alpha/kernel/Makefile linux/arch/alpha/kernel/Makefile
--- 240t5p4/arch/alpha/kernel/Makefile Sun Jun 25 14:24:10 2000
+++ linux/arch/alpha/kernel/Makefile Tue Jul 25 13:16:41 2000
@@ -140,7 +140,7 @@
 
 O_OBJS += $(L_TARGET)
 
-all: kernel.o head.o
+all: asm_offsets kernel.o head.o
 
 asm_offsets: check_asm
         ./check_asm > $(TOPDIR)/include/asm-alpha/asm_offsets.h
@@ -150,5 +150,6 @@
 
 clean::
         rm -f check_asm
+ rm -f $(TOPDIR)/include/asm-alpha/asm_offsets.h
 
 include $(TOPDIR)/Rules.make
diff -urN 240t5p4/arch/alpha/kernel/check_asm.c linux/arch/alpha/kernel/check_asm.c
--- 240t5p4/arch/alpha/kernel/check_asm.c Sun Nov 28 02:42:54 1999
+++ linux/arch/alpha/kernel/check_asm.c Tue Jul 25 12:38:39 2000
@@ -19,6 +19,10 @@
                (long)offsetof(struct task_struct, exec_domain));
         printf("#define TASK_NEED_RESCHED %ld\n",
                (long)offsetof(struct task_struct, need_resched));
+ printf("#define TASK_PTRACE %ld\n",
+ (long)offsetof(struct task_struct, ptrace));
+ printf("#define TASK_PROCESSOR %ld\n",
+ (long)offsetof(struct task_struct, processor));
         printf("#define TASK_SIZE %ld\n", sizeof(struct task_struct));
         printf("#define STACK_SIZE %ld\n", sizeof(union task_union));
 
@@ -26,6 +30,9 @@
                (long)offsetof(struct alpha_machine_vector, hae_cache));
         printf("#define HAE_REG %ld\n",
                (long)offsetof(struct alpha_machine_vector, hae_register));
+
+ printf("#define PT_PTRACED 0x%08x\n", PT_PTRACED);
+ printf("#define CLONE_VM 0x%08x\n", CLONE_VM);
 
         printf("#endif /* __ASM_OFFSETS_H__ */\n");
         return 0;
diff -urN 240t5p4/arch/alpha/kernel/entry.S linux/arch/alpha/kernel/entry.S
--- 240t5p4/arch/alpha/kernel/entry.S Sun Jun 25 14:24:10 2000
+++ linux/arch/alpha/kernel/entry.S Tue Jul 25 12:38:14 2000
@@ -6,42 +6,18 @@
 
 #include <linux/config.h>
 #include <asm/system.h>
+#include <asm/asm_offsets.h>
 
 #define SIGCHLD 20
 
 #define NR_SYSCALLS 377
 
 /*
- * These offsets must match with alpha_mv in <asm/machvec.h>.
- */
-#define HAE_CACHE 0
-#define HAE_REG 8
-
-/*
  * stack offsets
  */
 #define SP_OFF 184
 
 #define SWITCH_STACK_SIZE 320
-
-/*
- * task structure offsets
- */
-#define TASK_STATE 0
-#define TASK_FLAGS 8
-#define TASK_SIGPENDING 16
-#define TASK_ADDR_LIMIT 24
-#define TASK_EXEC_DOMAIN 32
-#define TASK_NEED_RESCHED 40
-#define TASK_PROCESSOR 100
-#define TASK_PTRACE 104
-
-/*
- * task flags (must match include/linux/sched.h):
- */
-#define PT_PTRACED 0x00000001
-
-#define CLONE_VM 0x00000100
 
 /*
  * This defines the normal kernel pt-regs layout.
diff -urN 240t5p4/include/asm-alpha/asm_offsets.h linux/include/asm-alpha/asm_offsets.h
--- 240t5p4/include/asm-alpha/asm_offsets.h Mon Oct 12 22:40:12 1998
+++ linux/include/asm-alpha/asm_offsets.h Thu Jan 1 03:00:00 1970
@@ -1,13 +0,0 @@
-#ifndef __ASM_OFFSETS_H__
-#define __ASM_OFFSETS_H__
-#define TASK_STATE 0
-#define TASK_FLAGS 8
-#define TASK_SIGPENDING 16
-#define TASK_ADDR_LIMIT 24
-#define TASK_EXEC_DOMAIN 32
-#define TASK_NEED_RESCHED 40
-#define TASK_SIZE 1096
-#define STACK_SIZE 16384
-#define HAE_CACHE 0
-#define HAE_REG 8
-#endif /* __ASM_OFFSETS_H__ */
 



This archive was generated by hypermail 2b29 : Mon Jul 31 2000 - 21:00:38 EST