]> Pileus Git - ~andy/linux/commitdiff
ARC: pt_regs update #1: Align pt_regs end with end of kernel stack page
authorVineet Gupta <vgupta@synopsys.com>
Tue, 28 May 2013 04:04:45 +0000 (09:34 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Sat, 22 Jun 2013 13:53:21 +0000 (19:23 +0530)
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>
arch/arc/include/asm/entry.h
arch/arc/include/asm/processor.h
arch/arc/include/asm/ptrace.h
arch/arc/kernel/process.c

index 5bbec8ad8123757d3a4536d77fa0b6112134297e..2b274fa9c5a77330bc26b88d2c36218fa5407dac 100644 (file)
        ld  \out, [\tsk, TASK_THREAD_INFO]
 
        /* Go to end of page where stack begins (grows upwards) */
-       add2 \out, \out, (THREAD_SIZE - 4)/4   /* one word GUTTER */
+       add2 \out, \out, (THREAD_SIZE)/4
 
 .endm
 
index 5f26b2c1cba0074f68123061efb8441061df1f96..81efbcae3839bbb7e1d3d8234269a6d9554da19f 100644 (file)
@@ -50,7 +50,7 @@ struct task_struct;
 unsigned long thread_saved_pc(struct task_struct *t);
 
 #define task_pt_regs(p) \
-       ((struct pt_regs *)(THREAD_SIZE - 4 + (void *)task_stack_page(p)) - 1)
+       ((struct pt_regs *)(THREAD_SIZE + (void *)task_stack_page(p)) - 1)
 
 /* Free all resources held by a thread. */
 #define release_thread(thread) do { } while (0)
index 6179de7e07c21ca4875017adc1107c0e7b0b46c4..f82a3a2201b5dc81b978c998ad92027cde547f14 100644 (file)
@@ -110,7 +110,7 @@ struct callee_regs {
        /* open-coded current_thread_info() */                  \
        register unsigned long sp asm ("sp");                   \
        unsigned long pg_start = (sp & ~(THREAD_SIZE - 1));     \
-       (struct pt_regs *)(pg_start + THREAD_SIZE - 4) - 1;     \
+       (struct pt_regs *)(pg_start + THREAD_SIZE) - 1; \
 })
 
 static inline long regs_return_value(struct pt_regs *regs)
index cad66851e0c4e67eb35bc5bbb3e4b6ec4b8f4929..949bfd5d62a09a62d788b6a553f43b0b8dac7334 100644 (file)
@@ -75,8 +75,6 @@ asmlinkage void ret_from_fork(void);
  * ~                ~
  * |    --to--      |   (scratch Regs of user mode)
  * |     r0         |
- * ------------------
- * |   UNUSED 1 word|
  * ------------------  <===== END of PAGE
  */
 int copy_thread(unsigned long clone_flags,