PT_* vs. struct pt_regs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Does anyone know why the PT_* definitions in include/asm-m68k/ptrace.h:

| #define PT_D1      0
| #define PT_D2      1
| #define PT_D3      2
| #define PT_D4      3
| #define PT_D5      4
| #define PT_D6      5
| #define PT_D7      6
| #define PT_A0      7
| #define PT_A1      8
| #define PT_A2      9
| #define PT_A3      10
| #define PT_A4      11
| #define PT_A5      12
| #define PT_A6      13
| #define PT_D0      14
| #define PT_USP     15
| #define PT_ORIG_D0 16
| #define PT_SR      17
| #define PT_PC      18

don't match with the PT_* definitions in include/asm-m68k/asm-offsets.h:

| #define PT_D0 32 /* offsetof(struct pt_regs, d0) */
| #define PT_ORIG_D0 36 /* offsetof(struct pt_regs, orig_d0) */
| #define PT_D1 0 /* offsetof(struct pt_regs, d1) */
| #define PT_D2 4 /* offsetof(struct pt_regs, d2) */
| #define PT_D3 8 /* offsetof(struct pt_regs, d3) */
| #define PT_D4 12 /* offsetof(struct pt_regs, d4) */
| #define PT_D5 16 /* offsetof(struct pt_regs, d5) */
| #define PT_A0 20 /* offsetof(struct pt_regs, a0) */
| #define PT_A1 24 /* offsetof(struct pt_regs, a1) */
| #define PT_A2 28 /* offsetof(struct pt_regs, a2) */
| #define PT_PC 46 /* offsetof(struct pt_regs, pc) */
| #define PT_SR 44 /* offsetof(struct pt_regs, sr) */
| #define PT_VECTOR 50 /* offsetof(struct pt_regs, pc) + 4 */

as generated from struct pt_regs in include/asm-m68k/ptrace.h:

| struct pt_regs {
|   long     d1;
|   long     d2;
|   long     d3;
|   long     d4;
|   long     d5;
|   long     a0;
|   long     a1;
|   long     a2;
|   long     d0;
|   long     orig_d0;
|   long     stkadj;
|   unsigned short sr;
|   unsigned long  pc;
|   unsigned format :  4; /* frame format specifier */
|   unsigned vector : 12; /* vector offset */
| };

I was trying to define task_thread_info() using TASK_INFO instead of using
struct task_struct directly (cfr. ia64), but these conflicts seem to prevent me
from doing this.

Hmm, upon closer look, there are more conflicts between
<asm/asm-offsets.h> and other header files, and
arch/m68k/kernel/ptrace.c does need some of the PT_* definitions from
<asm/ptrace.h>, so I can't just kill them. I guess I'll have to rename the
conflicting ones in asm-offsets.

First patch (still fails to build the whole tree) below.
All comments are welcome...

diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c
index 246a882..83fc9f3 100644
--- a/arch/m68k/kernel/asm-offsets.c
+++ b/arch/m68k/kernel/asm-offsets.c
@@ -8,6 +8,8 @@
  * #defines from the assembly-language output.
  */
 
+#define ASM_OFFSETS_C 1
+
 #include <linux/stddef.h>
 #include <linux/sched.h>
 #include <linux/kernel_stat.h>
diff --git a/include/asm-m68k/ptrace.h b/include/asm-m68k/ptrace.h
index 57e763d..bf8a313 100644
--- a/include/asm-m68k/ptrace.h
+++ b/include/asm-m68k/ptrace.h
@@ -1,26 +1,6 @@
 #ifndef _M68K_PTRACE_H
 #define _M68K_PTRACE_H
 
-#define PT_D1	   0
-#define PT_D2	   1
-#define PT_D3	   2
-#define PT_D4	   3
-#define PT_D5	   4
-#define PT_D6	   5
-#define PT_D7	   6
-#define PT_A0	   7
-#define PT_A1	   8
-#define PT_A2	   9
-#define PT_A3	   10
-#define PT_A4	   11
-#define PT_A5	   12
-#define PT_A6	   13
-#define PT_D0	   14
-#define PT_USP	   15
-#define PT_ORIG_D0 16
-#define PT_SR	   17
-#define PT_PC	   18
-
 #ifndef __ASSEMBLY__
 
 /* this struct defines the way the registers are stored on the
diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h
index c4d622a..682e317 100644
--- a/include/asm-m68k/thread_info.h
+++ b/include/asm-m68k/thread_info.h
@@ -3,6 +3,9 @@
 
 #include <asm/types.h>
 #include <asm/page.h>
+#ifndef ASM_OFFSETS_C
+#include <asm/asm-offsets.h>
+#endif
 
 struct thread_info {
 	struct task_struct	*task;		/* main task structure */
@@ -36,7 +39,12 @@ struct thread_info {
 #define init_thread_info	(init_task.thread.info)
 #define init_stack		(init_thread_union.stack)
 
-#define task_thread_info(tsk)	(&(tsk)->thread.info)
+#ifndef ASM_OFFSETS_C
+#define task_thread_info(tsk)	((struct thread_info *)((char *)(tsk)+TASK_INFO))
+#else
+#define task_thread_info(tsk)	((struct thread_info *)NULL)
+#endif
+
 #define task_stack_page(tsk)	((void *)(tsk)->thread_info)
 #define current_thread_info()	task_thread_info(current)
 

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux