Skip to content

Commit cb418fd

Browse files
xtensa: Autogenerate offsets in struct thread_info
Maintaining offsets by hand is no fun. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 3050a35 commit cb418fd

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎arch/xtensa/include/asm/thread_info.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,6 @@ struct thread_info {
6161
xtregs_user_t xtregs_user;
6262
};
6363

64-
#else /* !__ASSEMBLY__ */
65-
66-
/* offsets into the thread_info struct for assembly code access */
67-
#define TI_TASK 0x00000000
68-
#define TI_EXEC_DOMAIN 0x00000004
69-
#define TI_FLAGS 0x00000008
70-
#define TI_STATUS 0x0000000C
71-
#define TI_CPU 0x00000010
72-
#define TI_PRE_COUNT 0x00000014
73-
#define TI_ADDR_LIMIT 0x00000018
74-
7564
#endif
7665

7766
/*

‎arch/xtensa/kernel/asm-offsets.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ int main(void)
7777
DEFINE(TASK_THREAD_INFO, offsetof (struct task_struct, stack));
7878
DEFINE(TASK_STRUCT_SIZE, sizeof (struct task_struct));
7979

80+
/* offsets in thread_info struct */
81+
OFFSET(TI_TASK, thread_info, task);
82+
OFFSET(TI_FLAGS, thread_info, flags);
83+
OFFSET(TI_STSTUS, thread_info, status);
84+
OFFSET(TI_CPU, thread_info, cpu);
85+
OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
86+
OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
87+
8088
/* struct thread_info (offset from start_struct) */
8189
DEFINE(THREAD_RA, offsetof (struct task_struct, thread.ra));
8290
DEFINE(THREAD_SP, offsetof (struct task_struct, thread.sp));

0 commit comments

Comments
 (0)