Skip to content

Commit 283237a

Browse files
committed
ARC: pt_regs update #1: Align pt_regs end with end of kernel stack page
Historically, pt_regs would end at offset of 1 word from end of stack page. ----------------- -> START of page (task->stack) | | | thread_info | ----------------- | | ^ ~ ~ | ~ ~ | | | | | | <---- pt_regs used to END here ----------------- | 1 word GUTTER | ----------------- -> End of page (START of kernel stack) This required special "one-off" considerations in low level code. The root cause is very likely assumption of "empty" SP by the original ARC kernel hackers, despite ARC700 always been "full" SP. So finally RIP one word gutter ! Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
1 parent bed3097 commit 283237a

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-5
lines changed

arch/arc/include/asm/entry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@
252252
ld \out, [\tsk, TASK_THREAD_INFO]
253253

254254
/* Go to end of page where stack begins (grows upwards) */
255-
add2 \out, \out, (THREAD_SIZE - 4)/4 /* one word GUTTER */
255+
add2 \out, \out, (THREAD_SIZE)/4
256256

257257
.endm
258258

arch/arc/include/asm/processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct task_struct;
5050
unsigned long thread_saved_pc(struct task_struct *t);
5151

5252
#define task_pt_regs(p) \
53-
((struct pt_regs *)(THREAD_SIZE - 4 + (void *)task_stack_page(p)) - 1)
53+
((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
5454

5555
/* Free all resources held by a thread. */
5656
#define release_thread(thread) do { } while (0)

arch/arc/include/asm/ptrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct callee_regs {
110110
/* open-coded current_thread_info() */ \
111111
register unsigned long sp asm ("sp"); \
112112
unsigned long pg_start = (sp & ~(THREAD_SIZE - 1)); \
113-
(struct pt_regs *)(pg_start + THREAD_SIZE - 4) - 1; \
113+
(struct pt_regs *)(pg_start + THREAD_SIZE) - 1; \
114114
})
115115

116116
static inline long regs_return_value(struct pt_regs *regs)

arch/arc/kernel/process.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ asmlinkage void ret_from_fork(void);
7575
* ~ ~
7676
* | --to-- | (scratch Regs of user mode)
7777
* | r0 |
78-
* ------------------
79-
* | UNUSED 1 word|
8078
* ------------------ <===== END of PAGE
8179
*/
8280
int copy_thread(unsigned long clone_flags,

0 commit comments

Comments
 (0)