From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] missing helper - task_stack_page() From: Al Viro Date: 1134132809 -0500 new helper - task_stack_page(task). Returns pointer to the memory object containing task stack; usually thread_info of task sits in the beginning of that object. --- include/asm-m68k/thread_info.h | 1 + include/linux/sched.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) ad165e34cfd9ef9049bdaec4624f24d49251a9e8 diff --git a/include/asm-m68k/thread_info.h b/include/asm-m68k/thread_info.h index 9532ca3..c4d622a 100644 --- a/include/asm-m68k/thread_info.h +++ b/include/asm-m68k/thread_info.h @@ -37,6 +37,7 @@ struct thread_info { #define init_stack (init_thread_union.stack) #define task_thread_info(tsk) (&(tsk)->thread.info) +#define task_stack_page(tsk) ((void *)(tsk)->thread_info) #define current_thread_info() task_thread_info(current) #define __HAVE_THREAD_FUNCTIONS diff --git a/include/linux/sched.h b/include/linux/sched.h index b0ad6f3..0d303f8 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1234,6 +1234,7 @@ static inline void task_unlock(struct ta #ifndef __HAVE_THREAD_FUNCTIONS #define task_thread_info(task) (task)->thread_info +#define task_stack_page(task) ((void*)((task)->thread_info)) static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org) { -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] alpha: task_thread_info() From: Al Viro Date: 1134134163 -0500 use task_thread_info() for accesses to thread_info of task in arch/alpha and include/asm-alpha --- arch/alpha/kernel/process.c | 4 ++-- arch/alpha/kernel/ptrace.c | 38 +++++++++++++++++++------------------- arch/alpha/kernel/smp.c | 2 +- include/asm-alpha/mmu_context.h | 6 +++--- include/asm-alpha/processor.h | 2 +- include/asm-alpha/system.h | 8 ++++---- 6 files changed, 30 insertions(+), 30 deletions(-) 94b23cfafff66f94871f3f12cfd21bced0c54682 diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index a868261..f15a456 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -488,7 +488,7 @@ unsigned long thread_saved_pc(task_t *t) { unsigned long base = (unsigned long)t->thread_info; - unsigned long fp, sp = t->thread_info->pcb.ksp; + unsigned long fp, sp = task_thread_info(t)->pcb.ksp; if (sp > base && sp+6*8 < base + 16*1024) { fp = ((unsigned long*)sp)[6]; @@ -518,7 +518,7 @@ get_wchan(struct task_struct *p) pc = thread_saved_pc(p); if (in_sched_functions(pc)) { - schedule_frame = ((unsigned long *)p->thread_info->pcb.ksp)[6]; + schedule_frame = ((unsigned long *)task_thread_info(p)->pcb.ksp)[6]; return ((unsigned long *)schedule_frame)[12]; } return pc; diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index bbd3753..c83ce5d 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c @@ -103,9 +103,9 @@ get_reg_addr(struct task_struct * task, unsigned long *addr; if (regno == 30) { - addr = &task->thread_info->pcb.usp; + addr = &task_thread_info(task)->pcb.usp; } else if (regno == 65) { - addr = &task->thread_info->pcb.unique; + addr = &task_thread_info(task)->pcb.unique; } else if (regno == 31 || regno > 65) { zero = 0; addr = &zero; @@ -125,7 +125,7 @@ get_reg(struct task_struct * task, unsig if (regno == 63) { unsigned long fpcr = *get_reg_addr(task, regno); unsigned long swcr - = task->thread_info->ieee_state & IEEE_SW_MASK; + = task_thread_info(task)->ieee_state & IEEE_SW_MASK; swcr = swcr_update_status(swcr, fpcr); return fpcr | swcr; } @@ -139,8 +139,8 @@ static int put_reg(struct task_struct *task, unsigned long regno, unsigned long data) { if (regno == 63) { - task->thread_info->ieee_state - = ((task->thread_info->ieee_state & ~IEEE_SW_MASK) + task_thread_info(task)->ieee_state + = ((task_thread_info(task)->ieee_state & ~IEEE_SW_MASK) | (data & IEEE_SW_MASK)); data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data); } @@ -188,35 +188,35 @@ ptrace_set_bpt(struct task_struct * chil * branch (emulation can be tricky for fp branches). */ displ = ((s32)(insn << 11)) >> 9; - child->thread_info->bpt_addr[nsaved++] = pc + 4; + task_thread_info(child)->bpt_addr[nsaved++] = pc + 4; if (displ) /* guard against unoptimized code */ - child->thread_info->bpt_addr[nsaved++] + task_thread_info(child)->bpt_addr[nsaved++] = pc + 4 + displ; DBG(DBG_BPT, ("execing branch\n")); } else if (op_code == 0x1a) { reg_b = (insn >> 16) & 0x1f; - child->thread_info->bpt_addr[nsaved++] = get_reg(child, reg_b); + task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b); DBG(DBG_BPT, ("execing jump\n")); } else { - child->thread_info->bpt_addr[nsaved++] = pc + 4; + task_thread_info(child)->bpt_addr[nsaved++] = pc + 4; DBG(DBG_BPT, ("execing normal insn\n")); } /* install breakpoints: */ for (i = 0; i < nsaved; ++i) { - res = read_int(child, child->thread_info->bpt_addr[i], + res = read_int(child, task_thread_info(child)->bpt_addr[i], (int *) &insn); if (res < 0) return res; - child->thread_info->bpt_insn[i] = insn; + task_thread_info(child)->bpt_insn[i] = insn; DBG(DBG_BPT, (" -> next_pc=%lx\n", - child->thread_info->bpt_addr[i])); - res = write_int(child, child->thread_info->bpt_addr[i], + task_thread_info(child)->bpt_addr[i])); + res = write_int(child, task_thread_info(child)->bpt_addr[i], BREAKINST); if (res < 0) return res; } - child->thread_info->bpt_nsaved = nsaved; + task_thread_info(child)->bpt_nsaved = nsaved; return 0; } @@ -227,9 +227,9 @@ ptrace_set_bpt(struct task_struct * chil int ptrace_cancel_bpt(struct task_struct * child) { - int i, nsaved = child->thread_info->bpt_nsaved; + int i, nsaved = task_thread_info(child)->bpt_nsaved; - child->thread_info->bpt_nsaved = 0; + task_thread_info(child)->bpt_nsaved = 0; if (nsaved > 2) { printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved); @@ -237,8 +237,8 @@ ptrace_cancel_bpt(struct task_struct * c } for (i = 0; i < nsaved; ++i) { - write_int(child, child->thread_info->bpt_addr[i], - child->thread_info->bpt_insn[i]); + write_int(child, task_thread_info(child)->bpt_addr[i], + task_thread_info(child)->bpt_insn[i]); } return (nsaved != 0); } @@ -369,7 +369,7 @@ do_sys_ptrace(long request, long pid, lo if (!valid_signal(data)) break; /* Mark single stepping. */ - child->thread_info->bpt_nsaved = -1; + task_thread_info(child)->bpt_nsaved = -1; clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); child->exit_code = data; wake_up_process(child); diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index da0be34..4b87352 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c @@ -302,7 +302,7 @@ secondary_cpu_start(int cpuid, struct ta + hwrpb->processor_offset + cpuid * hwrpb->processor_size); hwpcb = (struct pcb_struct *) cpu->hwpcb; - ipcb = &idle->thread_info->pcb; + ipcb = &task_thread_info(idle)->pcb; /* Initialize the CPU's HWPCB to something just good enough for us to get started. Immediately after starting, we'll swpctx diff --git a/include/asm-alpha/mmu_context.h b/include/asm-alpha/mmu_context.h index a714d0c..6f92482 100644 --- a/include/asm-alpha/mmu_context.h +++ b/include/asm-alpha/mmu_context.h @@ -156,7 +156,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, /* Always update the PCB ASN. Another thread may have allocated a new mm->context (via flush_tlb_mm) without the ASN serial number wrapping. We have no way to detect when this is needed. */ - next->thread_info->pcb.asn = mmc & HARDWARE_ASN_MASK; + task_thread_info(next)->pcb.asn = mmc & HARDWARE_ASN_MASK; } __EXTERN_INLINE void @@ -235,7 +235,7 @@ init_new_context(struct task_struct *tsk if (cpu_online(i)) mm->context[i] = 0; if (tsk != current) - tsk->thread_info->pcb.ptbr + task_thread_info(tsk)->pcb.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; return 0; } @@ -249,7 +249,7 @@ destroy_context(struct mm_struct *mm) static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { - tsk->thread_info->pcb.ptbr + task_thread_info(tsk)->pcb.ptbr = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; } diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index 059780a..e59a6ec 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -64,7 +64,7 @@ unsigned long get_wchan(struct task_stru (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info))) #define KSTK_ESP(tsk) \ - ((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp) + ((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp) #define cpu_relax() barrier() diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index 050e86d..ba19cf3 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h @@ -131,10 +131,10 @@ struct el_common_EV6_mcheck { extern void halt(void) __attribute__((noreturn)); #define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt)) -#define switch_to(P,N,L) \ - do { \ - (L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \ - check_mmu_context(); \ +#define switch_to(P,N,L) \ + do { \ + (L) = alpha_switch_to(virt_to_phys(&task_thread_info(N)->pcb), (P)); \ + check_mmu_context(); \ } while (0) struct task_struct; -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] alpha: task_stack_page() From: Al Viro Date: 1134135254 -0500 use task_stack_page() for accesses to stack page of task in alpha-specific parts of tree --- arch/alpha/kernel/process.c | 6 +++--- arch/alpha/kernel/ptrace.c | 2 +- include/asm-alpha/ptrace.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 81cb354e3e28fa2a5a73d0580fb2e31e9eb92f20 diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index f15a456..04c5342 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -271,7 +271,7 @@ copy_thread(int nr, unsigned long clone_ { extern void ret_from_fork(void); - struct thread_info *childti = p->thread_info; + struct thread_info *childti = task_thread_info(p); struct pt_regs * childregs; struct switch_stack * childstack, *stack; unsigned long stack_offset, settls; @@ -280,7 +280,7 @@ copy_thread(int nr, unsigned long clone_ if (!(regs->ps & 8)) stack_offset = (PAGE_SIZE-1) & (unsigned long) regs; childregs = (struct pt_regs *) - (stack_offset + PAGE_SIZE + (long) childti); + (stack_offset + PAGE_SIZE + task_stack_page(p)); *childregs = *regs; settls = regs->r20; @@ -487,7 +487,7 @@ out: unsigned long thread_saved_pc(task_t *t) { - unsigned long base = (unsigned long)t->thread_info; + unsigned long base = (unsigned long)task_stack_page(t); unsigned long fp, sp = task_thread_info(t)->pcb.ksp; if (sp > base && sp+6*8 < base + 16*1024) { diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index c83ce5d..67c0cb6 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c @@ -110,7 +110,7 @@ get_reg_addr(struct task_struct * task, zero = 0; addr = &zero; } else { - addr = (void *)task->thread_info + regoff[regno]; + addr = task_stack_page(task) + regoff[regno]; } return addr; } diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h index 072375c..994680b 100644 --- a/include/asm-alpha/ptrace.h +++ b/include/asm-alpha/ptrace.h @@ -76,7 +76,7 @@ struct switch_stack { extern void show_regs(struct pt_regs *); #define alpha_task_regs(task) \ - ((struct pt_regs *) ((long) (task)->thread_info + 2*PAGE_SIZE) - 1) + ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1) #define force_successful_syscall_return() (alpha_task_regs(current)->r0 = 0) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] alpha: task_pt_regs() From: Al Viro Date: 1134135373 -0500 rename alpha_task_regs() to task_pt_regs(), switch open-coded instances to use of the helper. --- arch/alpha/kernel/process.c | 19 ++----------------- arch/alpha/kernel/ptrace.c | 7 +++++++ include/asm-alpha/processor.h | 11 +---------- include/asm-alpha/ptrace.h | 4 ++-- 4 files changed, 12 insertions(+), 29 deletions(-) 3ee044725e08fddc1f70b2d96407c1836420f8c9 diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 04c5342..3b967de 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c @@ -423,30 +423,15 @@ dump_elf_thread(elf_greg_t *dest, struct int dump_elf_task(elf_greg_t *dest, struct task_struct *task) { - struct thread_info *ti; - struct pt_regs *pt; - - ti = task->thread_info; - pt = (struct pt_regs *)((unsigned long)ti + 2*PAGE_SIZE) - 1; - - dump_elf_thread(dest, pt, ti); - + dump_elf_thread(dest, task_pt_regs(task), task_thread_info(task)); return 1; } int dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task) { - struct thread_info *ti; - struct pt_regs *pt; - struct switch_stack *sw; - - ti = task->thread_info; - pt = (struct pt_regs *)((unsigned long)ti + 2*PAGE_SIZE) - 1; - sw = (struct switch_stack *)pt - 1; - + struct switch_stack *sw = (struct switch_stack *)task_pt_regs(task) - 1; memcpy(dest, sw->fp, 32 * 8); - return 1; } diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index 67c0cb6..0f9753f 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c @@ -72,6 +72,13 @@ enum { REG_R0 = 0, REG_F0 = 32, REG_FPCR = 63, REG_PC = 64 }; +#define PT_REG(reg) \ + (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg)) + +#define SW_REG(reg) \ + (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \ + + offsetof(struct switch_stack, reg)) + static int regoff[] = { PT_REG( r0), PT_REG( r1), PT_REG( r2), PT_REG( r3), PT_REG( r4), PT_REG( r5), PT_REG( r6), PT_REG( r7), diff --git a/include/asm-alpha/processor.h b/include/asm-alpha/processor.h index e59a6ec..f414fd0 100644 --- a/include/asm-alpha/processor.h +++ b/include/asm-alpha/processor.h @@ -52,16 +52,7 @@ extern long kernel_thread(int (*fn)(void unsigned long get_wchan(struct task_struct *p); -/* See arch/alpha/kernel/ptrace.c for details. */ -#define PT_REG(reg) \ - (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg)) - -#define SW_REG(reg) \ - (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \ - + offsetof(struct switch_stack, reg)) - -#define KSTK_EIP(tsk) \ - (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info))) +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) #define KSTK_ESP(tsk) \ ((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp) diff --git a/include/asm-alpha/ptrace.h b/include/asm-alpha/ptrace.h index 994680b..9933b8b 100644 --- a/include/asm-alpha/ptrace.h +++ b/include/asm-alpha/ptrace.h @@ -75,10 +75,10 @@ struct switch_stack { #define profile_pc(regs) instruction_pointer(regs) extern void show_regs(struct pt_regs *); -#define alpha_task_regs(task) \ +#define task_pt_regs(task) \ ((struct pt_regs *) (task_stack_page(task) + 2*PAGE_SIZE) - 1) -#define force_successful_syscall_return() (alpha_task_regs(current)->r0 = 0) +#define force_successful_syscall_return() (task_pt_regs(current)->r0 = 0) #endif -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] amd64: task_thread_info() From: Al Viro Date: 1134026975 -0500 --- arch/x86_64/kernel/i387.c | 2 +- arch/x86_64/kernel/i8259.c | 2 +- arch/x86_64/kernel/process.c | 2 +- arch/x86_64/kernel/smpboot.c | 2 +- arch/x86_64/kernel/traps.c | 4 ++-- include/asm-x86_64/i387.h | 8 ++++---- 6 files changed, 10 insertions(+), 10 deletions(-) dffeb08cd56e437414a93056f24e0a6f4168c6c4 diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c index d9b22b6..a5d7e16 100644 --- a/arch/x86_64/kernel/i387.c +++ b/arch/x86_64/kernel/i387.c @@ -95,7 +95,7 @@ int save_i387(struct _fpstate __user *bu if (!used_math()) return 0; clear_used_math(); /* trigger finit */ - if (tsk->thread_info->status & TS_USEDFPU) { + if (task_thread_info(tsk)->status & TS_USEDFPU) { err = save_i387_checking((struct i387_fxsave_struct __user *)buf); if (err) return err; stts(); diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c index 6e5101a..d7123b0 100644 --- a/arch/x86_64/kernel/i8259.c +++ b/arch/x86_64/kernel/i8259.c @@ -133,7 +133,7 @@ static void end_8259A_irq (unsigned int { if (irq > 256) { char var; - printk("return %p stack %p ti %p\n", __builtin_return_address(0), &var, current->thread_info); + printk("return %p stack %p ti %p\n", __builtin_return_address(0), &var, task_thread_info(current)); BUG(); } diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 7519fc5..d0cfcc2 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -435,7 +435,7 @@ int copy_thread(int nr, unsigned long cl p->thread.rsp0 = (unsigned long) (childregs+1); p->thread.userrsp = me->thread.userrsp; - set_ti_thread_flag(p->thread_info, TIF_FORK); + set_tsk_thread_flag(p, TIF_FORK); p->thread.fs = me->thread.fs; p->thread.gs = me->thread.gs; diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index ecbd7b8..e92eec2 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c @@ -785,7 +785,7 @@ do_rest: init_rsp = c_idle.idle->thread.rsp; per_cpu(init_tss,cpu).rsp0 = init_rsp; initial_code = start_secondary; - clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); + clear_tsk_thread_flag(c_idle.idle, TIF_FORK); printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu, cpus_weight(cpu_present_map), diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index bf337f4..96a56c0 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -282,7 +282,7 @@ void show_registers(struct pt_regs *regs printk("CPU %d ", cpu); __show_regs(regs); printk("Process %s (pid: %d, threadinfo %p, task %p)\n", - cur->comm, cur->pid, cur->thread_info, cur); + cur->comm, cur->pid, task_thread_info(cur), cur); /* * When in-kernel, we also print out the stack and code at the @@ -867,7 +867,7 @@ asmlinkage void math_state_restore(void) if (!used_math()) init_fpu(me); restore_fpu_checking(&me->thread.i387.fxsave); - me->thread_info->status |= TS_USEDFPU; + task_thread_info(me)->status |= TS_USEDFPU; } void do_call_debug(struct pt_regs *regs) diff --git a/include/asm-x86_64/i387.h b/include/asm-x86_64/i387.h index aa39cfd..2cd852e 100644 --- a/include/asm-x86_64/i387.h +++ b/include/asm-x86_64/i387.h @@ -30,7 +30,7 @@ extern int save_i387(struct _fpstate __u */ #define unlazy_fpu(tsk) do { \ - if ((tsk)->thread_info->status & TS_USEDFPU) \ + if (task_thread_info(tsk)->status & TS_USEDFPU) \ save_init_fpu(tsk); \ } while (0) @@ -46,9 +46,9 @@ static inline void tolerant_fwait(void) } #define clear_fpu(tsk) do { \ - if ((tsk)->thread_info->status & TS_USEDFPU) { \ + if (task_thread_info(tsk)->status & TS_USEDFPU) { \ tolerant_fwait(); \ - (tsk)->thread_info->status &= ~TS_USEDFPU; \ + task_thread_info(tsk)->status &= ~TS_USEDFPU; \ stts(); \ } \ } while (0) @@ -135,7 +135,7 @@ static inline void save_init_fpu( struct { asm volatile( "rex64 ; fxsave %0 ; fnclex" : "=m" (tsk->thread.i387.fxsave)); - tsk->thread_info->status &= ~TS_USEDFPU; + task_thread_info(tsk)->status &= ~TS_USEDFPU; stts(); } -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] amd64: task_pt_regs() From: Al Viro Date: 1134473589 -0500 --- arch/x86_64/ia32/ia32_binfmt.c | 7 +++---- arch/x86_64/ia32/ptrace32.c | 6 +++--- arch/x86_64/kernel/process.c | 3 +-- arch/x86_64/kernel/ptrace.c | 10 ++-------- arch/x86_64/kernel/traps.c | 2 +- include/asm-x86_64/compat.h | 2 +- include/asm-x86_64/processor.h | 4 ++-- 7 files changed, 13 insertions(+), 21 deletions(-) d6ba6dac5141dfabce1170cdf3c97100851fd00d diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c index 2b760d0..029bdda 100644 --- a/arch/x86_64/ia32/ia32_binfmt.c +++ b/arch/x86_64/ia32/ia32_binfmt.c @@ -197,8 +197,7 @@ static inline void elf_core_copy_regs(el static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) { - struct pt_regs *pp = (struct pt_regs *)(t->thread.rsp0); - --pp; + struct pt_regs *pp = task_pt_regs(t); ELF_CORE_COPY_REGS((*elfregs), pp); /* fix wrong segments */ (*elfregs)[7] = t->thread.ds; @@ -217,7 +216,7 @@ elf_core_copy_task_fpregs(struct task_st if (!tsk_used_math(tsk)) return 0; if (!regs) - regs = ((struct pt_regs *)tsk->thread.rsp0) - 1; + regs = task_pt_regs(tsk); if (tsk == current) unlazy_fpu(tsk); set_fs(KERNEL_DS); @@ -233,7 +232,7 @@ elf_core_copy_task_fpregs(struct task_st static inline int elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) { - struct pt_regs *regs = ((struct pt_regs *)(t->thread.rsp0))-1; + struct pt_regs *regs = task_pt_regs(t); if (!tsk_used_math(t)) return 0; if (t == current) diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c index 2a925e2..4fec831 100644 --- a/arch/x86_64/ia32/ptrace32.c +++ b/arch/x86_64/ia32/ptrace32.c @@ -38,7 +38,7 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val) { int i; - __u64 *stack = (__u64 *)(child->thread.rsp0 - sizeof(struct pt_regs)); + __u64 *stack = (__u64 *)task_pt_regs(child); switch (regno) { case offsetof(struct user32, regs.fs): @@ -134,7 +134,7 @@ static int putreg32(struct task_struct * static int getreg32(struct task_struct *child, unsigned regno, u32 *val) { - __u64 *stack = (__u64 *)(child->thread.rsp0 - sizeof(struct pt_regs)); + __u64 *stack = (__u64 *)task_pt_regs(child); switch (regno) { case offsetof(struct user32, regs.fs): @@ -258,7 +258,7 @@ asmlinkage long sys32_ptrace(long reques if (!child) return ret; - childregs = (struct pt_regs *)(child->thread.rsp0 - sizeof(struct pt_regs)); + childregs = task_pt_regs(child); switch (request) { case PTRACE_PEEKDATA: diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index d0cfcc2..08e578f 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -794,8 +794,7 @@ int dump_task_regs(struct task_struct *t { struct pt_regs *pp, ptregs; - pp = (struct pt_regs *)(tsk->thread.rsp0); - --pp; + pp = task_pt_regs(tsk); ptregs = *pp; ptregs.cs &= 0xffff; diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c index a87b6ce..395b7e7 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c @@ -64,12 +64,6 @@ static inline unsigned long get_stack_lo return (*((unsigned long *)stack)); } -static inline struct pt_regs *get_child_regs(struct task_struct *task) -{ - struct pt_regs *regs = (void *)task->thread.rsp0; - return regs - 1; -} - /* * this routine will put a word on the processes privileged stack. * the offset is how far from the base addr as stored in the TSS. @@ -167,7 +161,7 @@ static int is_at_popf(struct task_struct static void set_singlestep(struct task_struct *child) { - struct pt_regs *regs = get_child_regs(child); + struct pt_regs *regs = task_pt_regs(child); /* * Always set TIF_SINGLESTEP - this guarantees that @@ -205,7 +199,7 @@ static void clear_singlestep(struct task /* But touch TF only if it was set by us.. */ if (child->ptrace & PT_DTRACE) { - struct pt_regs *regs = get_child_regs(child); + struct pt_regs *regs = task_pt_regs(child); regs->eflags &= ~TRAP_FLAG; child->ptrace &= ~PT_DTRACE; } diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index 96a56c0..4926378 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -620,7 +620,7 @@ asmlinkage struct pt_regs *sync_regs(str ; /* Exception from user space */ else if (user_mode(eregs)) - regs = ((struct pt_regs *)current->thread.rsp0) - 1; + regs = task_pt_regs(current); /* Exception from kernel and interrupts are enabled. Move to kernel process stack. */ else if (eregs->eflags & X86_EFLAGS_IF) diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h index f0155c3..e263890 100644 --- a/include/asm-x86_64/compat.h +++ b/include/asm-x86_64/compat.h @@ -198,7 +198,7 @@ static inline compat_uptr_t ptr_to_compa static __inline__ void __user *compat_alloc_user_space(long len) { - struct pt_regs *regs = (void *)current->thread.rsp0 - sizeof(struct pt_regs); + struct pt_regs *regs = task_pt_regs(current); return (void __user *)regs->rsp - len; } diff --git a/include/asm-x86_64/processor.h b/include/asm-x86_64/processor.h index 4861246..ed068bb 100644 --- a/include/asm-x86_64/processor.h +++ b/include/asm-x86_64/processor.h @@ -317,8 +317,8 @@ extern long kernel_thread(int (*fn)(void #define thread_saved_pc(t) (*(unsigned long *)((t)->thread.rsp - 8)) extern unsigned long get_wchan(struct task_struct *p); -#define KSTK_EIP(tsk) \ - (((struct pt_regs *)(tsk->thread.rsp0 - sizeof(struct pt_regs)))->rip) +#define task_pt_regs(tsk) ((struct pt_regs *)(tsk)->thread.rsp0 - 1) +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->rip) #define KSTK_ESP(tsk) -1 /* sorry. doesn't work for syscall. */ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] amd64: task_stack_page() From: Al Viro Date: 1134150935 -0500 --- arch/x86_64/kernel/process.c | 6 +++--- arch/x86_64/kernel/smpboot.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 95d8655893973ea50a96ef591d1981865ae3b459 diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c index 08e578f..334cecc 100644 --- a/arch/x86_64/kernel/process.c +++ b/arch/x86_64/kernel/process.c @@ -423,7 +423,7 @@ int copy_thread(int nr, unsigned long cl struct task_struct *me = current; childregs = ((struct pt_regs *) - (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; + (THREAD_SIZE + task_stack_page(p))) - 1; *childregs = *regs; childregs->rax = 0; @@ -562,7 +562,7 @@ __switch_to(struct task_struct *prev_p, write_pda(oldrsp, next->userrsp); write_pda(pcurrent, next_p); write_pda(kernelstack, - (unsigned long)next_p->thread_info + THREAD_SIZE - PDA_STACKOFFSET); + task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); /* * Now maybe reload the debug registers @@ -676,7 +676,7 @@ unsigned long get_wchan(struct task_stru if (!p || p == current || p->state==TASK_RUNNING) return 0; - stack = (unsigned long)p->thread_info; + stack = (unsigned long)task_stack_page(p); if (p->thread.rsp < stack || p->thread.rsp > stack+THREAD_SIZE) return 0; fp = *(u64 *)(p->thread.rsp); diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index e92eec2..fe94a69 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c @@ -747,7 +747,7 @@ static int __cpuinit do_boot_cpu(int cpu if (c_idle.idle) { c_idle.idle->thread.rsp = (unsigned long) (((struct pt_regs *) - (THREAD_SIZE + (unsigned long) c_idle.idle->thread_info)) - 1); + (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1); init_idle(c_idle.idle, cpu); goto do_rest; } -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] i386: task_thread_info() From: Al Viro Date: 1134016012 -0500 --- arch/i386/kernel/process.c | 4 ++-- arch/i386/kernel/vm86.c | 2 +- include/asm-i386/i387.h | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) 08de59b874265b4fcebf756514140f38a82f77af diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index df6c2bc..0786f06 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -610,8 +610,8 @@ static inline void disable_tsc(struct ta * gcc should eliminate the ->thread_info dereference if * has_secure_computing returns 0 at compile time (SECCOMP=n). */ - prev = prev_p->thread_info; - next = next_p->thread_info; + prev = task_thread_info(prev_p); + next = task_thread_info(next_p); if (has_secure_computing(prev) || has_secure_computing(next)) { /* slow path here */ diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c index fc19935..312ee0b 100644 --- a/arch/i386/kernel/vm86.c +++ b/arch/i386/kernel/vm86.c @@ -310,7 +310,7 @@ static void do_sys_vm86(struct kernel_vm "movl %1,%%ebp\n\t" "jmp resume_userspace" : /* no outputs */ - :"r" (&info->regs), "r" (tsk->thread_info) : "ax"); + :"r" (&info->regs), "r" (task_thread_info(tsk)) : "ax"); /* we never return here */ } diff --git a/include/asm-i386/i387.h b/include/asm-i386/i387.h index 6747006..152d0ba 100644 --- a/include/asm-i386/i387.h +++ b/include/asm-i386/i387.h @@ -49,19 +49,19 @@ static inline void __save_init_fpu( stru X86_FEATURE_FXSR, "m" (tsk->thread.i387.fxsave) :"memory"); - tsk->thread_info->status &= ~TS_USEDFPU; + task_thread_info(tsk)->status &= ~TS_USEDFPU; } #define __unlazy_fpu( tsk ) do { \ - if ((tsk)->thread_info->status & TS_USEDFPU) \ + if (task_thread_info(tsk)->status & TS_USEDFPU) \ save_init_fpu( tsk ); \ } while (0) #define __clear_fpu( tsk ) \ do { \ - if ((tsk)->thread_info->status & TS_USEDFPU) { \ + if (task_thread_info(tsk)->status & TS_USEDFPU) { \ asm volatile("fnclex ; fwait"); \ - (tsk)->thread_info->status &= ~TS_USEDFPU; \ + task_thread_info(tsk)->status &= ~TS_USEDFPU; \ stts(); \ } \ } while (0) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] i386: use task_pt_regs() From: Al Viro Date: 1134021015 -0500 --- arch/i386/kernel/process.c | 5 ++--- arch/i386/kernel/smpboot.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) 2b36d73ac1d7ca4679d13241878b8fb17fb187b7 diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index 0786f06..c0b6399 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -435,7 +435,7 @@ int copy_thread(int nr, unsigned long cl struct task_struct *tsk; int err; - childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; + childregs = task_pt_regs(p); /* * The below -8 is to reserve 8 bytes on top of the ring0 stack. * This is necessary to guarantee that the entire "struct pt_regs" @@ -553,8 +553,7 @@ int dump_task_regs(struct task_struct *t { struct pt_regs ptregs; - ptregs = *(struct pt_regs *) - ((unsigned long)tsk->thread_info+THREAD_SIZE - sizeof(ptregs)); + ptregs = *task_pt_regs(tsk); ptregs.xcs &= 0xffff; ptregs.xds &= 0xffff; ptregs.xes &= 0xffff; diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 9ed449a..b96b29f 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c @@ -875,8 +875,7 @@ static inline struct task_struct * alloc /* initialize thread_struct. we really want to avoid destroy * idle tread */ - idle->thread.esp = (unsigned long)(((struct pt_regs *) - (THREAD_SIZE + (unsigned long) idle->thread_info)) - 1); + idle->thread.esp = (unsigned long)task_pt_regs(idle); init_idle(idle, cpu); return idle; } -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] i386: task_stack_page() From: Al Viro Date: 1134151657 -0500 --- arch/i386/kernel/process.c | 2 +- include/asm-i386/processor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 7e6d7147b048f28eedc1db432c79a161af80ab6f diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c index c0b6399..f207b70 100644 --- a/arch/i386/kernel/process.c +++ b/arch/i386/kernel/process.c @@ -795,7 +795,7 @@ unsigned long get_wchan(struct task_stru int count = 0; if (!p || p == current || p->state == TASK_RUNNING) return 0; - stack_page = (unsigned long)p->thread_info; + stack_page = (unsigned long)task_stack_page(p); esp = p->thread.esp; if (!stack_page || esp < stack_page || esp > top_esp+stack_page) return 0; diff --git a/include/asm-i386/processor.h b/include/asm-i386/processor.h index 5c96cf6..6d7eb90 100644 --- a/include/asm-i386/processor.h +++ b/include/asm-i386/processor.h @@ -560,7 +560,7 @@ unsigned long get_wchan(struct task_stru #define task_pt_regs(task) \ ({ \ struct pt_regs *__regs__; \ - __regs__ = (struct pt_regs *)KSTK_TOP((task)->thread_info); \ + __regs__ = (struct pt_regs *)KSTK_TOP(task_stack_page(task)); \ __regs__ - 1; \ }) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sparc64: task_thread_info() From: Al Viro Date: 1134140710 -0500 --- arch/sparc64/kernel/process.c | 4 ++-- arch/sparc64/kernel/ptrace.c | 34 +++++++++++++++++----------------- arch/sparc64/kernel/setup.c | 2 +- arch/sparc64/kernel/smp.c | 2 +- include/asm-sparc64/mmu_context.h | 2 +- include/asm-sparc64/system.h | 4 ++-- 6 files changed, 24 insertions(+), 24 deletions(-) 4795f47c0c614c48bd8d28a834b68aad84f59f6e diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 02f9dec..1bc7724 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -390,7 +390,7 @@ void show_regs32(struct pt_regs32 *regs) unsigned long thread_saved_pc(struct task_struct *tsk) { - struct thread_info *ti = tsk->thread_info; + struct thread_info *ti = task_thread_info(tsk); unsigned long ret = 0xdeadbeefUL; if (ti && ti->ksp) { @@ -847,7 +847,7 @@ unsigned long get_wchan(struct task_stru thread_info_base = (unsigned long) task->thread_info; bias = STACK_BIAS; - fp = task->thread_info->ksp + bias; + fp = task_thread_info(task)->ksp + bias; do { /* Bogus frame pointer? */ diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index 774ecbb..7cdb897 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c @@ -348,7 +348,7 @@ asmlinkage void do_ptrace(struct pt_regs unsigned long tpc = cregs->tpc; int rval; - if ((child->thread_info->flags & _TIF_32BIT) != 0) + if ((task_thread_info(child)->flags & _TIF_32BIT) != 0) tpc &= 0xffffffff; if (__put_user(cregs->tstate, (&pregs->tstate)) || __put_user(tpc, (&pregs->tpc)) || @@ -419,7 +419,7 @@ asmlinkage void do_ptrace(struct pt_regs pt_error_return(regs, EFAULT); goto out_tsk; } - if ((child->thread_info->flags & _TIF_32BIT) != 0) { + if ((task_thread_info(child)->flags & _TIF_32BIT) != 0) { tpc &= 0xffffffff; tnpc &= 0xffffffff; } @@ -454,11 +454,11 @@ asmlinkage void do_ptrace(struct pt_regs } fpq[16]; }; struct fps __user *fps = (struct fps __user *) addr; - unsigned long *fpregs = child->thread_info->fpregs; + unsigned long *fpregs = task_thread_info(child)->fpregs; if (copy_to_user(&fps->regs[0], fpregs, (32 * sizeof(unsigned int))) || - __put_user(child->thread_info->xfsr[0], (&fps->fsr)) || + __put_user(task_thread_info(child)->xfsr[0], (&fps->fsr)) || __put_user(0, (&fps->fpqd)) || __put_user(0, (&fps->flags)) || __put_user(0, (&fps->extra)) || @@ -476,11 +476,11 @@ asmlinkage void do_ptrace(struct pt_regs unsigned long fsr; }; struct fps __user *fps = (struct fps __user *) addr; - unsigned long *fpregs = child->thread_info->fpregs; + unsigned long *fpregs = task_thread_info(child)->fpregs; if (copy_to_user(&fps->regs[0], fpregs, (64 * sizeof(unsigned int))) || - __put_user(child->thread_info->xfsr[0], (&fps->fsr))) { + __put_user(task_thread_info(child)->xfsr[0], (&fps->fsr))) { pt_error_return(regs, EFAULT); goto out_tsk; } @@ -501,7 +501,7 @@ asmlinkage void do_ptrace(struct pt_regs } fpq[16]; }; struct fps __user *fps = (struct fps __user *) addr; - unsigned long *fpregs = child->thread_info->fpregs; + unsigned long *fpregs = task_thread_info(child)->fpregs; unsigned fsr; if (copy_from_user(fpregs, &fps->regs[0], @@ -510,11 +510,11 @@ asmlinkage void do_ptrace(struct pt_regs pt_error_return(regs, EFAULT); goto out_tsk; } - child->thread_info->xfsr[0] &= 0xffffffff00000000UL; - child->thread_info->xfsr[0] |= fsr; - if (!(child->thread_info->fpsaved[0] & FPRS_FEF)) - child->thread_info->gsr[0] = 0; - child->thread_info->fpsaved[0] |= (FPRS_FEF | FPRS_DL); + task_thread_info(child)->xfsr[0] &= 0xffffffff00000000UL; + task_thread_info(child)->xfsr[0] |= fsr; + if (!(task_thread_info(child)->fpsaved[0] & FPRS_FEF)) + task_thread_info(child)->gsr[0] = 0; + task_thread_info(child)->fpsaved[0] |= (FPRS_FEF | FPRS_DL); pt_succ_return(regs, 0); goto out_tsk; } @@ -525,17 +525,17 @@ asmlinkage void do_ptrace(struct pt_regs unsigned long fsr; }; struct fps __user *fps = (struct fps __user *) addr; - unsigned long *fpregs = child->thread_info->fpregs; + unsigned long *fpregs = task_thread_info(child)->fpregs; if (copy_from_user(fpregs, &fps->regs[0], (64 * sizeof(unsigned int))) || - __get_user(child->thread_info->xfsr[0], (&fps->fsr))) { + __get_user(task_thread_info(child)->xfsr[0], (&fps->fsr))) { pt_error_return(regs, EFAULT); goto out_tsk; } - if (!(child->thread_info->fpsaved[0] & FPRS_FEF)) - child->thread_info->gsr[0] = 0; - child->thread_info->fpsaved[0] |= (FPRS_FEF | FPRS_DL | FPRS_DU); + if (!(task_thread_info(child)->fpsaved[0] & FPRS_FEF)) + task_thread_info(child)->gsr[0] = 0; + task_thread_info(child)->fpsaved[0] |= (FPRS_FEF | FPRS_DL | FPRS_DU); pt_succ_return(regs, 0); goto out_tsk; } diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c index 4818053..2507458 100644 --- a/arch/sparc64/kernel/setup.c +++ b/arch/sparc64/kernel/setup.c @@ -520,7 +520,7 @@ void __init setup_arch(char **cmdline_p) rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0); #endif - init_task.thread_info->kregs = &fake_swapper_regs; + task_thread_info(&init_task)->kregs = &fake_swapper_regs; #ifdef CONFIG_IP_PNP if (!ic_set_manually) { diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index 6efc03d..1fb6323 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c @@ -335,7 +335,7 @@ static int __devinit smp_boot_one_cpu(un p = fork_idle(cpu); callin_flag = 0; - cpu_new_thread = p->thread_info; + cpu_new_thread = task_thread_info(p); cpu_set(cpu, cpu_callout_map); cpu_find_by_mid(cpu, &cpu_node); diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h index 08ba72d..57ee7b3 100644 --- a/include/asm-sparc64/mmu_context.h +++ b/include/asm-sparc64/mmu_context.h @@ -60,7 +60,7 @@ do { \ register unsigned long pgd_cache asm("o4"); \ paddr = __pa((__mm)->pgd); \ pgd_cache = 0UL; \ - if ((__tsk)->thread_info->flags & _TIF_32BIT) \ + if (task_thread_info(__tsk)->flags & _TIF_32BIT) \ pgd_cache = get_pgd_cache((__mm)->pgd); \ __asm__ __volatile__("wrpr %%g0, 0x494, %%pstate\n\t" \ "mov %3, %%g4\n\t" \ diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h index b541752..f380da0 100644 --- a/include/asm-sparc64/system.h +++ b/include/asm-sparc64/system.h @@ -212,7 +212,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) /* If you are tempted to conditionalize the following */ \ /* so that ASI is only written if it changes, think again. */ \ __asm__ __volatile__("wr %%g0, %0, %%asi" \ - : : "r" (__thread_flag_byte_ptr(next->thread_info)[TI_FLAG_BYTE_CURRENT_DS]));\ + : : "r" (__thread_flag_byte_ptr(task_thread_info(next))[TI_FLAG_BYTE_CURRENT_DS]));\ __asm__ __volatile__( \ "mov %%g4, %%g7\n\t" \ "wrpr %%g0, 0x95, %%pstate\n\t" \ @@ -242,7 +242,7 @@ do { if (test_thread_flag(TIF_PERFCTR)) "b,a ret_from_syscall\n\t" \ "1:\n\t" \ : "=&r" (last) \ - : "0" (next->thread_info), \ + : "0" (task_thread_info(next)), \ "i" (TI_WSTATE), "i" (TI_KSP), "i" (TI_NEW_CHILD), \ "i" (TI_CWP), "i" (TI_TASK) \ : "cc", \ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sparc64: task_stack_page() From: Al Viro Date: 1134141328 -0500 --- arch/sparc64/kernel/process.c | 6 +++--- arch/sparc64/kernel/traps.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) 8293b72f0dbad5c9082b22f40f3b668bc4bf2ef4 diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c index 1bc7724..1dc3650 100644 --- a/arch/sparc64/kernel/process.c +++ b/arch/sparc64/kernel/process.c @@ -616,11 +616,11 @@ int copy_thread(int nr, unsigned long cl unsigned long unused, struct task_struct *p, struct pt_regs *regs) { - struct thread_info *t = p->thread_info; + struct thread_info *t = task_thread_info(p); char *child_trap_frame; /* Calculate offset to stack_frame & pt_regs */ - child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); + child_trap_frame = task_stack_page(p) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) | @@ -845,7 +845,7 @@ unsigned long get_wchan(struct task_stru task->state == TASK_RUNNING) goto out; - thread_info_base = (unsigned long) task->thread_info; + thread_info_base = (unsigned long) task_stack_page(task); bias = STACK_BIAS; fp = task_thread_info(task)->ksp + bias; diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c index 5570e7b..8d44ae5 100644 --- a/arch/sparc64/kernel/traps.c +++ b/arch/sparc64/kernel/traps.c @@ -1808,7 +1808,7 @@ static void user_instruction_dump (unsig void show_stack(struct task_struct *tsk, unsigned long *_ksp) { unsigned long pc, fp, thread_base, ksp; - struct thread_info *tp = tsk->thread_info; + void *tp = task_stack_page(tsk); struct reg_window *rw; int count = 0; @@ -1862,7 +1862,7 @@ static inline int is_kernel_stack(struct return 0; } - thread_base = (unsigned long) task->thread_info; + thread_base = (unsigned long) task_stack_page(task); thread_end = thread_base + sizeof(union thread_union); if (rw_addr >= thread_base && rw_addr < thread_end && -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sparc64: task_pt_regs() From: Al Viro Date: 1134141371 -0500 --- arch/sparc64/kernel/ptrace.c | 12 ++++++------ include/asm-sparc64/elf.h | 2 +- include/asm-sparc64/processor.h | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) a9f63797aa2501ec64b135fc822dc4b3a3533e61 diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index 7cdb897..6003f03 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c @@ -320,7 +320,7 @@ asmlinkage void do_ptrace(struct pt_regs case PTRACE_GETREGS: { struct pt_regs32 __user *pregs = (struct pt_regs32 __user *) addr; - struct pt_regs *cregs = child->thread_info->kregs; + struct pt_regs *cregs = task_pt_regs(child); int rval; if (__put_user(tstate_to_psr(cregs->tstate), (&pregs->psr)) || @@ -344,7 +344,7 @@ asmlinkage void do_ptrace(struct pt_regs case PTRACE_GETREGS64: { struct pt_regs __user *pregs = (struct pt_regs __user *) addr; - struct pt_regs *cregs = child->thread_info->kregs; + struct pt_regs *cregs = task_pt_regs(child); unsigned long tpc = cregs->tpc; int rval; @@ -372,7 +372,7 @@ asmlinkage void do_ptrace(struct pt_regs case PTRACE_SETREGS: { struct pt_regs32 __user *pregs = (struct pt_regs32 __user *) addr; - struct pt_regs *cregs = child->thread_info->kregs; + struct pt_regs *cregs = task_pt_regs(child); unsigned int psr, pc, npc, y; int i; @@ -405,7 +405,7 @@ asmlinkage void do_ptrace(struct pt_regs case PTRACE_SETREGS64: { struct pt_regs __user *pregs = (struct pt_regs __user *) addr; - struct pt_regs *cregs = child->thread_info->kregs; + struct pt_regs *cregs = task_pt_regs(child); unsigned long tstate, tpc, tnpc, y; int i; @@ -586,8 +586,8 @@ asmlinkage void do_ptrace(struct pt_regs #ifdef DEBUG_PTRACE printk("CONT: %s [%d]: set exit_code = %x %lx %lx\n", child->comm, child->pid, child->exit_code, - child->thread_info->kregs->tpc, - child->thread_info->kregs->tnpc); + task_pt_regs(child)->tpc, + task_pt_regs(child)->tnpc); #endif wake_up_process(child); diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index 9145811..69539a8 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h @@ -119,7 +119,7 @@ typedef struct { #endif #define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ - ({ ELF_CORE_COPY_REGS((*(__elf_regs)), (__tsk)->thread_info->kregs); 1; }) + ({ ELF_CORE_COPY_REGS((*(__elf_regs)), task_pt_regs(__tsk)); 1; }) /* * This is used to ensure we don't load something for the wrong architecture. diff --git a/include/asm-sparc64/processor.h b/include/asm-sparc64/processor.h index 3169f3e..cd8d9b4 100644 --- a/include/asm-sparc64/processor.h +++ b/include/asm-sparc64/processor.h @@ -186,8 +186,9 @@ extern pid_t kernel_thread(int (*fn)(voi extern unsigned long get_wchan(struct task_struct *task); -#define KSTK_EIP(tsk) ((tsk)->thread_info->kregs->tpc) -#define KSTK_ESP(tsk) ((tsk)->thread_info->kregs->u_regs[UREG_FP]) +#define task_pt_regs(tsk) (task_thread_info(tsk)->kregs) +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc) +#define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP]) #define cpu_relax() barrier() -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sh: task_pt_regs() From: Al Viro Date: 1134032629 -0500 --- arch/sh/kernel/process.c | 42 ++++++------------------------------------ arch/sh/kernel/ptrace.c | 14 ++------------ include/asm-sh/ptrace.h | 10 ++++++++++ 3 files changed, 18 insertions(+), 48 deletions(-) 4bd685160e1de014503c1abcfae8907f76797c79 diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index fd4f240..6a86fe3 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c @@ -191,13 +191,8 @@ void flush_thread(void) { #if defined(CONFIG_SH_FPU) struct task_struct *tsk = current; - struct pt_regs *regs = (struct pt_regs *) - ((unsigned long)tsk->thread_info - + THREAD_SIZE - sizeof(struct pt_regs) - - sizeof(unsigned long)); - /* Forget lazy FPU state */ - clear_fpu(tsk, regs); + clear_fpu(tsk, task_pt_regs(tsk)); clear_used_math(); #endif } @@ -232,13 +227,7 @@ int dump_task_regs(struct task_struct *t { struct pt_regs ptregs; - ptregs = *(struct pt_regs *) - ((unsigned long)tsk->thread_info + THREAD_SIZE - - sizeof(struct pt_regs) -#ifdef CONFIG_SH_DSP - - sizeof(struct pt_dspregs) -#endif - - sizeof(unsigned long)); + ptregs = *task_pt_regs(tsk); elf_core_copy_regs(regs, &ptregs); return 1; @@ -252,11 +241,7 @@ dump_task_fpu (struct task_struct *tsk, #if defined(CONFIG_SH_FPU) fpvalid = !!tsk_used_math(tsk); if (fpvalid) { - struct pt_regs *regs = (struct pt_regs *) - ((unsigned long)tsk->thread_info - + THREAD_SIZE - sizeof(struct pt_regs) - - sizeof(unsigned long)); - unlazy_fpu(tsk, regs); + unlazy_fpu(tsk, task_pt_regs(tsk)); memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu)); } #endif @@ -279,12 +264,7 @@ int copy_thread(int nr, unsigned long cl copy_to_stopped_child_used_math(p); #endif - childregs = ((struct pt_regs *) - (THREAD_SIZE + (unsigned long) p->thread_info) -#ifdef CONFIG_SH_DSP - - sizeof(struct pt_dspregs) -#endif - - sizeof(unsigned long)) - 1; + childregs = task_pt_regs(p); *childregs = *regs; if (user_mode(regs)) { @@ -353,11 +333,7 @@ ubc_set_tracing(int asid, unsigned long struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next) { #if defined(CONFIG_SH_FPU) - struct pt_regs *regs = (struct pt_regs *) - ((unsigned long)prev->thread_info - + THREAD_SIZE - sizeof(struct pt_regs) - - sizeof(unsigned long)); - unlazy_fpu(prev, regs); + unlazy_fpu(prev, task_pt_regs(prev)); #endif #ifdef CONFIG_PREEMPT @@ -366,13 +342,7 @@ struct task_struct *__switch_to(struct t struct pt_regs *regs; local_irq_save(flags); - regs = (struct pt_regs *) - ((unsigned long)prev->thread_info - + THREAD_SIZE - sizeof(struct pt_regs) -#ifdef CONFIG_SH_DSP - - sizeof(struct pt_dspregs) -#endif - - sizeof(unsigned long)); + regs = task_pt_regs(prev); if (user_mode(regs) && regs->regs[15] >= 0xc0000000) { int offset = (int)regs->regs[15]; diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c index 1a8be06..3887b4f 100644 --- a/arch/sh/kernel/ptrace.c +++ b/arch/sh/kernel/ptrace.c @@ -41,12 +41,7 @@ static inline int get_stack_long(struct { unsigned char *stack; - stack = (unsigned char *) - task->thread_info + THREAD_SIZE - sizeof(struct pt_regs) -#ifdef CONFIG_SH_DSP - - sizeof(struct pt_dspregs) -#endif - - sizeof(unsigned long); + stack = (unsigned char *)task_pt_regs(task); stack += offset; return (*((int *)stack)); } @@ -59,12 +54,7 @@ static inline int put_stack_long(struct { unsigned char *stack; - stack = (unsigned char *) - task->thread_info + THREAD_SIZE - sizeof(struct pt_regs) -#ifdef CONFIG_SH_DSP - - sizeof(struct pt_dspregs) -#endif - - sizeof(unsigned long); + stack = (unsigned char *)task_pt_regs(task); stack += offset; *(unsigned long *) stack = data; return 0; diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h index 0f75e16..85aa0f4 100644 --- a/include/asm-sh/ptrace.h +++ b/include/asm-sh/ptrace.h @@ -91,6 +91,16 @@ struct pt_dspregs { #define instruction_pointer(regs) ((regs)->pc) extern void show_regs(struct pt_regs *); +#ifdef CONFIG_SH_DSP +#define task_pt_regs(task) \ + ((struct pt_regs *) ((unsigned long)(task)->thread_info + THREAD_SIZE \ + - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1) +#else +#define task_pt_regs(task) \ + ((struct pt_regs *) ((unsigned long)(task)->thread_info + THREAD_SIZE \ + - sizeof(unsigned long)) - 1) +#endif + static inline unsigned long profile_pc(struct pt_regs *regs) { unsigned long pc = instruction_pointer(regs); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sh: task_thread_info() From: Al Viro Date: 1134032711 -0500 --- arch/sh/kernel/process.c | 2 +- arch/sh/kernel/smp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) e0a56c118c283335db25ba88d5709dd67a2dac63 diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 6a86fe3..830e842 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c @@ -362,7 +362,7 @@ struct task_struct *__switch_to(struct t */ asm volatile("ldc %0, r7_bank" : /* no output */ - : "r" (next->thread_info)); + : "r" (task_thread_info(next))); #ifdef CONFIG_MMU /* If no tasks are using the UBC, we're done */ diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 59e49b1..62c7d1c 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c @@ -103,7 +103,7 @@ int __cpu_up(unsigned int cpu) if (IS_ERR(tsk)) panic("Failed forking idle task for cpu %d\n", cpu); - tsk->thread_info->cpu = cpu; + task_thread_info(tsk)->cpu = cpu; cpu_set(cpu, cpu_online_map); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sh: task_stack_page() From: Al Viro Date: 1134150005 -0500 --- arch/sh/kernel/process.c | 2 +- include/asm-sh/ptrace.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) d3dc2574882a1358c0af8db8bcf214e7ba7f8378 diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c index 830e842..e2854ca 100644 --- a/arch/sh/kernel/process.c +++ b/arch/sh/kernel/process.c @@ -270,7 +270,7 @@ int copy_thread(int nr, unsigned long cl if (user_mode(regs)) { childregs->regs[15] = usp; } else { - childregs->regs[15] = (unsigned long)p->thread_info + THREAD_SIZE; + childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE; } if (clone_flags & CLONE_SETTLS) { childregs->gbr = childregs->regs[0]; diff --git a/include/asm-sh/ptrace.h b/include/asm-sh/ptrace.h index 85aa0f4..792fc35 100644 --- a/include/asm-sh/ptrace.h +++ b/include/asm-sh/ptrace.h @@ -93,11 +93,11 @@ extern void show_regs(struct pt_regs *); #ifdef CONFIG_SH_DSP #define task_pt_regs(task) \ - ((struct pt_regs *) ((unsigned long)(task)->thread_info + THREAD_SIZE \ + ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ - sizeof(struct pt_dspregs) - sizeof(unsigned long)) - 1) #else #define task_pt_regs(task) \ - ((struct pt_regs *) ((unsigned long)(task)->thread_info + THREAD_SIZE \ + ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE \ - sizeof(unsigned long)) - 1) #endif -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sparc: task_thread_info() From: Al Viro Date: 1134103413 -0500 --- arch/sparc/kernel/process.c | 4 ++-- arch/sparc/kernel/ptrace.c | 4 ++-- arch/sparc/kernel/sun4d_smp.c | 2 +- arch/sparc/kernel/sun4m_smp.c | 2 +- arch/sparc/kernel/traps.c | 4 ++-- include/asm-sparc/system.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) 964a0e632120cd9c305be039d967e1f18c075f31 diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index ea86474..7eebb08 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -337,7 +337,7 @@ EXPORT_SYMBOL(dump_stack); */ unsigned long thread_saved_pc(struct task_struct *tsk) { - return tsk->thread_info->kpc; + return task_thread_info(tsk)->kpc; } /* @@ -724,7 +724,7 @@ unsigned long get_wchan(struct task_stru task->state == TASK_RUNNING) goto out; - fp = task->thread_info->ksp + bias; + fp = task_thread_info(task)->ksp + bias; do { /* Bogus frame pointer? */ if (fp < (task_base + sizeof(struct thread_info)) || diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c index 475c4c1..34705a8 100644 --- a/arch/sparc/kernel/ptrace.c +++ b/arch/sparc/kernel/ptrace.c @@ -75,7 +75,7 @@ static inline void read_sunos_user(struc struct task_struct *tsk, long __user *addr) { struct pt_regs *cregs = tsk->thread.kregs; - struct thread_info *t = tsk->thread_info; + struct thread_info *t = task_thread_info(tsk); int v; if(offset >= 1024) @@ -170,7 +170,7 @@ static inline void write_sunos_user(stru struct task_struct *tsk) { struct pt_regs *cregs = tsk->thread.kregs; - struct thread_info *t = tsk->thread_info; + struct thread_info *t = task_thread_info(tsk); unsigned long value = regs->u_regs[UREG_I3]; if(offset >= 1024) diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index cc1fc89..40d426c 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c @@ -200,7 +200,7 @@ void __init smp4d_boot_cpus(void) /* Cook up an idler for this guy. */ p = fork_idle(i); cpucount++; - current_set[i] = p->thread_info; + current_set[i] = task_thread_info(p); for (no = 0; !cpu_find_by_instance(no, NULL, &mid) && mid != i; no++) ; diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index f113422..a21f27d 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c @@ -173,7 +173,7 @@ void __init smp4m_boot_cpus(void) /* Cook up an idler for this guy. */ p = fork_idle(i); cpucount++; - current_set[i] = p->thread_info; + current_set[i] = task_thread_info(p); /* See trampoline.S for details... */ entry += ((i-1) * 3); diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c index 3f451ae..41d45c2 100644 --- a/arch/sparc/kernel/traps.c +++ b/arch/sparc/kernel/traps.c @@ -291,7 +291,7 @@ void do_fpe_trap(struct pt_regs *regs, u #ifndef CONFIG_SMP if(!fpt) { #else - if(!(fpt->thread_info->flags & _TIF_USEDFPU)) { + if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) { #endif fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth); regs->psr &= ~PSR_EF; @@ -334,7 +334,7 @@ void do_fpe_trap(struct pt_regs *regs, u /* nope, better SIGFPE the offending process... */ #ifdef CONFIG_SMP - fpt->thread_info->flags &= ~_TIF_USEDFPU; + task_thread_info(fpt)->flags &= ~_TIF_USEDFPU; #endif if(psr & PSR_PS) { /* The first fsr store/load we tried trapped, diff --git a/include/asm-sparc/system.h b/include/asm-sparc/system.h index 1f6b71f..20bf381 100644 --- a/include/asm-sparc/system.h +++ b/include/asm-sparc/system.h @@ -155,7 +155,7 @@ extern void fpsave(unsigned long *fpregs "here:\n" \ : "=&r" (last) \ : "r" (&(current_set[hard_smp_processor_id()])), \ - "r" ((next)->thread_info), \ + "r" (task_thread_info(next)), \ "i" (TI_KPSR), \ "i" (TI_KSP), \ "i" (TI_TASK) \ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sparc: task_stack_page() From: Al Viro Date: 1134157505 -0500 --- arch/sparc/kernel/process.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) b01a9edfb676c9d2f99e70e91cb976a819454a24 diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c index 7eebb08..fbb05a4 100644 --- a/arch/sparc/kernel/process.c +++ b/arch/sparc/kernel/process.c @@ -302,7 +302,7 @@ void show_stack(struct task_struct *tsk, int count = 0; if (tsk != NULL) - task_base = (unsigned long) tsk->thread_info; + task_base = (unsigned long) task_stack_page(tsk); else task_base = (unsigned long) current_thread_info(); @@ -392,7 +392,7 @@ void flush_thread(void) /* We must fixup kregs as well. */ /* XXX This was not fixed for ti for a while, worked. Unused? */ current->thread.kregs = (struct pt_regs *) - ((char *)current->thread_info + (THREAD_SIZE - TRACEREG_SZ)); + (task_stack_page(current) + (THREAD_SIZE - TRACEREG_SZ)); } } @@ -459,7 +459,7 @@ int copy_thread(int nr, unsigned long cl unsigned long unused, struct task_struct *p, struct pt_regs *regs) { - struct thread_info *ti = p->thread_info; + struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs; char *new_stack; @@ -482,7 +482,7 @@ int copy_thread(int nr, unsigned long cl * V V (stk.fr.) V (pt_regs) { (stk.fr.) } * +----- - - - - - ------+===========+============={+==========}+ */ - new_stack = (char*)ti + THREAD_SIZE; + new_stack = task_stack_page(p) + THREAD_SIZE; if (regs->psr & PSR_PS) new_stack -= STACKFRAME_SZ; new_stack -= STACKFRAME_SZ + TRACEREG_SZ; -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] uml: task_thread_info() From: Al Viro Date: 1134103460 -0500 --- arch/um/kernel/process_kern.c | 2 +- arch/um/kernel/tt/process_kern.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 2b8cf8ebd41c64db79aed65a9fd2b8e2cc2d9650 diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c index 34b54a3..791ea3f 100644 --- a/arch/um/kernel/process_kern.c +++ b/arch/um/kernel/process_kern.c @@ -108,7 +108,7 @@ void set_current(void *t) { struct task_struct *task = t; - cpu_tasks[task->thread_info->cpu] = ((struct cpu_task) + cpu_tasks[task_thread_info(task)->cpu] = ((struct cpu_task) { external_pid(task), task }); } diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index cfaa373..857f355 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c @@ -37,7 +37,7 @@ void switch_to_tt(void *prev, void *next from = prev; to = next; - cpu = from->thread_info->cpu; + cpu = task_thread_info(from)->cpu; if(cpu == 0) forward_interrupts(to->thread.mode.tt.extern_pid); #ifdef CONFIG_SMP @@ -344,7 +344,7 @@ int do_proc_op(void *t, int proc_id) pid = thread->request.u.exec.pid; do_exec(thread->mode.tt.extern_pid, pid); thread->mode.tt.extern_pid = pid; - cpu_tasks[task->thread_info->cpu].pid = pid; + cpu_tasks[task_thread_info(task)->cpu].pid = pid; break; case OP_FORK: attach_process(thread->request.u.fork.pid); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] uml: task_stack_page() From: Al Viro Date: 1134157715 -0500 --- arch/um/kernel/skas/process_kern.c | 4 ++-- arch/um/kernel/tt/exec_kern.c | 2 +- arch/um/kernel/tt/process_kern.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 24ff83357fd7e0e745b8e3e9bdbb8b9ea253ca15 diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c index 9c99025..648dd55 100644 --- a/arch/um/kernel/skas/process_kern.c +++ b/arch/um/kernel/skas/process_kern.c @@ -119,7 +119,7 @@ int copy_thread_skas(int nr, unsigned lo handler = new_thread_handler; } - new_thread(p->thread_info, &p->thread.mode.skas.switch_buf, + new_thread(task_stack_page(p), &p->thread.mode.skas.switch_buf, &p->thread.mode.skas.fork_buf, handler); return(0); } @@ -186,7 +186,7 @@ int start_uml_skas(void) init_task.thread.request.u.thread.proc = start_kernel_proc; init_task.thread.request.u.thread.arg = NULL; - return(start_idle_thread(init_task.thread_info, + return(start_idle_thread(task_stack_page(&init_task), &init_task.thread.mode.skas.switch_buf, &init_task.thread.mode.skas.fork_buf)); } diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c index 065b504..1b98330 100644 --- a/arch/um/kernel/tt/exec_kern.c +++ b/arch/um/kernel/tt/exec_kern.c @@ -40,7 +40,7 @@ void flush_thread_tt(void) do_exit(SIGKILL); } - new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp); + new_pid = start_fork_tramp(task_stack_page(current), stack, 0, exec_tramp); if(new_pid < 0){ printk(KERN_ERR "flush_thread : new thread failed, errno = %d\n", diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c index 857f355..6f21c1f 100644 --- a/arch/um/kernel/tt/process_kern.c +++ b/arch/um/kernel/tt/process_kern.c @@ -254,7 +254,7 @@ int copy_thread_tt(int nr, unsigned long clone_flags &= CLONE_VM; p->thread.temp_stack = stack; - new_pid = start_fork_tramp(p->thread_info, stack, clone_flags, tramp); + new_pid = start_fork_tramp(task_stack_page(p), stack, clone_flags, tramp); if(new_pid < 0){ printk(KERN_ERR "copy_thread : clone failed - errno = %d\n", -new_pid); @@ -426,7 +426,7 @@ int start_uml_tt(void) int pages; pages = (1 << CONFIG_KERNEL_STACK_ORDER); - sp = (void *) ((unsigned long) init_task.thread_info) + + sp = task_stack_page(&init_task) + pages * PAGE_SIZE - sizeof(unsigned long); return(tracer(start_kernel_proc, sp)); } -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] s390: task_pt_regs() From: Al Viro Date: 1134158016 -0500 --- arch/s390/kernel/binfmt_elf32.c | 2 +- arch/s390/kernel/process.c | 3 +-- arch/s390/kernel/ptrace.c | 26 +++++++++++++------------- arch/s390/kernel/time.c | 2 +- arch/s390/kernel/traps.c | 2 +- include/asm-s390/elf.h | 2 +- include/asm-s390/processor.h | 8 ++++---- 7 files changed, 22 insertions(+), 23 deletions(-) a3a0192425cd5f9fd1c5bb7425c51e13a00660c0 diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c index 03ba589..1f451c2 100644 --- a/arch/s390/kernel/binfmt_elf32.c +++ b/arch/s390/kernel/binfmt_elf32.c @@ -112,7 +112,7 @@ static inline int dump_regs32(struct pt_ static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs) { - struct pt_regs *ptregs = __KSTK_PTREGS(tsk); + struct pt_regs *ptregs = task_pt_regs(tsk); int i; memcpy(®s->psw.mask, &ptregs->psw.mask, 4); diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 78b64fe..6997dc5 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -217,8 +217,7 @@ int copy_thread(int nr, unsigned long cl struct pt_regs childregs; } *frame; - frame = ((struct fake_frame *) - (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; + frame = container_of(task_pt_regs(p), struct fake_frame, childregs); p->thread.ksp = (unsigned long) frame; /* Store access registers to kernel stack of new process. */ frame->childregs = *regs; diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 06afa31..353dbe9 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c @@ -52,7 +52,7 @@ FixPerRegisters(struct task_struct *task struct pt_regs *regs; per_struct *per_info; - regs = __KSTK_PTREGS(task); + regs = task_pt_regs(task); per_info = (per_struct *) &task->thread.per_info; per_info->control_regs.bits.em_instruction_fetch = per_info->single_step | per_info->instruction_fetch; @@ -150,7 +150,7 @@ peek_user(struct task_struct *child, add /* * psw and gprs are stored on the stack */ - tmp = *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr); + tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr); if (addr == (addr_t) &dummy->regs.psw.mask) /* Remove per bit from user psw. */ tmp &= ~PSW_MASK_PER; @@ -176,7 +176,7 @@ peek_user(struct task_struct *child, add /* * orig_gpr2 is stored on the kernel stack */ - tmp = (addr_t) __KSTK_PTREGS(child)->orig_gpr2; + tmp = (addr_t) task_pt_regs(child)->orig_gpr2; } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { /* @@ -243,7 +243,7 @@ poke_user(struct task_struct *child, add high order bit but older gdb's rely on it */ data |= PSW_ADDR_AMODE; #endif - *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr) = data; + *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data; } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { /* @@ -267,7 +267,7 @@ poke_user(struct task_struct *child, add /* * orig_gpr2 is stored on the kernel stack */ - __KSTK_PTREGS(child)->orig_gpr2 = data; + task_pt_regs(child)->orig_gpr2 = data; } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { /* @@ -393,15 +393,15 @@ peek_user_emu31(struct task_struct *chil */ if (addr == (addr_t) &dummy32->regs.psw.mask) { /* Fake a 31 bit psw mask. */ - tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32); + tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32); tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp); } else if (addr == (addr_t) &dummy32->regs.psw.addr) { /* Fake a 31 bit psw address. */ - tmp = (__u32) __KSTK_PTREGS(child)->psw.addr | + tmp = (__u32) task_pt_regs(child)->psw.addr | PSW32_ADDR_AMODE31; } else { /* gpr 0-15 */ - tmp = *(__u32 *)((addr_t) &__KSTK_PTREGS(child)->psw + + tmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw + addr*2 + 4); } } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { @@ -415,7 +415,7 @@ peek_user_emu31(struct task_struct *chil /* * orig_gpr2 is stored on the kernel stack */ - tmp = *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4); + tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4); } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { /* @@ -472,15 +472,15 @@ poke_user_emu31(struct task_struct *chil if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp)) /* Invalid psw mask. */ return -EINVAL; - __KSTK_PTREGS(child)->psw.mask = + task_pt_regs(child)->psw.mask = PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32); } else if (addr == (addr_t) &dummy32->regs.psw.addr) { /* Build a 64 bit psw address from 31 bit address. */ - __KSTK_PTREGS(child)->psw.addr = + task_pt_regs(child)->psw.addr = (__u64) tmp & PSW32_ADDR_INSN; } else { /* gpr 0-15 */ - *(__u32*)((addr_t) &__KSTK_PTREGS(child)->psw + *(__u32*)((addr_t) &task_pt_regs(child)->psw + addr*2 + 4) = tmp; } } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { @@ -494,7 +494,7 @@ poke_user_emu31(struct task_struct *chil /* * orig_gpr2 is stored on the kernel stack */ - *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4) = tmp; + *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp; } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { /* diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index c36353e..b0d8ca8 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c @@ -282,7 +282,7 @@ static inline void start_hz_timer(void) { if (!cpu_isset(smp_processor_id(), nohz_cpu_mask)) return; - account_ticks(__KSTK_PTREGS(current)); + account_ticks(task_pt_regs(current)); cpu_clear(smp_processor_id(), nohz_cpu_mask); } diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index c5bd36f..bcdfd6a 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -240,7 +240,7 @@ char *task_show_regs(struct task_struct { struct pt_regs *regs; - regs = __KSTK_PTREGS(task); + regs = task_pt_regs(task); buffer += sprintf(buffer, "task: %p, ksp: %p\n", task, (void *)task->thread.ksp); buffer += sprintf(buffer, "User PSW : %p %p\n", diff --git a/include/asm-s390/elf.h b/include/asm-s390/elf.h index 372d51c..710646e 100644 --- a/include/asm-s390/elf.h +++ b/include/asm-s390/elf.h @@ -163,7 +163,7 @@ static inline int dump_regs(struct pt_re static inline int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) { - struct pt_regs *ptregs = __KSTK_PTREGS(tsk); + struct pt_regs *ptregs = task_pt_regs(tsk); memcpy(®s->psw, &ptregs->psw, sizeof(regs->psw)+sizeof(regs->gprs)); memcpy(regs->acrs, tsk->thread.acrs, sizeof(regs->acrs)); regs->orig_gpr2 = ptregs->orig_gpr2; diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 4ec652e..795bfcb 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h @@ -191,10 +191,10 @@ extern void show_registers(struct pt_reg extern void show_trace(struct task_struct *task, unsigned long *sp); unsigned long get_wchan(struct task_struct *p); -#define __KSTK_PTREGS(tsk) ((struct pt_regs *) \ - ((unsigned long) tsk->thread_info + THREAD_SIZE - sizeof(struct pt_regs))) -#define KSTK_EIP(tsk) (__KSTK_PTREGS(tsk)->psw.addr) -#define KSTK_ESP(tsk) (__KSTK_PTREGS(tsk)->gprs[15]) +#define task_pt_regs(tsk) ((struct pt_regs *) \ + ((void *)(tsk)->thread_info + THREAD_SIZE) - 1) +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr) +#define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15]) /* * Give up the time slice of the virtual PU. -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] s390: task_stack_page() From: Al Viro Date: 1134158315 -0500 --- arch/s390/kernel/process.c | 9 ++++----- arch/s390/kernel/smp.c | 2 +- arch/s390/kernel/traps.c | 4 ++-- include/asm-s390/processor.h | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) 4628465f81b633d6edbd4189054c75cc9634288b diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index 6997dc5..2c77f60 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c @@ -153,7 +153,7 @@ void show_regs(struct pt_regs *regs) { struct task_struct *tsk = current; - printk("CPU: %d %s\n", tsk->thread_info->cpu, print_tainted()); + printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted()); printk("Process %s (pid: %d, task: %p, ksp: %p)\n", current->comm, current->pid, (void *) tsk, (void *) tsk->thread.ksp); @@ -378,11 +378,10 @@ unsigned long get_wchan(struct task_stru unsigned long return_address; int count; - if (!p || p == current || p->state == TASK_RUNNING || !p->thread_info) + if (!p || p == current || p->state == TASK_RUNNING || !task_stack_page(p)) return 0; - low = (struct stack_frame *) p->thread_info; - high = (struct stack_frame *) - ((unsigned long) p->thread_info + THREAD_SIZE) - 1; + low = task_stack_page(p); + high = (struct stack_frame *) task_pt_regs(p); sf = (struct stack_frame *) (p->thread.ksp & PSW_ADDR_INSN); if (sf <= low || sf > high) return 0; diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 5856b3f..7970b74 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -657,7 +657,7 @@ __cpu_up(unsigned int cpu) idle = current_set[cpu]; cpu_lowcore = lowcore_ptr[cpu]; cpu_lowcore->kernel_stack = (unsigned long) - idle->thread_info + (THREAD_SIZE); + task_stack_page(idle) + (THREAD_SIZE); sf = (struct stack_frame *) (cpu_lowcore->kernel_stack - sizeof(struct pt_regs) - sizeof(struct stack_frame)); diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c index bcdfd6a..6c7ca16 100644 --- a/arch/s390/kernel/traps.c +++ b/arch/s390/kernel/traps.c @@ -136,8 +136,8 @@ void show_trace(struct task_struct *task sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE, S390_lowcore.async_stack); if (task) - __show_trace(sp, (unsigned long) task->thread_info, - (unsigned long) task->thread_info + THREAD_SIZE); + __show_trace(sp, (unsigned long) task_stack_page(task), + (unsigned long) task_stack_page(task) + THREAD_SIZE); else __show_trace(sp, S390_lowcore.thread_info, S390_lowcore.thread_info + THREAD_SIZE); diff --git a/include/asm-s390/processor.h b/include/asm-s390/processor.h index 795bfcb..c5cbc4b 100644 --- a/include/asm-s390/processor.h +++ b/include/asm-s390/processor.h @@ -192,7 +192,7 @@ extern void show_trace(struct task_struc unsigned long get_wchan(struct task_struct *p); #define task_pt_regs(tsk) ((struct pt_regs *) \ - ((void *)(tsk)->thread_info + THREAD_SIZE) - 1) + (task_stack_page(tsk) + THREAD_SIZE) - 1) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->psw.addr) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->gprs[15]) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] xtensa: task_pt_regs(), task_stack_page() From: Al Viro Date: 1134201089 -0500 --- arch/xtensa/kernel/process.c | 4 ++-- arch/xtensa/kernel/ptrace.c | 12 ++++++------ include/asm-xtensa/processor.h | 6 +++--- include/asm-xtensa/ptrace.h | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) c34901a1eccae7c0942a403b7f6216e873247215 diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 6a44b54..f1f5966 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c @@ -145,7 +145,7 @@ int copy_thread(int nr, unsigned long cl int user_mode = user_mode(regs); /* Set up new TSS. */ - tos = (unsigned long)p->thread_info + THREAD_SIZE; + tos = (unsigned long)task_stack_page(p) + THREAD_SIZE; if (user_mode) childregs = (struct pt_regs*)(tos - PT_USER_SIZE); else @@ -217,7 +217,7 @@ int kernel_thread(int (*fn)(void *), voi unsigned long get_wchan(struct task_struct *p) { unsigned long sp, pc; - unsigned long stack_page = (unsigned long) p->thread_info; + unsigned long stack_page = (unsigned long) task_stack_page(p); int count = 0; if (!p || p == current || p->state == TASK_RUNNING) diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c index ab5c4c6..4cc8528 100644 --- a/arch/xtensa/kernel/ptrace.c +++ b/arch/xtensa/kernel/ptrace.c @@ -72,7 +72,7 @@ long arch_ptrace(struct task_struct *chi struct pt_regs *regs; unsigned long tmp; - regs = xtensa_pt_regs(child); + regs = task_pt_regs(child); tmp = 0; /* Default return value. */ switch(addr) { @@ -149,7 +149,7 @@ long arch_ptrace(struct task_struct *chi case PTRACE_POKEUSR: { struct pt_regs *regs; - regs = xtensa_pt_regs(child); + regs = task_pt_regs(child); switch (addr) { case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: @@ -240,7 +240,7 @@ long arch_ptrace(struct task_struct *chi * elf_gregset_t format. */ xtensa_gregset_t format; - struct pt_regs *regs = xtensa_pt_regs(child); + struct pt_regs *regs = task_pt_regs(child); do_copy_regs (&format, regs, child); @@ -257,7 +257,7 @@ long arch_ptrace(struct task_struct *chi * values in the elf_gregset_t format. */ xtensa_gregset_t format; - struct pt_regs *regs = xtensa_pt_regs(child); + struct pt_regs *regs = task_pt_regs(child); if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){ ret = -EFAULT; @@ -281,7 +281,7 @@ long arch_ptrace(struct task_struct *chi * elf_fpregset_t format. */ elf_fpregset_t fpregs; - struct pt_regs *regs = xtensa_pt_regs(child); + struct pt_regs *regs = task_pt_regs(child); do_save_fpregs (&fpregs, regs, child); @@ -299,7 +299,7 @@ long arch_ptrace(struct task_struct *chi * values in the elf_fpregset_t format. */ elf_fpregset_t fpregs; - struct pt_regs *regs = xtensa_pt_regs(child); + struct pt_regs *regs = task_pt_regs(child); ret = 0; if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) { diff --git a/include/asm-xtensa/processor.h b/include/asm-xtensa/processor.h index 9cab5e4..d1d72ad 100644 --- a/include/asm-xtensa/processor.h +++ b/include/asm-xtensa/processor.h @@ -184,12 +184,12 @@ extern int kernel_thread(int (*fn)(void #define release_segments(mm) do { } while(0) #define forget_segments() do { } while (0) -#define thread_saved_pc(tsk) (xtensa_pt_regs(tsk)->pc) +#define thread_saved_pc(tsk) (task_pt_regs(tsk)->pc) extern unsigned long get_wchan(struct task_struct *p); -#define KSTK_EIP(tsk) (xtensa_pt_regs(tsk)->pc) -#define KSTK_ESP(tsk) (xtensa_pt_regs(tsk)->areg[1]) +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->pc) +#define KSTK_ESP(tsk) (task_pt_regs(tsk)->areg[1]) #define cpu_relax() do { } while (0) diff --git a/include/asm-xtensa/ptrace.h b/include/asm-xtensa/ptrace.h index aa4fd7f..a5ac71a 100644 --- a/include/asm-xtensa/ptrace.h +++ b/include/asm-xtensa/ptrace.h @@ -113,8 +113,8 @@ struct pt_regs { }; #ifdef __KERNEL__ -# define xtensa_pt_regs(tsk) ((struct pt_regs*) \ - (((long)(tsk)->thread_info + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4)) - 1) +# define task_pt_regs(tsk) ((struct pt_regs*) \ + (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1) # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) # define instruction_pointer(regs) ((regs)->pc) extern void show_regs(struct pt_regs *); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] v850: task_stack_page(), task_pt_regs() From: Al Viro Date: 1134201337 -0500 --- arch/v850/kernel/process.c | 2 +- arch/v850/kernel/ptrace.c | 2 +- include/asm-v850/processor.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) bea50827b758bd9e705ae68bdc5ce033eccd2237 diff --git a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c index 39cf247..abf7f4b 100644 --- a/arch/v850/kernel/process.c +++ b/arch/v850/kernel/process.c @@ -114,7 +114,7 @@ int copy_thread (int nr, unsigned long c struct task_struct *p, struct pt_regs *regs) { /* Start pushing stuff from the top of the child's kernel stack. */ - unsigned long orig_ksp = (unsigned long)p->thread_info + THREAD_SIZE; + unsigned long orig_ksp = task_tos(task); unsigned long ksp = orig_ksp; /* We push two `state save' stack fames (see entry.S) on the new kernel stack: diff --git a/arch/v850/kernel/ptrace.c b/arch/v850/kernel/ptrace.c index 18492d0..67e0575 100644 --- a/arch/v850/kernel/ptrace.c +++ b/arch/v850/kernel/ptrace.c @@ -58,7 +58,7 @@ static v850_reg_t *reg_save_addr (unsign regs = thread_saved_regs (t); else /* Register saved during kernel entry (or not available). */ - regs = task_regs (t); + regs = task_pt_regs (t); return (v850_reg_t *)((char *)regs + reg_offs); } diff --git a/include/asm-v850/processor.h b/include/asm-v850/processor.h index 98f9294..2d31308 100644 --- a/include/asm-v850/processor.h +++ b/include/asm-v850/processor.h @@ -98,10 +98,10 @@ unsigned long get_wchan (struct task_str /* Return some info about the user process TASK. */ -#define task_tos(task) ((unsigned long)(task)->thread_info + THREAD_SIZE) -#define task_regs(task) ((struct pt_regs *)task_tos (task) - 1) -#define task_sp(task) (task_regs (task)->gpr[GPR_SP]) -#define task_pc(task) (task_regs (task)->pc) +#define task_tos(task) ((unsigned long)task_stack_page(task) + THREAD_SIZE) +#define task_pt_regs(task) ((struct pt_regs *)task_tos (task) - 1) +#define task_sp(task) (task_pt_regs (task)->gpr[GPR_SP]) +#define task_pc(task) (task_pt_regs (task)->pc) /* Grotty old names for some. */ #define KSTK_EIP(task) task_pc (task) #define KSTK_ESP(task) task_sp (task) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] m32r: task_pt_regs(), task_stack_page(), task_thread_info() From: Al Viro Date: 1134201708 -0500 --- arch/m32r/kernel/process.c | 5 +---- arch/m32r/kernel/ptrace.c | 25 ++++--------------------- arch/m32r/kernel/smpboot.c | 2 +- include/asm-m32r/ptrace.h | 3 +++ 4 files changed, 9 insertions(+), 26 deletions(-) a98284068538262a666e3bf60bad660a45e7dc49 diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c index cc4b571..9d68c0b 100644 --- a/arch/m32r/kernel/process.c +++ b/arch/m32r/kernel/process.c @@ -238,13 +238,10 @@ int dump_fpu(struct pt_regs *regs, elf_f int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, unsigned long unused, struct task_struct *tsk, struct pt_regs *regs) { - struct pt_regs *childregs; - unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE; + struct pt_regs *childregs = task_pt_regs(tsk); extern void ret_from_fork(void); /* Copy registers */ - sp -= sizeof (struct pt_regs); - childregs = (struct pt_regs *)sp; *childregs = *regs; childregs->spu = spu; diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index 078d2a0..b67cabf 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c @@ -35,23 +35,6 @@ #include /* - * Get the address of the live pt_regs for the specified task. - * These are saved onto the top kernel stack when the process - * is not running. - * - * Note: if a user thread is execve'd from kernel space, the - * kernel stack will not be empty on entry to the kernel, so - * ptracing these tasks will fail. - */ -static inline struct pt_regs * -get_user_regs(struct task_struct *task) -{ - return (struct pt_regs *) - ((unsigned long)task->thread_info + THREAD_SIZE - - sizeof(struct pt_regs)); -} - -/* * This routine will get a word off of the process kernel stack. */ static inline unsigned long int @@ -59,7 +42,7 @@ get_stack_long(struct task_struct *task, { unsigned long *stack; - stack = (unsigned long *)get_user_regs(task); + stack = (unsigned long *)task_pt_regs(task); return stack[offset]; } @@ -72,7 +55,7 @@ put_stack_long(struct task_struct *task, { unsigned long *stack; - stack = (unsigned long *)get_user_regs(task); + stack = (unsigned long *)task_pt_regs(task); stack[offset] = data; return 0; @@ -208,7 +191,7 @@ static int ptrace_write_user(struct task */ static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) { - struct pt_regs *regs = get_user_regs(tsk); + struct pt_regs *regs = task_pt_regs(tsk); return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; } @@ -223,7 +206,7 @@ static int ptrace_setregs(struct task_st ret = -EFAULT; if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { - struct pt_regs *regs = get_user_regs(tsk); + struct pt_regs *regs = task_pt_regs(tsk); *regs = newregs; ret = 0; } diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c index b90c541..d7ec16e 100644 --- a/arch/m32r/kernel/smpboot.c +++ b/arch/m32r/kernel/smpboot.c @@ -286,7 +286,7 @@ static void __init do_boot_cpu(int phys_ /* So we see what's up */ printk("Booting processor %d/%d\n", phys_id, cpu_id); stack_start.spi = (void *)idle->thread.sp; - idle->thread_info->cpu = cpu_id; + task_thread_info(idle)->cpu = cpu_id; /* * Send Startup IPI diff --git a/include/asm-m32r/ptrace.h b/include/asm-m32r/ptrace.h index 55cd7ec..0d058b2 100644 --- a/include/asm-m32r/ptrace.h +++ b/include/asm-m32r/ptrace.h @@ -163,6 +163,9 @@ extern void show_regs(struct pt_regs *); extern void withdraw_debug_trap(struct pt_regs *regs); +#define task_pt_regs(task) \ + ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) + #endif /* __KERNEL */ #endif /* _ASM_M32R_PTRACE_H */ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] frv: task_thread_info(), task_stack_page() From: Al Viro Date: 1134224716 -0500 --- arch/frv/kernel/process.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) f5020a659eb0de7f0acaa530560037d362dcff5a diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index 54a4521..61628b6 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c @@ -204,7 +204,7 @@ int copy_thread(int nr, unsigned long cl regs0 = __kernel_frame0_ptr; childregs0 = (struct pt_regs *) - ((unsigned long) p->thread_info + THREAD_SIZE - USER_CONTEXT_SIZE); + (task_stack_page(p) + THREAD_SIZE - USER_CONTEXT_SIZE); childregs = childregs0; /* set up the userspace frame (the only place that the USP is stored) */ @@ -220,7 +220,7 @@ int copy_thread(int nr, unsigned long cl *childregs = *regs; childregs->sp = (unsigned long) childregs0; childregs->next_frame = childregs0; - childregs->gr15 = (unsigned long) p->thread_info; + childregs->gr15 = (unsigned long) task_thread_info(p); childregs->gr29 = (unsigned long) p; } -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] m68k: task_stack_page() From: Al Viro Date: 1134208664 -0500 --- arch/m68k/kernel/process.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) 43ba40af7b4761313df77f8ef146bf79a851c15b diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c index 13d1093..3f9cb55 100644 --- a/arch/m68k/kernel/process.c +++ b/arch/m68k/kernel/process.c @@ -238,10 +238,9 @@ int copy_thread(int nr, unsigned long cl { struct pt_regs * childregs; struct switch_stack * childstack, *stack; - unsigned long stack_offset, *retp; + unsigned long *retp; - stack_offset = THREAD_SIZE - sizeof(struct pt_regs); - childregs = (struct pt_regs *) ((unsigned long) (p->thread_info) + stack_offset); + childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; *childregs = *regs; childregs->d0 = 0; @@ -386,7 +385,7 @@ unsigned long get_wchan(struct task_stru if (!p || p == current || p->state == TASK_RUNNING) return 0; - stack_page = (unsigned long)(p->thread_info); + stack_page = (unsigned long)task_stack_page(p); fp = ((struct switch_stack *)p->thread.ksp)->a6; do { if (fp < stack_page+sizeof(struct thread_info) || -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] m6knommu: task_stack_page() From: Al Viro Date: 1134208864 -0500 --- arch/m68knommu/kernel/process.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) e153799ae465e59334ebab00fc8bdfbd2a3cc6fd diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c index 82e7ec8..9b0fd04 100644 --- a/arch/m68knommu/kernel/process.c +++ b/arch/m68knommu/kernel/process.c @@ -198,10 +198,9 @@ int copy_thread(int nr, unsigned long cl { struct pt_regs * childregs; struct switch_stack * childstack, *stack; - unsigned long stack_offset, *retp; + unsigned long *retp; - stack_offset = THREAD_SIZE - sizeof(struct pt_regs); - childregs = (struct pt_regs *) ((unsigned long) p->thread_info + stack_offset); + childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1; *childregs = *regs; childregs->d0 = 0; -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] parisc: task_stack_page(), task_thread_info() From: Al Viro Date: 1134209112 -0500 --- arch/parisc/kernel/process.c | 6 +++--- arch/parisc/kernel/smp.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 0ce48381caf8f18fc5887a7f64c2cc1f5f933bf3 diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index fee4f1f..1273272 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c @@ -295,7 +295,7 @@ copy_thread(int nr, unsigned long clone_ struct task_struct * p, struct pt_regs * pregs) { struct pt_regs * cregs = &(p->thread.regs); - struct thread_info *ti = p->thread_info; + void *stack = task_stack_page(p); /* We have to use void * instead of a function pointer, because * function pointers aren't a pointer to the function on 64-bit. @@ -322,7 +322,7 @@ copy_thread(int nr, unsigned long clone_ */ if (usp == 1) { /* kernel thread */ - cregs->ksp = (((unsigned long)(ti)) + THREAD_SZ_ALGN); + cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN; /* Must exit via ret_from_kernel_thread in order * to call schedule_tail() */ @@ -344,7 +344,7 @@ copy_thread(int nr, unsigned long clone_ */ /* Use same stack depth as parent */ - cregs->ksp = ((unsigned long)(ti)) + cregs->ksp = (unsigned long)stack + (pregs->gr[21] & (THREAD_SIZE - 1)); cregs->gr[30] = usp; if (p->personality == PER_HPUX) { diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c index ce89da0..471efad 100644 --- a/arch/parisc/kernel/smp.c +++ b/arch/parisc/kernel/smp.c @@ -519,7 +519,7 @@ int __init smp_boot_one_cpu(int cpuid) if (IS_ERR(idle)) panic("SMP: fork failed for CPU:%d", cpuid); - idle->thread_info->cpu = cpuid; + task_thread_info(idle)->cpu = cpuid; /* Let _start know what logical CPU we're booting ** (offset into init_tasks[],cpu_data[]) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] h8300: task_stack_page() From: Al Viro Date: 1134209174 -0500 --- arch/h8300/kernel/process.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 7c123aa78763ec99143d1f653263c34309033950 diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c index fe21adf..f053b14 100644 --- a/arch/h8300/kernel/process.c +++ b/arch/h8300/kernel/process.c @@ -195,7 +195,7 @@ int copy_thread(int nr, unsigned long cl { struct pt_regs * childregs; - childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; + childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1; *childregs = *regs; childregs->retpc = (unsigned long) ret_from_fork; -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm: task_thread_info() From: Al Viro Date: 1133958849 -0500 --- arch/arm/kernel/process.c | 4 ++-- arch/arm/kernel/ptrace.c | 10 +++++----- include/asm-arm/system.h | 2 +- include/asm-arm/thread_info.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) 67297d24afc0667e161d2adb1f75d4601cf1b4a1 diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 30494aa..ca0febd 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -343,10 +343,10 @@ void flush_thread(void) void release_thread(struct task_struct *dead_task) { #if defined(CONFIG_VFP) - vfp_release_thread(&dead_task->thread_info->vfpstate); + vfp_release_thread(&task_thread_info(dead_task)->vfpstate); #endif #if defined(CONFIG_IWMMXT) - iwmmxt_task_release(dead_task->thread_info); + iwmmxt_task_release(task_thread_info(dead_task)); #endif } diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 2b84f78..f003062 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -604,7 +604,7 @@ static int ptrace_setregs(struct task_st */ static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp) { - return copy_to_user(ufp, &tsk->thread_info->fpstate, + return copy_to_user(ufp, &task_thread_info(tsk)->fpstate, sizeof(struct user_fp)) ? -EFAULT : 0; } @@ -613,7 +613,7 @@ static int ptrace_getfpregs(struct task_ */ static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp) { - struct thread_info *thread = tsk->thread_info; + struct thread_info *thread = task_thread_info(tsk); thread->used_cp[1] = thread->used_cp[2] = 1; return copy_from_user(&thread->fpstate, ufp, sizeof(struct user_fp)) ? -EFAULT : 0; @@ -626,7 +626,7 @@ static int ptrace_setfpregs(struct task_ */ static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp) { - struct thread_info *thread = tsk->thread_info; + struct thread_info *thread = task_thread_info(tsk); void *ptr = &thread->fpstate; if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT)) @@ -643,7 +643,7 @@ static int ptrace_getwmmxregs(struct tas */ static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp) { - struct thread_info *thread = tsk->thread_info; + struct thread_info *thread = task_thread_info(tsk); void *ptr = &thread->fpstate; if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT)) @@ -779,7 +779,7 @@ long arch_ptrace(struct task_struct *chi #endif case PTRACE_GET_THREAD_AREA: - ret = put_user(child->thread_info->tp_value, + ret = put_user(task_thread_info(child)->tp_value, (unsigned long __user *) data); break; diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 5621d61..a7da094 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h @@ -168,7 +168,7 @@ extern struct task_struct *__switch_to(s #define switch_to(prev,next,last) \ do { \ - last = __switch_to(prev,prev->thread_info,next->thread_info); \ + last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \ } while (0) /* diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h index 7c98557..46a4e98 100644 --- a/include/asm-arm/thread_info.h +++ b/include/asm-arm/thread_info.h @@ -100,9 +100,9 @@ extern void free_thread_info(struct thre #define put_thread_info(ti) put_task_struct((ti)->task) #define thread_saved_pc(tsk) \ - ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc))) + ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) #define thread_saved_fp(tsk) \ - ((unsigned long)((tsk)->thread_info->cpu_context.fp)) + ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) extern void iwmmxt_task_disable(struct thread_info *); extern void iwmmxt_task_copy(struct thread_info *, void *); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm: task_pt_regs() From: Al Viro Date: 1134156293 -0500 --- arch/arm/kernel/process.c | 5 ++--- arch/arm/kernel/ptrace.c | 27 +++++---------------------- include/asm-arm/processor.h | 8 +++++--- 3 files changed, 12 insertions(+), 28 deletions(-) 11463280f525e68b38a87f3ad17967cbc6b72dcf diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index ca0febd..6c82d6b 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -356,10 +356,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) { - struct thread_info *thread = p->thread_info; - struct pt_regs *childregs; + struct thread_info *thread = task_thread_info(p); + struct pt_regs *childregs = task_pt_regs(p); - childregs = (void *)thread + THREAD_START_SP - sizeof(*regs); *childregs = *regs; childregs->ARM_r0 = 0; childregs->ARM_sp = stack_start; diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index f003062..e591f72 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c @@ -55,23 +55,6 @@ #endif /* - * Get the address of the live pt_regs for the specified task. - * These are saved onto the top kernel stack when the process - * is not running. - * - * Note: if a user thread is execve'd from kernel space, the - * kernel stack will not be empty on entry to the kernel, so - * ptracing these tasks will fail. - */ -static inline struct pt_regs * -get_user_regs(struct task_struct *task) -{ - return (struct pt_regs *) - ((unsigned long)task->thread_info + THREAD_SIZE - - 8 - sizeof(struct pt_regs)); -} - -/* * this routine will get a word off of the processes privileged stack. * the offset is how far from the base addr as stored in the THREAD. * this routine assumes that all the privileged stacks are in our @@ -79,7 +62,7 @@ get_user_regs(struct task_struct *task) */ static inline long get_user_reg(struct task_struct *task, int offset) { - return get_user_regs(task)->uregs[offset]; + return task_pt_regs(task)->uregs[offset]; } /* @@ -91,7 +74,7 @@ static inline long get_user_reg(struct t static inline int put_user_reg(struct task_struct *task, int offset, long data) { - struct pt_regs newregs, *regs = get_user_regs(task); + struct pt_regs newregs, *regs = task_pt_regs(task); int ret = -EINVAL; newregs = *regs; @@ -421,7 +404,7 @@ void ptrace_set_bpt(struct task_struct * u32 insn; int res; - regs = get_user_regs(child); + regs = task_pt_regs(child); pc = instruction_pointer(regs); if (thumb_mode(regs)) { @@ -572,7 +555,7 @@ static int ptrace_write_user(struct task */ static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) { - struct pt_regs *regs = get_user_regs(tsk); + struct pt_regs *regs = task_pt_regs(tsk); return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; } @@ -587,7 +570,7 @@ static int ptrace_setregs(struct task_st ret = -EFAULT; if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { - struct pt_regs *regs = get_user_regs(tsk); + struct pt_regs *regs = task_pt_regs(tsk); ret = -EINVAL; if (valid_user_regs(&newregs)) { diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index 7d4118e..fb5877e 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -85,9 +85,11 @@ unsigned long get_wchan(struct task_stru */ extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); -#define KSTK_REGS(tsk) (((struct pt_regs *)(THREAD_START_SP + (unsigned long)(tsk)->thread_info)) - 1) -#define KSTK_EIP(tsk) KSTK_REGS(tsk)->ARM_pc -#define KSTK_ESP(tsk) KSTK_REGS(tsk)->ARM_sp +#define task_pt_regs(p) \ + ((struct pt_regs *)(THREAD_START_SP + (void *)(p)->thread_info) - 1) + +#define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc +#define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp /* * Prefetching support - only ARMv5. -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm: end_of_stack() From: Al Viro Date: 1134156328 -0500 --- arch/arm/kernel/process.c | 2 +- arch/arm/kernel/traps.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 9295d3542859110b34c5b5d1571335787edebbaa diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 6c82d6b..8c62909 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -460,7 +460,7 @@ unsigned long get_wchan(struct task_stru if (!p || p == current || p->state == TASK_RUNNING) return 0; - stack_start = (unsigned long)(p->thread_info + 1); + stack_start = (unsigned long)end_of_stack(p); stack_end = ((unsigned long)p->thread_info) + THREAD_SIZE; fp = thread_saved_fp(p); diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 45e9ea6..f7e733c 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -165,7 +165,7 @@ static void dump_backtrace(struct pt_reg } else if (verify_stack(fp)) { printk("invalid frame pointer 0x%08x", fp); ok = 0; - } else if (fp < (unsigned long)(tsk->thread_info + 1)) + } else if (fp < (unsigned long)end_of_stack(tsk)) printk("frame pointer underflow"); printk("\n"); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm: task_stack_page() From: Al Viro Date: 1134156440 -0500 --- arch/arm/kernel/process.c | 2 +- arch/arm/kernel/smp.c | 4 ++-- arch/arm/kernel/traps.c | 2 +- include/asm-arm/processor.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) c72bb632bee65bbba680b90216afa4f2e0de878d diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 8c62909..1be78b0 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -461,7 +461,7 @@ unsigned long get_wchan(struct task_stru return 0; stack_start = (unsigned long)end_of_stack(p); - stack_end = ((unsigned long)p->thread_info) + THREAD_SIZE; + stack_end = (unsigned long)task_stack_page(p) + THREAD_SIZE; fp = thread_saved_fp(p); do { diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 373c095..7338948 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -114,7 +114,7 @@ int __cpuinit __cpu_up(unsigned int cpu) * We need to tell the secondary core where to find * its stack and the page tables. */ - secondary_data.stack = (void *)idle->thread_info + THREAD_START_SP; + secondary_data.stack = task_stack_page(idle) + THREAD_START_SP; secondary_data.pgdir = virt_to_phys(pgd); wmb(); @@ -245,7 +245,7 @@ void __cpuexit cpu_die(void) __asm__("mov sp, %0\n" " b secondary_start_kernel" : - : "r" ((void *)current->thread_info + THREAD_SIZE - 8)); + : "r" (task_stack_page(current) + THREAD_SIZE - 8)); } #endif /* CONFIG_HOTPLUG_CPU */ diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index f7e733c..496bf7c 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -211,7 +211,7 @@ static void __die(const char *str, int e if (!user_mode(regs) || in_interrupt()) { dump_mem("Stack: ", regs->ARM_sp, - THREAD_SIZE + (unsigned long)tsk->thread_info); + THREAD_SIZE + (unsigned long)task_stack_page(tsk)); dump_backtrace(regs, tsk); dump_instr(regs); } diff --git a/include/asm-arm/processor.h b/include/asm-arm/processor.h index fb5877e..3129069 100644 --- a/include/asm-arm/processor.h +++ b/include/asm-arm/processor.h @@ -86,7 +86,7 @@ unsigned long get_wchan(struct task_stru extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); #define task_pt_regs(p) \ - ((struct pt_regs *)(THREAD_START_SP + (void *)(p)->thread_info) - 1) + ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1) #define KSTK_EIP(tsk) task_pt_regs(tsk)->ARM_pc #define KSTK_ESP(tsk) task_pt_regs(tsk)->ARM_sp -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm26: task_thread_info() From: Al Viro Date: 1134200181 -0500 --- arch/arm26/kernel/process.c | 2 +- arch/arm26/kernel/ptrace.c | 4 ++-- include/asm-arm26/system.h | 2 +- include/asm-arm26/thread_info.h | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) af76ffe8bb60eff718f0350dbcb29bc237eac074 diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c index 15833a0..159f84a 100644 --- a/arch/arm26/kernel/process.c +++ b/arch/arm26/kernel/process.c @@ -277,7 +277,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, unsigned long unused, struct task_struct *p, struct pt_regs *regs) { - struct thread_info *thread = p->thread_info; + struct thread_info *thread = task_thread_info(p); struct pt_regs *childregs; childregs = __get_user_regs(thread); diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c index 4e6b735..56afe1f 100644 --- a/arch/arm26/kernel/ptrace.c +++ b/arch/arm26/kernel/ptrace.c @@ -532,7 +532,7 @@ static int ptrace_setregs(struct task_st */ static int ptrace_getfpregs(struct task_struct *tsk, void *ufp) { - return copy_to_user(ufp, &tsk->thread_info->fpstate, + return copy_to_user(ufp, &task_thread_info(tsk)->fpstate, sizeof(struct user_fp)) ? -EFAULT : 0; } @@ -542,7 +542,7 @@ static int ptrace_getfpregs(struct task_ static int ptrace_setfpregs(struct task_struct *tsk, void *ufp) { set_stopped_child_used_math(tsk); - return copy_from_user(&tsk->thread_info->fpstate, ufp, + return copy_from_user(&task_threas_info(tsk)->fpstate, ufp, sizeof(struct user_fp)) ? -EFAULT : 0; } diff --git a/include/asm-arm26/system.h b/include/asm-arm26/system.h index f23fac1..ada34eb 100644 --- a/include/asm-arm26/system.h +++ b/include/asm-arm26/system.h @@ -111,7 +111,7 @@ extern struct task_struct *__switch_to(s #define switch_to(prev,next,last) \ do { \ - last = __switch_to(prev,prev->thread_info,next->thread_info); \ + last = __switch_to(prev,task_thread_info(prev),task_thread_info(next)); \ } while (0) /* diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index aff3e56..909c88d 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h @@ -91,9 +91,9 @@ extern void free_thread_info(struct thre #define put_thread_info(ti) put_task_struct((ti)->task) #define thread_saved_pc(tsk) \ - ((unsigned long)(pc_pointer((tsk)->thread_info->cpu_context.pc))) + ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) #define thread_saved_fp(tsk) \ - ((unsigned long)((tsk)->thread_info->cpu_context.fp)) + ((unsigned long)(task_thread_info(tsk)->cpu_context.fp)) #else /* !__ASSEMBLY__ */ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm26: task_pt_regs() From: Al Viro Date: 1134200503 -0500 --- arch/arm26/kernel/process.c | 3 +-- arch/arm26/kernel/ptrace.c | 25 +++++-------------------- include/asm-arm26/thread_info.h | 2 +- 3 files changed, 7 insertions(+), 23 deletions(-) 167819326539f5ee9edecf0285f00ff41daa04ec diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c index 159f84a..3863056 100644 --- a/arch/arm26/kernel/process.c +++ b/arch/arm26/kernel/process.c @@ -278,9 +278,8 @@ copy_thread(int nr, unsigned long clone_ unsigned long unused, struct task_struct *p, struct pt_regs *regs) { struct thread_info *thread = task_thread_info(p); - struct pt_regs *childregs; + struct pt_regs *childregs = task_pt_regs(p); - childregs = __get_user_regs(thread); *childregs = *regs; childregs->ARM_r0 = 0; childregs->ARM_sp = stack_start; diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c index 56afe1f..3c3371d 100644 --- a/arch/arm26/kernel/ptrace.c +++ b/arch/arm26/kernel/ptrace.c @@ -40,21 +40,6 @@ #define BREAKINST_ARM 0xef9f0001 /* - * Get the address of the live pt_regs for the specified task. - * These are saved onto the top kernel stack when the process - * is not running. - * - * Note: if a user thread is execve'd from kernel space, the - * kernel stack will not be empty on entry to the kernel, so - * ptracing these tasks will fail. - */ -static inline struct pt_regs * -get_user_regs(struct task_struct *task) -{ - return __get_user_regs(task->thread_info); -} - -/* * this routine will get a word off of the processes privileged stack. * the offset is how far from the base addr as stored in the THREAD. * this routine assumes that all the privileged stacks are in our @@ -62,7 +47,7 @@ get_user_regs(struct task_struct *task) */ static inline long get_user_reg(struct task_struct *task, int offset) { - return get_user_regs(task)->uregs[offset]; + return task_pt_regs(task)->uregs[offset]; } /* @@ -74,7 +59,7 @@ static inline long get_user_reg(struct t static inline int put_user_reg(struct task_struct *task, int offset, long data) { - struct pt_regs newregs, *regs = get_user_regs(task); + struct pt_regs newregs, *regs = task_pt_regs(task); int ret = -EINVAL; newregs = *regs; @@ -377,7 +362,7 @@ void ptrace_set_bpt(struct task_struct * u32 insn; int res; - regs = get_user_regs(child); + regs = task_pt_regs(child); pc = instruction_pointer(regs); res = read_instr(child, pc, &insn); @@ -500,7 +485,7 @@ static int ptrace_write_user(struct task */ static int ptrace_getregs(struct task_struct *tsk, void *uregs) { - struct pt_regs *regs = get_user_regs(tsk); + struct pt_regs *regs = task_pt_regs(tsk); return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; } @@ -515,7 +500,7 @@ static int ptrace_setregs(struct task_st ret = -EFAULT; if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { - struct pt_regs *regs = get_user_regs(tsk); + struct pt_regs *regs = task_pt_regs(tsk); ret = -EINVAL; if (valid_user_regs(&newregs)) { diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index 909c88d..f332b40 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h @@ -82,7 +82,7 @@ static inline struct thread_info *curren /* FIXME - PAGE_SIZE < 32K */ #define THREAD_SIZE (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768 -#define __get_user_regs(x) (((struct pt_regs *)((unsigned long)(x) + THREAD_SIZE - 8)) - 1) +#define task_pt_regs(task) ((struct pt_regs *)((unsigned long)(task)->thread_info + THREAD_SIZE - 8) - 1) extern struct thread_info *alloc_thread_info(struct task_struct *task); extern void free_thread_info(struct thread_info *); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] arm26: task_stack_page() From: Al Viro Date: 1134200723 -0500 --- arch/arm26/kernel/traps.c | 8 ++++---- include/asm-arm26/thread_info.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) 94c35b8079301ad324014cfc0aab8743a890a09c diff --git a/arch/arm26/kernel/traps.c b/arch/arm26/kernel/traps.c index f64f590..5847ea5 100644 --- a/arch/arm26/kernel/traps.c +++ b/arch/arm26/kernel/traps.c @@ -132,7 +132,7 @@ static void dump_instr(struct pt_regs *r /*static*/ void __dump_stack(struct task_struct *tsk, unsigned long sp) { - dump_mem("Stack: ", sp, 8192+(unsigned long)tsk->thread_info); + dump_mem("Stack: ", sp, 8192+(unsigned long)task_stack_page(tsk)); } void dump_stack(void) @@ -158,7 +158,7 @@ void dump_backtrace(struct pt_regs *regs } else if (verify_stack(fp)) { printk("invalid frame pointer 0x%08x", fp); ok = 0; - } else if (fp < (unsigned long)(tsk->thread_info + 1)) + } else if (fp < (unsigned long)end_of_stack(tsk)) printk("frame pointer underflow"); printk("\n"); @@ -168,7 +168,7 @@ void dump_backtrace(struct pt_regs *regs /* FIXME - this is probably wrong.. */ void show_stack(struct task_struct *task, unsigned long *sp) { - dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task->thread_info); + dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task_stack_page(task)); } DEFINE_SPINLOCK(die_lock); @@ -187,7 +187,7 @@ NORET_TYPE void die(const char *str, str printk("CPU: %d\n", smp_processor_id()); show_regs(regs); printk("Process %s (pid: %d, stack limit = 0x%p)\n", - current->comm, current->pid, tsk->thread_info + 1); + current->comm, current->pid, end_of_stack(tsk)); if (!user_mode(regs) || in_interrupt()) { __dump_stack(tsk, (unsigned long)(regs + 1)); diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index f332b40..7a35e7a 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h @@ -82,7 +82,7 @@ static inline struct thread_info *curren /* FIXME - PAGE_SIZE < 32K */ #define THREAD_SIZE (8*32768) // FIXME - this needs attention (see kernel/fork.c which gets a nice div by zero if this is lower than 8*32768 -#define task_pt_regs(task) ((struct pt_regs *)((unsigned long)(task)->thread_info + THREAD_SIZE - 8) - 1) +#define task_pt_regs(task) ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE - 8) - 1) extern struct thread_info *alloc_thread_info(struct task_struct *task); extern void free_thread_info(struct thread_info *); -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] sh64: task_stack_page() From: Al Viro Date: 1134224760 -0500 --- arch/sh64/kernel/process.c | 4 ++-- arch/sh64/lib/dbg.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) e65517ef7528698ff89abeacaf141519a84ab4b8 diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c index b95d041..acb0391 100644 --- a/arch/sh64/kernel/process.c +++ b/arch/sh64/kernel/process.c @@ -744,7 +744,7 @@ int copy_thread(int nr, unsigned long cl } #endif /* Copy from sh version */ - childregs = ((struct pt_regs *)(THREAD_SIZE + (unsigned long) p->thread_info )) - 1; + childregs = (struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1; *childregs = *regs; @@ -752,7 +752,7 @@ int copy_thread(int nr, unsigned long cl childregs->regs[15] = usp; p->thread.uregs = childregs; } else { - childregs->regs[15] = (unsigned long)p->thread_info + THREAD_SIZE; + childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE; } childregs->regs[9] = 0; /* Set return value for child */ diff --git a/arch/sh64/lib/dbg.c b/arch/sh64/lib/dbg.c index 526feda..5808733 100644 --- a/arch/sh64/lib/dbg.c +++ b/arch/sh64/lib/dbg.c @@ -174,7 +174,7 @@ void evt_debug(int evt, int ret_addr, in struct ring_node *rr; pid = current->pid; - stack_bottom = (unsigned long) current->thread_info; + stack_bottom = (unsigned long) task_stack_page(current); asm volatile("ori r15, 0, %0" : "=r" (sp)); rr = event_ring + event_ptr; rr->evt = evt; -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] powerpc: task_thread_info() From: Al Viro Date: 1133946592 -0500 --- arch/powerpc/kernel/process.c | 4 ++-- arch/powerpc/kernel/ptrace-common.h | 4 ++-- arch/powerpc/kernel/smp.c | 6 +++--- arch/powerpc/platforms/cell/smp.c | 2 +- arch/powerpc/platforms/pseries/smp.c | 2 +- arch/ppc/kernel/process.c | 2 +- arch/ppc/kernel/smp.c | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) 32f152024e7084a9dedd8d8112bc60e68e868d6f diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 105d560..bc03526 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -424,7 +424,7 @@ void show_regs(struct pt_regs * regs) if (trap == 0x300 || trap == 0x600) printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); printk("TASK = %p[%d] '%s' THREAD: %p", - current, current->pid, current->comm, current->thread_info); + current, current->pid, current->comm, task_thread_info(current)); #ifdef CONFIG_SMP printk(" CPU: %d", smp_processor_id()); @@ -516,7 +516,7 @@ int copy_thread(int nr, unsigned long cl #ifdef CONFIG_PPC32 childregs->gpr[2] = (unsigned long) p; #else - clear_ti_thread_flag(p->thread_info, TIF_32BIT); + clear_tsk_thread_flag(p, TIF_32BIT); #endif p->thread.regs = NULL; /* no user register state */ } else { diff --git a/arch/powerpc/kernel/ptrace-common.h b/arch/powerpc/kernel/ptrace-common.h index b1babb7..5ccbdbe 100644 --- a/arch/powerpc/kernel/ptrace-common.h +++ b/arch/powerpc/kernel/ptrace-common.h @@ -62,7 +62,7 @@ static inline void set_single_step(struc struct pt_regs *regs = task->thread.regs; if (regs != NULL) regs->msr |= MSR_SE; - set_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); + set_tsk_thread_flag(task, TIF_SINGLESTEP); } static inline void clear_single_step(struct task_struct *task) @@ -70,7 +70,7 @@ static inline void clear_single_step(str struct pt_regs *regs = task->thread.regs; if (regs != NULL) regs->msr &= ~MSR_SE; - clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); + clear_tsk_thread_flag(task, TIF_SINGLESTEP); } #ifdef CONFIG_ALTIVEC diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 30374d2..7082416 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -319,8 +319,8 @@ static void __init smp_create_idle(unsig #ifdef CONFIG_PPC64 paca[cpu].__current = p; #endif - current_set[cpu] = p->thread_info; - p->thread_info->cpu = cpu; + current_set[cpu] = task_thread_info(p); + task_thread_info(p)->cpu = cpu; } void __init smp_prepare_cpus(unsigned int max_cpus) @@ -356,7 +356,7 @@ void __devinit smp_prepare_boot_cpu(void #ifdef CONFIG_PPC64 paca[boot_cpuid].__current = current; #endif - current_set[boot_cpuid] = current->thread_info; + current_set[boot_cpuid] = task_thread_info(current); } #ifdef CONFIG_HOTPLUG_CPU diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c index de96ead..bdf6c5f 100644 --- a/arch/powerpc/platforms/cell/smp.c +++ b/arch/powerpc/platforms/cell/smp.c @@ -86,7 +86,7 @@ static inline int __devinit smp_startup_ pcpu = get_hard_smp_processor_id(lcpu); /* Fixup atomic count: it exited inside IRQ handler. */ - paca[lcpu].__current->thread_info->preempt_count = 0; + task_thread_info(paca[lcpu].__current)->preempt_count = 0; /* * If the RTAS start-cpu token does not exist then presume the diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c index 25181c5..2f543ce 100644 --- a/arch/powerpc/platforms/pseries/smp.c +++ b/arch/powerpc/platforms/pseries/smp.c @@ -282,7 +282,7 @@ static inline int __devinit smp_startup_ pcpu = get_hard_smp_processor_id(lcpu); /* Fixup atomic count: it exited inside IRQ handler. */ - paca[lcpu].__current->thread_info->preempt_count = 0; + task_thread_info(paca[lcpu].__current)->preempt_count = 0; /* * If the RTAS start-cpu token does not exist then presume the diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c index 25cbdc8..c3555a8 100644 --- a/arch/ppc/kernel/process.c +++ b/arch/ppc/kernel/process.c @@ -384,7 +384,7 @@ void show_regs(struct pt_regs * regs) if (trap == 0x300 || trap == 0x600) printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr); printk("TASK = %p[%d] '%s' THREAD: %p\n", - current, current->pid, current->comm, current->thread_info); + current, current->pid, current->comm, task_thread_info(current)); printk("Last syscall: %ld ", current->thread.last_syscall); #ifdef CONFIG_SMP diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c index becbfa3..e55cdda 100644 --- a/arch/ppc/kernel/smp.c +++ b/arch/ppc/kernel/smp.c @@ -318,7 +318,7 @@ void __init smp_prepare_cpus(unsigned in p = fork_idle(cpu); if (IS_ERR(p)) panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p)); - p->thread_info->cpu = cpu; + task_thread_info(p)->cpu = cpu; idle_tasks[cpu] = p; } } @@ -369,7 +369,7 @@ int __cpu_up(unsigned int cpu) char buf[32]; int c; - secondary_ti = idle_tasks[cpu]->thread_info; + secondary_ti = task_thread_info(idle_tasks[cpu]); mb(); /* -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] powerpc: task_stack_page() From: Al Viro Date: 1134156819 -0500 --- arch/powerpc/kernel/process.c | 10 ++++------ arch/ppc/kernel/process.c | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) 86d2829a621895361006cca01baef34eb05b217b diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index bc03526..1f816f0 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -503,7 +503,7 @@ int copy_thread(int nr, unsigned long cl { struct pt_regs *childregs, *kregs; extern void ret_from_fork(void); - unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; + unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; CHECK_FULL_REGS(regs); /* Copy registers */ @@ -588,10 +588,8 @@ void start_thread(struct pt_regs *regs, * set. Do it now. */ if (!current->thread.regs) { - unsigned long childregs = (unsigned long)current->thread_info + - THREAD_SIZE; - childregs -= sizeof(struct pt_regs); - current->thread.regs = (struct pt_regs *)childregs; + struct pt_regs *regs = task_stack_page(current) + THREAD_SIZE; + current->thread.regs = regs - 1; } memset(regs->gpr, 0, sizeof(regs->gpr)); @@ -767,7 +765,7 @@ out: static int validate_sp(unsigned long sp, struct task_struct *p, unsigned long nbytes) { - unsigned long stack_page = (unsigned long)p->thread_info; + unsigned long stack_page = (unsigned long)task_stack_page(p); if (sp >= stack_page + sizeof(struct thread_struct) && sp <= stack_page + THREAD_SIZE - nbytes) diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c index c3555a8..a76b504 100644 --- a/arch/ppc/kernel/process.c +++ b/arch/ppc/kernel/process.c @@ -482,7 +482,7 @@ copy_thread(int nr, unsigned long clone_ { struct pt_regs *childregs, *kregs; extern void ret_from_fork(void); - unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; + unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE; unsigned long childframe; CHECK_FULL_REGS(regs); @@ -702,8 +702,8 @@ void show_stack(struct task_struct *tsk, sp = tsk->thread.ksp; } - prev_sp = (unsigned long) (tsk->thread_info + 1); - stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE; + prev_sp = (unsigned long) end_of_stack(tsk); + stack_top = (unsigned long) task_stack_page(tsk) + THREAD_SIZE; while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) { if (count == 0) { printk("Call trace:"); @@ -832,7 +832,7 @@ void __init ll_puts(const char *s) unsigned long get_wchan(struct task_struct *p) { unsigned long ip, sp; - unsigned long stack_page = (unsigned long) p->thread_info; + unsigned long stack_page = (unsigned long) task_stack_page(p); int count = 0; if (!p || p == current || p->state == TASK_RUNNING) return 0; -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] cris: task_pt_regs() From: Al Viro Date: 1134031543 -0500 --- arch/cris/arch-v10/kernel/process.c | 4 ++-- arch/cris/arch-v10/kernel/ptrace.c | 4 ++-- arch/cris/arch-v32/kernel/process.c | 4 ++-- arch/cris/arch-v32/kernel/ptrace.c | 6 +++--- include/asm-cris/processor.h | 3 ++- 5 files changed, 11 insertions(+), 10 deletions(-) db70b06ab31e8aede06e8e122703a2f76d814033 diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c index 69e28b4..1fec580 100644 --- a/arch/cris/arch-v10/kernel/process.c +++ b/arch/cris/arch-v10/kernel/process.c @@ -79,7 +79,7 @@ void hard_reset_now (void) */ unsigned long thread_saved_pc(struct task_struct *t) { - return (unsigned long)user_regs(t->thread_info)->irp; + return task_pt_regs(t)->irp; } static void kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg) @@ -128,7 +128,7 @@ int copy_thread(int nr, unsigned long cl * remember that the task_struct doubles as the kernel stack for the task */ - childregs = user_regs(p->thread_info); + childregs = task_pt_regs(p); *childregs = *regs; /* struct copy of pt_regs */ diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c index 6cbd34a..f214f74 100644 --- a/arch/cris/arch-v10/kernel/ptrace.c +++ b/arch/cris/arch-v10/kernel/ptrace.c @@ -37,7 +37,7 @@ inline long get_reg(struct task_struct * if (regno == PT_USP) return task->thread.usp; else if (regno < PT_MAX) - return ((unsigned long *)user_regs(task->thread_info))[regno]; + return ((unsigned long *)task_pt_regs(task))[regno]; else return 0; } @@ -51,7 +51,7 @@ inline int put_reg(struct task_struct *t if (regno == PT_USP) task->thread.usp = data; else if (regno < PT_MAX) - ((unsigned long *)user_regs(task->thread_info))[regno] = data; + ((unsigned long *)task_pt_regs(task))[regno] = data; else return -1; return 0; diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c index 882be42..e88b13b 100644 --- a/arch/cris/arch-v32/kernel/process.c +++ b/arch/cris/arch-v32/kernel/process.c @@ -96,7 +96,7 @@ hard_reset_now(void) */ unsigned long thread_saved_pc(struct task_struct *t) { - return (unsigned long)user_regs(t->thread_info)->erp; + return task_pt_regs(t)->erp; } static void @@ -148,7 +148,7 @@ copy_thread(int nr, unsigned long clone_ * fix it up. Note: the task_struct doubles as the kernel stack for the * task. */ - childregs = user_regs(p->thread_info); + childregs = task_pt_regs(p); *childregs = *regs; /* Struct copy of pt_regs. */ p->set_child_tid = p->clear_child_tid = NULL; childregs->r10 = 0; /* Child returns 0 after a fork/clone. */ diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c index 5528b83..82cf2e3 100644 --- a/arch/cris/arch-v32/kernel/ptrace.c +++ b/arch/cris/arch-v32/kernel/ptrace.c @@ -46,7 +46,7 @@ long get_reg(struct task_struct *task, u unsigned long ret; if (regno <= PT_EDA) - ret = ((unsigned long *)user_regs(task->thread_info))[regno]; + ret = ((unsigned long *)task_pt_regs(task))[regno]; else if (regno == PT_USP) ret = task->thread.usp; else if (regno == PT_PPC) @@ -65,13 +65,13 @@ long get_reg(struct task_struct *task, u int put_reg(struct task_struct *task, unsigned int regno, unsigned long data) { if (regno <= PT_EDA) - ((unsigned long *)user_regs(task->thread_info))[regno] = data; + ((unsigned long *)task_pt_regs(task))[regno] = data; else if (regno == PT_USP) task->thread.usp = data; else if (regno == PT_PPC) { /* Write pseudo-PC to ERP only if changed. */ if (data != get_pseudo_pc(task)) - ((unsigned long *)user_regs(task->thread_info))[PT_ERP] = data; + task_pt_regs(task)->erp = data; } else if (regno <= PT_MAX) return put_debugreg(task->pid, regno, data); else diff --git a/include/asm-cris/processor.h b/include/asm-cris/processor.h index dce4100..961e2bc 100644 --- a/include/asm-cris/processor.h +++ b/include/asm-cris/processor.h @@ -45,7 +45,8 @@ struct task_struct; * Dito but for the currently running task */ -#define current_regs() user_regs(current->thread_info) +#define task_pt_regs(task) user_regs(task_thread_info(task)) +#define current_regs() task_pt_regs(current) static inline void prepare_to_copy(struct task_struct *tsk) { -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] cris: fix KSTK_EIP From: Al Viro Date: 1134031701 -0500 cris KSTK_EIP looked for pt_regs at the right offset but from the wrong place - forgtten ->thread_info --- include/asm-cris/arch-v10/processor.h | 2 +- include/asm-cris/arch-v32/processor.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) fafa1b29ca8d9925894c078099a9bf2e9a331998 diff --git a/include/asm-cris/arch-v10/processor.h b/include/asm-cris/arch-v10/processor.h index e23df8d..cc692c7 100644 --- a/include/asm-cris/arch-v10/processor.h +++ b/include/asm-cris/arch-v10/processor.h @@ -40,7 +40,7 @@ struct thread_struct { #define KSTK_EIP(tsk) \ ({ \ unsigned long eip = 0; \ - unsigned long regs = (unsigned long)user_regs(tsk); \ + unsigned long regs = (unsigned long)task_pt_regs(tsk); \ if (regs > PAGE_SIZE && \ virt_addr_valid(regs)) \ eip = ((struct pt_regs *)regs)->irp; \ diff --git a/include/asm-cris/arch-v32/processor.h b/include/asm-cris/arch-v32/processor.h index 8c939bf..32bf2e5 100644 --- a/include/asm-cris/arch-v32/processor.h +++ b/include/asm-cris/arch-v32/processor.h @@ -36,7 +36,7 @@ struct thread_struct { #define KSTK_EIP(tsk) \ ({ \ unsigned long eip = 0; \ - unsigned long regs = (unsigned long)user_regs(tsk); \ + unsigned long regs = (unsigned long)task_pt_regs(tsk); \ if (regs > PAGE_SIZE && virt_addr_valid(regs)) \ eip = ((struct pt_regs *)regs)->erp; \ eip; \ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] cris: task_thread_info() From: Al Viro Date: 1134031863 -0500 --- arch/cris/arch-v32/kernel/process.c | 2 +- arch/cris/arch-v32/kernel/smp.c | 4 ++-- arch/cris/arch-v32/mm/tlb.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) 230ec13ac8ed603b373305b7e8896f228c884f16 diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c index e88b13b..8435131 100644 --- a/arch/cris/arch-v32/kernel/process.c +++ b/arch/cris/arch-v32/kernel/process.c @@ -157,7 +157,7 @@ copy_thread(int nr, unsigned long clone_ * The TLS is in $mof beacuse it is the 5th argument to sys_clone. */ if (p->mm && (clone_flags & CLONE_SETTLS)) { - p->thread_info->tls = regs->mof; + task_thread_info(p)->tls = regs->mof; } /* Put the switch stack right below the pt_regs. */ diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c index 13867f4..da40d19 100644 --- a/arch/cris/arch-v32/kernel/smp.c +++ b/arch/cris/arch-v32/kernel/smp.c @@ -113,10 +113,10 @@ smp_boot_one_cpu(int cpuid) if (IS_ERR(idle)) panic("SMP: fork failed for CPU:%d", cpuid); - idle->thread_info->cpu = cpuid; + task_thread_info(idle)->cpu = cpuid; /* Information to the CPU that is about to boot */ - smp_init_current_idle_thread = idle->thread_info; + smp_init_current_idle_thread = task_thread_info(idle); cpu_now_booting = cpuid; /* Wait for CPU to come online */ diff --git a/arch/cris/arch-v32/mm/tlb.c b/arch/cris/arch-v32/mm/tlb.c index b08a28b..9d75d76 100644 --- a/arch/cris/arch-v32/mm/tlb.c +++ b/arch/cris/arch-v32/mm/tlb.c @@ -198,9 +198,9 @@ switch_mm(struct mm_struct *prev, struct per_cpu(current_pgd, cpu) = next->pgd; /* Switch context in the MMU. */ - if (tsk && tsk->thread_info) + if (tsk && task_thread_info(tsk)) { - SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | tsk->thread_info->tls); + SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | task_thread_info(tsk)->tls); } else { -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] ia64: task_thread_info() From: Al Viro Date: 1134141932 -0500 on ia64 thread_info is at the constant offset from task_struct and stack is embedded into the same beast. Set __HAVE_THREAD_FUNCTIONS, made task_thread_info() just add a constant. --- arch/ia64/kernel/mca.c | 4 ++-- arch/ia64/kernel/signal.c | 10 +++++----- include/asm-ia64/thread_info.h | 9 +++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) 9dc601ea4140d2decf6fd3765d6bb9c3c987687d diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c index 355af15..ee7eec9 100644 --- a/arch/ia64/kernel/mca.c +++ b/arch/ia64/kernel/mca.c @@ -766,7 +766,7 @@ ia64_mca_modify_original_stack(struct pt l = strlen(previous_current->comm); snprintf(comm, sizeof(comm), "%s %*s %d", current->comm, l, previous_current->comm, - previous_current->thread_info->cpu); + task_thread_info(previous_current)->cpu); } memcpy(current->comm, comm, sizeof(current->comm)); @@ -1423,7 +1423,7 @@ format_mca_init_stack(void *mca_data, un struct task_struct *p = (struct task_struct *)((char *)mca_data + offset); struct thread_info *ti; memset(p, 0, KERNEL_STACK_SIZE); - ti = (struct thread_info *)((char *)p + IA64_TASK_SIZE); + ti = task_thread_info(p); ti->flags = _TIF_MCA_INIT; ti->preempt_count = 1; ti->task = p; diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c index 58ce07e..463f6bb 100644 --- a/arch/ia64/kernel/signal.c +++ b/arch/ia64/kernel/signal.c @@ -655,11 +655,11 @@ set_sigdelayed(pid_t pid, int signo, int if (!t) return; - t->thread_info->sigdelayed.signo = signo; - t->thread_info->sigdelayed.code = code; - t->thread_info->sigdelayed.addr = addr; - t->thread_info->sigdelayed.start_time = start_time; - t->thread_info->sigdelayed.pid = pid; + task_thread_info(t)->sigdelayed.signo = signo; + task_thread_info(t)->sigdelayed.code = code; + task_thread_info(t)->sigdelayed.addr = addr; + task_thread_info(t)->sigdelayed.start_time = start_time; + task_thread_info(t)->sigdelayed.pid = pid; wmb(); set_tsk_thread_flag(t, TIF_SIGDELAYED); } diff --git a/include/asm-ia64/thread_info.h b/include/asm-ia64/thread_info.h index 171b220..653bb7f 100644 --- a/include/asm-ia64/thread_info.h +++ b/include/asm-ia64/thread_info.h @@ -57,11 +57,20 @@ struct thread_info { /* how to get the thread information struct from C */ #define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) #define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE)) +#define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE)) #else #define current_thread_info() ((struct thread_info *) 0) #define alloc_thread_info(tsk) ((struct thread_info *) 0) +#define task_thread_info(tsk) ((struct thread_info *) 0) #endif #define free_thread_info(ti) /* nothing */ +#define task_stack_page(tsk) ((void *)(tsk)) + +#define __HAVE_THREAD_FUNCTIONS +#define setup_thread_stack(p, org) \ + *task_thread_info(p) = *task_thread_info(org); \ + task_thread_info(p)->task = (p); +#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET) #define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR #define alloc_task_struct() ((task_t *)__get_free_pages(GFP_KERNEL, KERNEL_STACK_SIZE_ORDER)) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] ia64: task_pt_regs() From: Al Viro Date: 1134473415 -0500 --- arch/ia64/ia32/elfcore32.h | 3 +-- arch/ia64/ia32/ia32_signal.c | 4 ++-- arch/ia64/ia32/ia32_support.c | 4 ++-- arch/ia64/ia32/sys_ia32.c | 12 ++++++------ arch/ia64/kernel/perfmon.c | 32 ++++++++++++++++---------------- arch/ia64/kernel/process.c | 12 ++++++------ arch/ia64/kernel/ptrace.c | 24 ++++++++++++------------ arch/ia64/kernel/setup.c | 2 +- arch/ia64/kernel/sys_ia64.c | 2 +- drivers/input/evdev.c | 2 +- include/asm-ia64/compat.h | 2 +- include/asm-ia64/processor.h | 2 +- include/asm-ia64/ptrace.h | 4 ++-- include/asm-ia64/system.h | 8 ++++---- 14 files changed, 56 insertions(+), 57 deletions(-) 7756b29044ed00c85dba5ecd61d73209af28adef diff --git a/arch/ia64/ia32/elfcore32.h b/arch/ia64/ia32/elfcore32.h index b73b8b6..a47f63b 100644 --- a/arch/ia64/ia32/elfcore32.h +++ b/arch/ia64/ia32/elfcore32.h @@ -95,8 +95,7 @@ static inline void elf_core_copy_regs(el static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) { - struct pt_regs *pp = ia64_task_regs(t); - ELF_CORE_COPY_REGS((*elfregs), pp); + ELF_CORE_COPY_REGS((*elfregs), task_pt_regs(t)); return 1; } diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c index aa891c9..5856510 100644 --- a/arch/ia64/ia32/ia32_signal.c +++ b/arch/ia64/ia32/ia32_signal.c @@ -255,7 +255,7 @@ save_ia32_fpstate_live (struct _fpstate_ */ fp_tos = (fsr>>11)&0x7; fr8_st_map = (8-fp_tos)&0x7; - ptp = ia64_task_regs(tsk); + ptp = task_pt_regs(tsk); fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15); ia64f2ia32f(fpregp, &ptp->f8); copy_to_user(&save->_st[(0+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32)); @@ -389,7 +389,7 @@ restore_ia32_fpstate_live (struct _fpsta fr8_st_map = (8-fp_tos)&0x7; fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15); - ptp = ia64_task_regs(tsk); + ptp = task_pt_regs(tsk); copy_from_user(fpregp, &save->_st[(0+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32)); ia32f2ia64f(&ptp->f8, fpregp); copy_from_user(fpregp, &save->_st[(1+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32)); diff --git a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c index 4f63004..c187743 100644 --- a/arch/ia64/ia32/ia32_support.c +++ b/arch/ia64/ia32/ia32_support.c @@ -58,7 +58,7 @@ load_desc (u16 selector) void ia32_load_segment_descriptors (struct task_struct *task) { - struct pt_regs *regs = ia64_task_regs(task); + struct pt_regs *regs = task_pt_regs(task); /* Setup the segment descriptors */ regs->r24 = load_desc(regs->r16 >> 16); /* ESD */ @@ -113,7 +113,7 @@ void ia32_load_state (struct task_struct *t) { unsigned long eflag, fsr, fcr, fir, fdr, tssd; - struct pt_regs *regs = ia64_task_regs(t); + struct pt_regs *regs = task_pt_regs(t); eflag = t->thread.eflag; fsr = t->thread.fsr; diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index dc28271..5a46213 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c @@ -1481,7 +1481,7 @@ getreg (struct task_struct *child, int r { struct pt_regs *child_regs; - child_regs = ia64_task_regs(child); + child_regs = task_pt_regs(child); switch (regno / sizeof(int)) { case PT_EBX: return child_regs->r11; case PT_ECX: return child_regs->r9; @@ -1509,7 +1509,7 @@ putreg (struct task_struct *child, int r { struct pt_regs *child_regs; - child_regs = ia64_task_regs(child); + child_regs = task_pt_regs(child); switch (regno / sizeof(int)) { case PT_EBX: child_regs->r11 = value; break; case PT_ECX: child_regs->r9 = value; break; @@ -1625,7 +1625,7 @@ save_ia32_fpstate (struct task_struct *t * Stack frames start with 16-bytes of temp space */ swp = (struct switch_stack *)(tsk->thread.ksp + 16); - ptp = ia64_task_regs(tsk); + ptp = task_pt_regs(tsk); tos = (tsk->thread.fsr >> 11) & 7; for (i = 0; i < 8; i++) put_fpreg(i, &save->st_space[i], ptp, swp, tos); @@ -1658,7 +1658,7 @@ restore_ia32_fpstate (struct task_struct * Stack frames start with 16-bytes of temp space */ swp = (struct switch_stack *)(tsk->thread.ksp + 16); - ptp = ia64_task_regs(tsk); + ptp = task_pt_regs(tsk); tos = (tsk->thread.fsr >> 11) & 7; for (i = 0; i < 8; i++) get_fpreg(i, &save->st_space[i], ptp, swp, tos); @@ -1689,7 +1689,7 @@ save_ia32_fpxstate (struct task_struct * * Stack frames start with 16-bytes of temp space */ swp = (struct switch_stack *)(tsk->thread.ksp + 16); - ptp = ia64_task_regs(tsk); + ptp = task_pt_regs(tsk); tos = (tsk->thread.fsr >> 11) & 7; for (i = 0; i < 8; i++) put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos); @@ -1733,7 +1733,7 @@ restore_ia32_fpxstate (struct task_struc * Stack frames start with 16-bytes of temp space */ swp = (struct switch_stack *)(tsk->thread.ksp + 16); - ptp = ia64_task_regs(tsk); + ptp = task_pt_regs(tsk); tos = (tsk->thread.fsr >> 11) & 7; for (i = 0; i < 8; i++) get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos); diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index 410d480..a3f9e79 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c @@ -1709,7 +1709,7 @@ static void pfm_syswide_force_stop(void *info) { pfm_context_t *ctx = (pfm_context_t *)info; - struct pt_regs *regs = ia64_task_regs(current); + struct pt_regs *regs = task_pt_regs(current); struct task_struct *owner; unsigned long flags; int ret; @@ -1814,7 +1814,7 @@ pfm_flush(struct file *filp) is_system = ctx->ctx_fl_system; task = PFM_CTX_TASK(ctx); - regs = ia64_task_regs(task); + regs = task_pt_regs(task); DPRINT(("ctx_state=%d is_current=%d\n", state, @@ -1944,7 +1944,7 @@ pfm_close(struct inode *inode, struct fi is_system = ctx->ctx_fl_system; task = PFM_CTX_TASK(ctx); - regs = ia64_task_regs(task); + regs = task_pt_regs(task); DPRINT(("ctx_state=%d is_current=%d\n", state, @@ -4051,7 +4051,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, */ ia64_psr(regs)->up = 0; } else { - tregs = ia64_task_regs(task); + tregs = task_pt_regs(task); /* * stop monitoring at the user level @@ -4133,7 +4133,7 @@ pfm_start(pfm_context_t *ctx, void *arg, ia64_psr(regs)->up = 1; } else { - tregs = ia64_task_regs(ctx->ctx_task); + tregs = task_pt_regs(ctx->ctx_task); /* * start monitoring at the kernel level the next @@ -4403,7 +4403,7 @@ pfm_context_load(pfm_context_t *ctx, voi /* * when not current, task MUST be stopped, so this is safe */ - regs = ia64_task_regs(task); + regs = task_pt_regs(task); /* force a full reload */ ctx->ctx_last_activation = PFM_INVALID_ACTIVATION; @@ -4529,7 +4529,7 @@ pfm_context_unload(pfm_context_t *ctx, v /* * per-task mode */ - tregs = task == current ? regs : ia64_task_regs(task); + tregs = task == current ? regs : task_pt_regs(task); if (task == current) { /* @@ -4592,7 +4592,7 @@ pfm_exit_thread(struct task_struct *task { pfm_context_t *ctx; unsigned long flags; - struct pt_regs *regs = ia64_task_regs(task); + struct pt_regs *regs = task_pt_regs(task); int ret, state; int free_ok = 0; @@ -4925,7 +4925,7 @@ restart_args: if (unlikely(ret)) goto abort_locked; skip_fd: - ret = (*func)(ctx, args_k, count, ia64_task_regs(current)); + ret = (*func)(ctx, args_k, count, task_pt_regs(current)); call_made = 1; @@ -5049,7 +5049,7 @@ pfm_handle_work(void) pfm_clear_task_notify(); - regs = ia64_task_regs(current); + regs = task_pt_regs(current); /* * extract reason for being here and clear @@ -5793,7 +5793,7 @@ pfm_syst_wide_update_task(struct task_st * on every CPU, so we can rely on the pid to identify the idle task. */ if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) { - regs = ia64_task_regs(task); + regs = task_pt_regs(task); ia64_psr(regs)->pp = is_ctxswin ? dcr_pp : 0; return; } @@ -5876,7 +5876,7 @@ pfm_save_regs(struct task_struct *task) flags = pfm_protect_ctx_ctxsw(ctx); if (ctx->ctx_state == PFM_CTX_ZOMBIE) { - struct pt_regs *regs = ia64_task_regs(task); + struct pt_regs *regs = task_pt_regs(task); pfm_clear_psr_up(); @@ -6076,7 +6076,7 @@ pfm_load_regs (struct task_struct *task) BUG_ON(psr & IA64_PSR_I); if (unlikely(ctx->ctx_state == PFM_CTX_ZOMBIE)) { - struct pt_regs *regs = ia64_task_regs(task); + struct pt_regs *regs = task_pt_regs(task); BUG_ON(ctx->ctx_smpl_hdr); @@ -6445,7 +6445,7 @@ pfm_alt_save_pmu_state(void *data) { struct pt_regs *regs; - regs = ia64_task_regs(current); + regs = task_pt_regs(current); DPRINT(("called\n")); @@ -6471,7 +6471,7 @@ pfm_alt_restore_pmu_state(void *data) { struct pt_regs *regs; - regs = ia64_task_regs(current); + regs = task_pt_regs(current); DPRINT(("called\n")); @@ -6753,7 +6753,7 @@ dump_pmu_state(const char *from) local_irq_save(flags); this_cpu = smp_processor_id(); - regs = ia64_task_regs(current); + regs = task_pt_regs(current); info = PFM_CPUINFO_GET(); dcr = ia64_getreg(_IA64_REG_CR_DCR); diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c index a4da715..bd72f11 100644 --- a/arch/ia64/kernel/process.c +++ b/arch/ia64/kernel/process.c @@ -328,7 +328,7 @@ ia64_save_extra (struct task_struct *tas #endif #ifdef CONFIG_IA32_SUPPORT - if (IS_IA32_PROCESS(ia64_task_regs(task))) + if (IS_IA32_PROCESS(task_pt_regs(task))) ia32_save_state(task); #endif } @@ -353,7 +353,7 @@ ia64_load_extra (struct task_struct *tas #endif #ifdef CONFIG_IA32_SUPPORT - if (IS_IA32_PROCESS(ia64_task_regs(task))) + if (IS_IA32_PROCESS(task_pt_regs(task))) ia32_load_state(task); #endif } @@ -488,7 +488,7 @@ copy_thread (int nr, unsigned long clone * If we're cloning an IA32 task then save the IA32 extra * state from the current task to the new task */ - if (IS_IA32_PROCESS(ia64_task_regs(current))) { + if (IS_IA32_PROCESS(task_pt_regs(current))) { ia32_save_state(p); if (clone_flags & CLONE_SETTLS) retval = ia32_clone_tls(p, child_ptregs); @@ -701,7 +701,7 @@ int kernel_thread_helper (int (*fn)(void *), void *arg) { #ifdef CONFIG_IA32_SUPPORT - if (IS_IA32_PROCESS(ia64_task_regs(current))) { + if (IS_IA32_PROCESS(task_pt_regs(current))) { /* A kernel thread is always a 64-bit process. */ current->thread.map_base = DEFAULT_MAP_BASE; current->thread.task_size = DEFAULT_TASK_SIZE; @@ -721,7 +721,7 @@ flush_thread (void) /* drop floating-point and debug-register state if it exists: */ current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); ia64_drop_fpu(current); - if (IS_IA32_PROCESS(ia64_task_regs(current))) { + if (IS_IA32_PROCESS(task_pt_regs(current))) { ia32_drop_partial_page_list(current); current->thread.task_size = IA32_PAGE_OFFSET; set_fs(USER_DS); @@ -753,7 +753,7 @@ exit_thread (void) if (current->thread.flags & IA64_THREAD_DBG_VALID) pfm_release_debug_registers(current); #endif - if (IS_IA32_PROCESS(ia64_task_regs(current))) + if (IS_IA32_PROCESS(task_pt_regs(current))) ia32_drop_partial_page_list(current); } diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 4b19d04..c6f98e2 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c @@ -254,7 +254,7 @@ get_rnat (struct task_struct *task, stru long num_regs, nbits; struct pt_regs *pt; - pt = ia64_task_regs(task); + pt = task_pt_regs(task); kbsp = (unsigned long *) sw->ar_bspstore; ubspstore = (unsigned long *) pt->ar_bspstore; @@ -314,7 +314,7 @@ put_rnat (struct task_struct *task, stru struct pt_regs *pt; unsigned long cfm, *urbs_kargs; - pt = ia64_task_regs(task); + pt = task_pt_regs(task); kbsp = (unsigned long *) sw->ar_bspstore; ubspstore = (unsigned long *) pt->ar_bspstore; @@ -407,7 +407,7 @@ ia64_peek (struct task_struct *child, st urbs_end = (long *) user_rbs_end; laddr = (unsigned long *) addr; - child_regs = ia64_task_regs(child); + child_regs = task_pt_regs(child); bspstore = (unsigned long *) child_regs->ar_bspstore; krbs = (unsigned long *) child + IA64_RBS_OFFSET/8; if (on_kernel_rbs(addr, (unsigned long) bspstore, @@ -467,7 +467,7 @@ ia64_poke (struct task_struct *child, st struct pt_regs *child_regs; laddr = (unsigned long *) addr; - child_regs = ia64_task_regs(child); + child_regs = task_pt_regs(child); bspstore = (unsigned long *) child_regs->ar_bspstore; krbs = (unsigned long *) child + IA64_RBS_OFFSET/8; if (on_kernel_rbs(addr, (unsigned long) bspstore, @@ -567,7 +567,7 @@ thread_matches (struct task_struct *thre */ return 0; - thread_regs = ia64_task_regs(thread); + thread_regs = task_pt_regs(thread); thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL); if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end)) return 0; @@ -627,7 +627,7 @@ find_thread_for_addr (struct task_struct inline void ia64_flush_fph (struct task_struct *task) { - struct ia64_psr *psr = ia64_psr(ia64_task_regs(task)); + struct ia64_psr *psr = ia64_psr(task_pt_regs(task)); /* * Prevent migrating this task while @@ -653,7 +653,7 @@ ia64_flush_fph (struct task_struct *task void ia64_sync_fph (struct task_struct *task) { - struct ia64_psr *psr = ia64_psr(ia64_task_regs(task)); + struct ia64_psr *psr = ia64_psr(task_pt_regs(task)); ia64_flush_fph(task); if (!(task->thread.flags & IA64_THREAD_FPH_VALID)) { @@ -794,7 +794,7 @@ access_uarea (struct task_struct *child, + offsetof(struct pt_regs, reg))) - pt = ia64_task_regs(child); + pt = task_pt_regs(child); sw = (struct switch_stack *) (child->thread.ksp + 16); if ((addr & 0x7) != 0) { @@ -1120,7 +1120,7 @@ ptrace_getregs (struct task_struct *chil if (!access_ok(VERIFY_WRITE, ppr, sizeof(struct pt_all_user_regs))) return -EIO; - pt = ia64_task_regs(child); + pt = task_pt_regs(child); sw = (struct switch_stack *) (child->thread.ksp + 16); unw_init_from_blocked_task(&info, child); if (unw_unwind_to_user(&info) < 0) { @@ -1265,7 +1265,7 @@ ptrace_setregs (struct task_struct *chil if (!access_ok(VERIFY_READ, ppr, sizeof(struct pt_all_user_regs))) return -EIO; - pt = ia64_task_regs(child); + pt = task_pt_regs(child); sw = (struct switch_stack *) (child->thread.ksp + 16); unw_init_from_blocked_task(&info, child); if (unw_unwind_to_user(&info) < 0) { @@ -1403,7 +1403,7 @@ ptrace_setregs (struct task_struct *chil void ptrace_disable (struct task_struct *child) { - struct ia64_psr *child_psr = ia64_psr(ia64_task_regs(child)); + struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child)); /* make sure the single step/taken-branch trap bits are not set: */ child_psr->ss = 0; @@ -1463,7 +1463,7 @@ sys_ptrace (long request, pid_t pid, uns if (ret < 0) goto out_tsk; - pt = ia64_task_regs(child); + pt = task_pt_regs(child); sw = (struct switch_stack *) (child->thread.ksp + 16); switch (request) { diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 5add0bc..acf87c6 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -788,7 +788,7 @@ cpu_init (void) #endif /* Clear the stack memory reserved for pt_regs: */ - memset(ia64_task_regs(current), 0, sizeof(struct pt_regs)); + memset(task_pt_regs(current), 0, sizeof(struct pt_regs)); ia64_set_kr(IA64_KR_FPU_OWNER, 0); diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index f2dbcd1..c7b943f 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c @@ -151,7 +151,7 @@ out: asmlinkage long sys_pipe (void) { - struct pt_regs *regs = ia64_task_regs(current); + struct pt_regs *regs = task_pt_regs(current); int fd[2]; int retval; diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 9f2352b..f5a9305 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c @@ -156,7 +156,7 @@ struct input_event_compat { #ifdef CONFIG_X86_64 # define COMPAT_TEST test_thread_flag(TIF_IA32) #elif defined(CONFIG_IA64) -# define COMPAT_TEST IS_IA32_PROCESS(ia64_task_regs(current)) +# define COMPAT_TEST IS_IA32_PROCESS(task_pt_regs(current)) #elif defined(CONFIG_ARCH_S390) # define COMPAT_TEST test_thread_flag(TIF_31BIT) #elif defined(CONFIG_MIPS) diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h index aaf11f4..c0b1910 100644 --- a/include/asm-ia64/compat.h +++ b/include/asm-ia64/compat.h @@ -192,7 +192,7 @@ compat_ptr (compat_uptr_t uptr) static __inline__ void __user * compat_alloc_user_space (long len) { - struct pt_regs *regs = ia64_task_regs(current); + struct pt_regs *regs = task_pt_regs(current); return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len); } diff --git a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h index 94e07e7..8c648bf 100644 --- a/include/asm-ia64/processor.h +++ b/include/asm-ia64/processor.h @@ -352,7 +352,7 @@ extern unsigned long get_wchan (struct t /* Return instruction pointer of blocked task TSK. */ #define KSTK_EIP(tsk) \ ({ \ - struct pt_regs *_regs = ia64_task_regs(tsk); \ + struct pt_regs *_regs = task_pt_regs(tsk); \ _regs->cr_iip + ia64_psr(_regs)->ri; \ }) diff --git a/include/asm-ia64/ptrace.h b/include/asm-ia64/ptrace.h index 2c703d6..9471cdc 100644 --- a/include/asm-ia64/ptrace.h +++ b/include/asm-ia64/ptrace.h @@ -248,7 +248,7 @@ struct switch_stack { }) /* given a pointer to a task_struct, return the user's pt_regs */ -# define ia64_task_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) +# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) # define ia64_psr(regs) ((struct ia64_psr *) &(regs)->cr_ipsr) # define user_mode(regs) (((struct ia64_psr *) &(regs)->cr_ipsr)->cpl != 0) # define user_stack(task,regs) ((long) regs - (long) task == IA64_STK_OFFSET - sizeof(*regs)) @@ -271,7 +271,7 @@ struct switch_stack { * * On ia64, we can clear the user's pt_regs->r8 to force a successful syscall. */ -# define force_successful_syscall_return() (ia64_task_regs(current)->r8 = 0) +# define force_successful_syscall_return() (task_pt_regs(current)->r8 = 0) struct task_struct; /* forward decl */ struct unw_frame_info; /* forward decl */ diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h index 635235f..b49d064 100644 --- a/include/asm-ia64/system.h +++ b/include/asm-ia64/system.h @@ -219,14 +219,14 @@ extern void ia64_load_extra (struct task #define IA64_HAS_EXTRA_STATE(t) \ ((t)->thread.flags & (IA64_THREAD_DBG_VALID|IA64_THREAD_PM_VALID) \ - || IS_IA32_PROCESS(ia64_task_regs(t)) || PERFMON_IS_SYSWIDE()) + || IS_IA32_PROCESS(task_pt_regs(t)) || PERFMON_IS_SYSWIDE()) #define __switch_to(prev,next,last) do { \ if (IA64_HAS_EXTRA_STATE(prev)) \ ia64_save_extra(prev); \ if (IA64_HAS_EXTRA_STATE(next)) \ ia64_load_extra(next); \ - ia64_psr(ia64_task_regs(next))->dfh = !ia64_is_local_fpu_owner(next); \ + ia64_psr(task_pt_regs(next))->dfh = !ia64_is_local_fpu_owner(next); \ (last) = ia64_switch_to((next)); \ } while (0) @@ -238,8 +238,8 @@ extern void ia64_load_extra (struct task * the latest fph state from another CPU. In other words: eager save, lazy restore. */ # define switch_to(prev,next,last) do { \ - if (ia64_psr(ia64_task_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) { \ - ia64_psr(ia64_task_regs(prev))->mfh = 0; \ + if (ia64_psr(task_pt_regs(prev))->mfh && ia64_is_local_fpu_owner(prev)) { \ + ia64_psr(task_pt_regs(prev))->mfh = 0; \ (prev)->thread.flags |= IA64_THREAD_FPH_VALID; \ __ia64_save_fpu((prev)->thread.fph); \ } \ -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] mips: namespace pollution: dump_regs() -> elf_dump_regs() From: Al Viro Date: 1134015130 -0500 dump_regs() is used by a bunch of drivers for their internal stuff; renamed mips instance (one that is seen in system-wide headers) to elf_dump_regs() --- arch/mips/kernel/process.c | 4 ++-- include/asm-mips/elf.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 7cb0f5ab7ecf09fc83483f3f2b0d2005d789dba5 diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index dd72577..0476a4d 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -205,7 +205,7 @@ int dump_fpu(struct pt_regs *regs, elf_f return 1; } -void dump_regs(elf_greg_t *gp, struct pt_regs *regs) +void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs) { int i; @@ -231,7 +231,7 @@ int dump_task_regs (struct task_struct * { struct thread_info *ti = tsk->thread_info; long ksp = (unsigned long)ti + THREAD_SIZE - 32; - dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1); + elf_dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1); return 1; } diff --git a/include/asm-mips/elf.h b/include/asm-mips/elf.h index d2c9a25..851f013 100644 --- a/include/asm-mips/elf.h +++ b/include/asm-mips/elf.h @@ -277,12 +277,12 @@ do { \ struct task_struct; -extern void dump_regs(elf_greg_t *, struct pt_regs *regs); +extern void elf_dump_regs(elf_greg_t *, struct pt_regs *regs); extern int dump_task_regs (struct task_struct *, elf_gregset_t *); extern int dump_task_fpu(struct task_struct *, elf_fpregset_t *); #define ELF_CORE_COPY_REGS(elf_regs, regs) \ - dump_regs((elf_greg_t *)&(elf_regs), regs); + elf_dump_regs((elf_greg_t *)&(elf_regs), regs); #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs) #define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) \ dump_task_fpu(tsk, elf_fpregs) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] mips: task_pt_regs() From: Al Viro Date: 1133953015 -0500 --- arch/mips/kernel/process.c | 4 +--- arch/mips/kernel/ptrace.c | 12 ++++-------- arch/mips/kernel/ptrace32.c | 6 ++---- include/asm-mips/processor.h | 8 ++++---- include/asm-mips/system.h | 2 +- 5 files changed, 12 insertions(+), 20 deletions(-) 9608d955fa48c8d4b23740ad46a001bc63860dac diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 0476a4d..aca56f4 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -229,9 +229,7 @@ void elf_dump_regs(elf_greg_t *gp, struc int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs) { - struct thread_info *ti = tsk->thread_info; - long ksp = (unsigned long)ti + THREAD_SIZE - 32; - elf_dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1); + elf_dump_regs(*regs, task_pt_regs(tsk)); return 1; } diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 510da5f..506fef3 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -64,8 +64,7 @@ int ptrace_getregs (struct task_struct * if (!access_ok(VERIFY_WRITE, data, 38 * 8)) return -EIO; - regs = (struct pt_regs *) ((unsigned long) child->thread_info + - THREAD_SIZE - 32 - sizeof(struct pt_regs)); + regs = task_pt_regs(child); for (i = 0; i < 32; i++) __put_user (regs->regs[i], data + i); @@ -92,8 +91,7 @@ int ptrace_setregs (struct task_struct * if (!access_ok(VERIFY_READ, data, 38 * 8)) return -EIO; - regs = (struct pt_regs *) ((unsigned long) child->thread_info + - THREAD_SIZE - 32 - sizeof(struct pt_regs)); + regs = task_pt_regs(child); for (i = 0; i < 32; i++) __get_user (regs->regs[i], data + i); @@ -198,8 +196,7 @@ long arch_ptrace(struct task_struct *chi struct pt_regs *regs; unsigned long tmp = 0; - regs = (struct pt_regs *) ((unsigned long) child->thread_info + - THREAD_SIZE - 32 - sizeof(struct pt_regs)); + regs = task_pt_regs(child); ret = 0; /* Default return value. */ switch (addr) { @@ -318,8 +315,7 @@ long arch_ptrace(struct task_struct *chi case PTRACE_POKEUSR: { struct pt_regs *regs; ret = 0; - regs = (struct pt_regs *) ((unsigned long) child->thread_info + - THREAD_SIZE - 32 - sizeof(struct pt_regs)); + regs = task_pt_regs(child); switch (addr) { case 0 ... 31: diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index 9a9b049..5d022b0 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c @@ -140,8 +140,7 @@ asmlinkage int sys32_ptrace(int request, struct pt_regs *regs; unsigned int tmp; - regs = (struct pt_regs *) ((unsigned long) child->thread_info + - THREAD_SIZE - 32 - sizeof(struct pt_regs)); + regs = task_pt_regs(child); ret = 0; /* Default return value. */ switch (addr) { @@ -277,8 +276,7 @@ asmlinkage int sys32_ptrace(int request, case PTRACE_POKEUSR: { struct pt_regs *regs; ret = 0; - regs = (struct pt_regs *) ((unsigned long) child->thread_info + - THREAD_SIZE - 32 - sizeof(struct pt_regs)); + regs = task_pt_regs(child); switch (addr) { case 0 ... 31: diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h index f1980c6..2bbbf87 100644 --- a/include/asm-mips/processor.h +++ b/include/asm-mips/processor.h @@ -201,11 +201,11 @@ extern void start_thread(struct pt_regs unsigned long get_wchan(struct task_struct *p); -#define __PT_REG(reg) ((long)&((struct pt_regs *)0)->reg - sizeof(struct pt_regs)) #define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32) -#define KSTK_EIP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_epc))) -#define KSTK_ESP(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(regs[29]))) -#define KSTK_STATUS(tsk) (*(unsigned long *)(__KSTK_TOS(tsk) + __PT_REG(cp0_status))) +#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1) +#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc) +#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) +#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status) #define cpu_relax() barrier() diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h index 330c4e4..f78af75 100644 --- a/include/asm-mips/system.h +++ b/include/asm-mips/system.h @@ -159,7 +159,7 @@ struct task_struct; do { \ if (cpu_has_dsp) \ __save_dsp(prev); \ - (last) = resume(prev, next, next->thread_info); \ + (last) = resume(prev, next, task_thread_info(next)); \ if (cpu_has_dsp) \ __restore_dsp(current); \ } while(0) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] mips: task_thread_info() From: Al Viro Date: 1133953697 -0500 --- arch/mips/kernel/ptrace.c | 2 +- arch/mips/kernel/ptrace32.c | 4 ++-- arch/mips/kernel/smp_mt.c | 7 +++---- arch/mips/kernel/syscall.c | 2 +- arch/mips/kernel/traps.c | 2 +- arch/mips/pmc-sierra/yosemite/smp.c | 4 ++-- arch/mips/sgi-ip27/ip27-smp.c | 4 ++-- arch/mips/sibyte/cfe/smp.c | 2 +- 8 files changed, 13 insertions(+), 14 deletions(-) ad2d17192c1e11f43870bc57bc35cb4d4bde2de8 diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 506fef3..9de759e 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c @@ -442,7 +442,7 @@ long arch_ptrace(struct task_struct *chi break; case PTRACE_GET_THREAD_AREA: - ret = put_user(child->thread_info->tp_value, + ret = put_user(task_thread_info(child)->tp_value, (unsigned long __user *) data); break; diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index 5d022b0..9433f06 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c @@ -393,7 +393,7 @@ asmlinkage int sys32_ptrace(int request, break; case PTRACE_GET_THREAD_AREA: - ret = put_user(child->thread_info->tp_value, + ret = put_user(task_thread_info(child)->tp_value, (unsigned int __user *) (unsigned long) data); break; @@ -407,7 +407,7 @@ asmlinkage int sys32_ptrace(int request, break; case PTRACE_GET_THREAD_AREA_3264: - ret = put_user(child->thread_info->tp_value, + ret = put_user(task_thread_info(child)->tp_value, (unsigned long __user *) (unsigned long) data); break; diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp_mt.c index d429544..794a1c3 100644 --- a/arch/mips/kernel/smp_mt.c +++ b/arch/mips/kernel/smp_mt.c @@ -287,6 +287,7 @@ void prom_prepare_cpus(unsigned int max_ */ void prom_boot_secondary(int cpu, struct task_struct *idle) { + struct thread_info *gp = task_thread_info(idle); dvpe(); set_c0_mvpcontrol(MVPCONTROL_VPC); @@ -307,11 +308,9 @@ void prom_boot_secondary(int cpu, struct write_tc_gpr_sp( __KSTK_TOS(idle)); /* global pointer */ - write_tc_gpr_gp((unsigned long)idle->thread_info); + write_tc_gpr_gp((unsigned long)gp); - flush_icache_range((unsigned long)idle->thread_info, - (unsigned long)idle->thread_info + - sizeof(struct thread_info)); + flush_icache_range((unsigned long)gp, (unsigned long)(gp + 1)); /* finally out of configuration and into chaos */ clear_c0_mvpcontrol(MVPCONTROL_VPC); diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index ee98eeb..42fb39f 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -262,7 +262,7 @@ asmlinkage int sys_olduname(struct oldol void sys_set_thread_area(unsigned long addr) { - struct thread_info *ti = current->thread_info; + struct thread_info *ti = task_thread_info(current); ti->tp_value = addr; diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c index 7058893..59a1879 100644 --- a/arch/mips/kernel/traps.c +++ b/arch/mips/kernel/traps.c @@ -519,7 +519,7 @@ static inline int simulate_llsc(struct p */ static inline int simulate_rdhwr(struct pt_regs *regs) { - struct thread_info *ti = current->thread_info; + struct thread_info *ti = task_thread_info(current); unsigned int opcode; if (unlikely(get_insn_opcode(regs, &opcode))) diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c index 0527170..f17f575 100644 --- a/arch/mips/pmc-sierra/yosemite/smp.c +++ b/arch/mips/pmc-sierra/yosemite/smp.c @@ -93,8 +93,8 @@ void __init prom_prepare_cpus(unsigned i */ void prom_boot_secondary(int cpu, struct task_struct *idle) { - unsigned long gp = (unsigned long) idle->thread_info; - unsigned long sp = gp + THREAD_SIZE - 32; + unsigned long gp = (unsigned long) task_thread_info(idle); + unsigned long sp = __KSTK_TOP(idle); secondary_sp = sp; secondary_gp = gp; diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c index 3a8291b..dbef3f6 100644 --- a/arch/mips/sgi-ip27/ip27-smp.c +++ b/arch/mips/sgi-ip27/ip27-smp.c @@ -168,8 +168,8 @@ void __init prom_prepare_cpus(unsigned i */ void __init prom_boot_secondary(int cpu, struct task_struct *idle) { - unsigned long gp = (unsigned long) idle->thread_info; - unsigned long sp = gp + THREAD_SIZE - 32; + unsigned long gp = (unsigned long)task_thread_info(idle); + unsigned long sp = __KSTK_TOS(idle); LAUNCH_SLAVE(cputonasid(cpu),cputoslice(cpu), (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap), diff --git a/arch/mips/sibyte/cfe/smp.c b/arch/mips/sibyte/cfe/smp.c index e848512..4477af3 100644 --- a/arch/mips/sibyte/cfe/smp.c +++ b/arch/mips/sibyte/cfe/smp.c @@ -60,7 +60,7 @@ void prom_boot_secondary(int cpu, struct retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap, __KSTK_TOS(idle), - (unsigned long)idle->thread_info, 0); + (unsigned long)task_thread_info(idle), 0); if (retval != 0) printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval); } -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] mips: task_stack_page() From: Al Viro Date: 1134150609 -0500 --- arch/mips/kernel/process.c | 6 +++--- include/asm-mips/processor.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 4802bc37504af6a799d191225aecb5094f36be49 diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index aca56f4..fa98f10 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -140,12 +140,12 @@ void flush_thread(void) int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, unsigned long unused, struct task_struct *p, struct pt_regs *regs) { - struct thread_info *ti = p->thread_info; + struct thread_info *ti = task_thread_info(p); struct pt_regs *childregs; long childksp; p->set_child_tid = p->clear_child_tid = NULL; - childksp = (unsigned long)ti + THREAD_SIZE - 32; + childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32; preempt_disable(); @@ -407,7 +407,7 @@ unsigned long get_wchan(struct task_stru if (!p || p == current || p->state == TASK_RUNNING) return 0; - stack_page = (unsigned long)p->thread_info; + stack_page = (unsigned long)task_stack_page(p); if (!stack_page || !mips_frame_info_initialized) return 0; diff --git a/include/asm-mips/processor.h b/include/asm-mips/processor.h index 2bbbf87..6918362 100644 --- a/include/asm-mips/processor.h +++ b/include/asm-mips/processor.h @@ -201,7 +201,7 @@ extern void start_thread(struct pt_regs unsigned long get_wchan(struct task_struct *p); -#define __KSTK_TOS(tsk) ((unsigned long)(tsk->thread_info) + THREAD_SIZE - 32) +#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(task) + THREAD_SIZE - 32) #define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1) #define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc) #define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29]) -- 0.99.9.GIT From nobody Mon Sep 17 00:00:00 2001 Subject: [PATCH] death of get_thread_info/put_thread_info From: Al Viro Date: 1134210065 -0500 {get,put}_thread_info() are remnants of old attempt to merge m68k tricks that had been dealt with by task_thread_info() patches. They were never called in mainline tree and are not used even in m68k CVS these days. --- include/asm-alpha/thread_info.h | 2 -- include/asm-arm/thread_info.h | 3 --- include/asm-arm26/thread_info.h | 3 --- include/asm-cris/thread_info.h | 2 -- include/asm-frv/thread_info.h | 2 -- include/asm-h8300/thread_info.h | 2 -- include/asm-i386/thread_info.h | 2 -- include/asm-m32r/thread_info.h | 2 -- include/asm-m68knommu/thread_info.h | 2 -- include/asm-mips/thread_info.h | 2 -- include/asm-parisc/thread_info.h | 3 --- include/asm-powerpc/thread_info.h | 3 --- include/asm-s390/thread_info.h | 2 -- include/asm-sh/thread_info.h | 2 -- include/asm-sh64/thread_info.h | 2 -- include/asm-sparc/thread_info.h | 3 --- include/asm-um/thread_info.h | 3 --- include/asm-v850/thread_info.h | 2 -- include/asm-x86_64/thread_info.h | 2 -- include/asm-xtensa/thread_info.h | 2 -- 20 files changed, 0 insertions(+), 46 deletions(-) aa2f937c8a93c699f772d7851dbf4f6d67a30e63 diff --git a/include/asm-alpha/thread_info.h b/include/asm-alpha/thread_info.h index d51491e..69ffd93 100644 --- a/include/asm-alpha/thread_info.h +++ b/include/asm-alpha/thread_info.h @@ -54,8 +54,6 @@ register struct thread_info *__current_t #define alloc_thread_info(tsk) \ ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* __ASSEMBLY__ */ diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h index 46a4e98..33a33cb 100644 --- a/include/asm-arm/thread_info.h +++ b/include/asm-arm/thread_info.h @@ -96,9 +96,6 @@ static inline struct thread_info *curren extern struct thread_info *alloc_thread_info(struct task_struct *task); extern void free_thread_info(struct thread_info *); -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - #define thread_saved_pc(tsk) \ ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) #define thread_saved_fp(tsk) \ diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h index 7a35e7a..a65e58a 100644 --- a/include/asm-arm26/thread_info.h +++ b/include/asm-arm26/thread_info.h @@ -87,9 +87,6 @@ static inline struct thread_info *curren extern struct thread_info *alloc_thread_info(struct task_struct *task); extern void free_thread_info(struct thread_info *); -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - #define thread_saved_pc(tsk) \ ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc))) #define thread_saved_fp(tsk) \ diff --git a/include/asm-cris/thread_info.h b/include/asm-cris/thread_info.h index cef0140..7ad853c 100644 --- a/include/asm-cris/thread_info.h +++ b/include/asm-cris/thread_info.h @@ -69,8 +69,6 @@ struct thread_info { /* thread information allocation */ #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* !__ASSEMBLY__ */ diff --git a/include/asm-frv/thread_info.h b/include/asm-frv/thread_info.h index 60f6b2a..a5576e0 100644 --- a/include/asm-frv/thread_info.h +++ b/include/asm-frv/thread_info.h @@ -110,8 +110,6 @@ register struct thread_info *__current_t #endif #define free_thread_info(info) kfree(info) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #else /* !__ASSEMBLY__ */ diff --git a/include/asm-h8300/thread_info.h b/include/asm-h8300/thread_info.h index bfcc755..45f09dc 100644 --- a/include/asm-h8300/thread_info.h +++ b/include/asm-h8300/thread_info.h @@ -69,8 +69,6 @@ static inline struct thread_info *curren #define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* __ASSEMBLY__ */ /* diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h index 8fbf791..2493e77 100644 --- a/include/asm-i386/thread_info.h +++ b/include/asm-i386/thread_info.h @@ -111,8 +111,6 @@ register unsigned long current_stack_poi #endif #define free_thread_info(info) kfree(info) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #else /* !__ASSEMBLY__ */ diff --git a/include/asm-m32r/thread_info.h b/include/asm-m32r/thread_info.h index 0f58936..22aff32 100644 --- a/include/asm-m32r/thread_info.h +++ b/include/asm-m32r/thread_info.h @@ -110,8 +110,6 @@ static inline struct thread_info *curren #endif #define free_thread_info(info) kfree(info) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #define TI_FLAG_FAULT_CODE_SHIFT 28 diff --git a/include/asm-m68knommu/thread_info.h b/include/asm-m68knommu/thread_info.h index 7b9a3fa..b8f009e 100644 --- a/include/asm-m68knommu/thread_info.h +++ b/include/asm-m68knommu/thread_info.h @@ -75,8 +75,6 @@ static inline struct thread_info *curren #define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_SIZE_ORDER) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* __ASSEMBLY__ */ #define PREEMPT_ACTIVE 0x4000000 diff --git a/include/asm-mips/thread_info.h b/include/asm-mips/thread_info.h index e6c2447..1612b3f 100644 --- a/include/asm-mips/thread_info.h +++ b/include/asm-mips/thread_info.h @@ -97,8 +97,6 @@ register struct thread_info *__current_t #endif #define free_thread_info(info) kfree(info) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* !__ASSEMBLY__ */ diff --git a/include/asm-parisc/thread_info.h b/include/asm-parisc/thread_info.h index 57bbb76..ac32f14 100644 --- a/include/asm-parisc/thread_info.h +++ b/include/asm-parisc/thread_info.h @@ -43,9 +43,6 @@ struct thread_info { #define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - /* how to get the thread information struct from C */ #define current_thread_info() ((struct thread_info *)mfctl(30)) diff --git a/include/asm-powerpc/thread_info.h b/include/asm-powerpc/thread_info.h index e525f49..5d7dc48 100644 --- a/include/asm-powerpc/thread_info.h +++ b/include/asm-powerpc/thread_info.h @@ -90,9 +90,6 @@ struct thread_info { #endif /* THREAD_SHIFT < PAGE_SHIFT */ -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) { diff --git a/include/asm-s390/thread_info.h b/include/asm-s390/thread_info.h index 6c18a3f..f3797a5 100644 --- a/include/asm-s390/thread_info.h +++ b/include/asm-s390/thread_info.h @@ -81,8 +81,6 @@ static inline struct thread_info *curren #define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL,THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti),THREAD_ORDER) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h index 46080ce..85f0c11 100644 --- a/include/asm-sh/thread_info.h +++ b/include/asm-sh/thread_info.h @@ -60,8 +60,6 @@ static inline struct thread_info *curren #define THREAD_SIZE (2*PAGE_SIZE) #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #else /* !__ASSEMBLY__ */ diff --git a/include/asm-sh64/thread_info.h b/include/asm-sh64/thread_info.h index 10f024c..1f825cb 100644 --- a/include/asm-sh64/thread_info.h +++ b/include/asm-sh64/thread_info.h @@ -66,8 +66,6 @@ static inline struct thread_info *curren #define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* __ASSEMBLY__ */ diff --git a/include/asm-sparc/thread_info.h b/include/asm-sparc/thread_info.h index ff6ccb3..65f060b 100644 --- a/include/asm-sparc/thread_info.h +++ b/include/asm-sparc/thread_info.h @@ -92,9 +92,6 @@ BTFIXUPDEF_CALL(struct thread_info *, al BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) #define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - #endif /* __ASSEMBLY__ */ /* diff --git a/include/asm-um/thread_info.h b/include/asm-um/thread_info.h index 97267f0..705c719 100644 --- a/include/asm-um/thread_info.h +++ b/include/asm-um/thread_info.h @@ -56,9 +56,6 @@ static inline struct thread_info *curren ((struct thread_info *) kmalloc(THREAD_SIZE, GFP_KERNEL)) #define free_thread_info(ti) kfree(ti) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - #endif #define PREEMPT_ACTIVE 0x10000000 diff --git a/include/asm-v850/thread_info.h b/include/asm-v850/thread_info.h index e4cfad9..82b8f28 100644 --- a/include/asm-v850/thread_info.h +++ b/include/asm-v850/thread_info.h @@ -58,8 +58,6 @@ struct thread_info { #define alloc_thread_info(tsk) ((struct thread_info *) \ __get_free_pages(GFP_KERNEL, 1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #endif /* __ASSEMBLY__ */ diff --git a/include/asm-x86_64/thread_info.h b/include/asm-x86_64/thread_info.h index 08eb6e4..975c0bb 100644 --- a/include/asm-x86_64/thread_info.h +++ b/include/asm-x86_64/thread_info.h @@ -76,8 +76,6 @@ static inline struct thread_info *stack_ #define alloc_thread_info(tsk) \ ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)) #define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #else /* !__ASSEMBLY__ */ diff --git a/include/asm-xtensa/thread_info.h b/include/asm-xtensa/thread_info.h index af208d4..5ae34ab 100644 --- a/include/asm-xtensa/thread_info.h +++ b/include/asm-xtensa/thread_info.h @@ -93,8 +93,6 @@ static inline struct thread_info *curren /* thread information allocation */ #define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) #else /* !__ASSEMBLY__ */ -- 0.99.9.GIT