Commit 37bfbaf9 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] alpha: task_thread_info()

use task_thread_info() for accesses to thread_info of task in arch/alpha
and include/asm-alpha
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9fc65876
...@@ -493,7 +493,7 @@ unsigned long ...@@ -493,7 +493,7 @@ unsigned long
thread_saved_pc(task_t *t) thread_saved_pc(task_t *t)
{ {
unsigned long base = (unsigned long)t->thread_info; 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) { if (sp > base && sp+6*8 < base + 16*1024) {
fp = ((unsigned long*)sp)[6]; fp = ((unsigned long*)sp)[6];
...@@ -523,7 +523,7 @@ get_wchan(struct task_struct *p) ...@@ -523,7 +523,7 @@ get_wchan(struct task_struct *p)
pc = thread_saved_pc(p); pc = thread_saved_pc(p);
if (in_sched_functions(pc)) { 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 ((unsigned long *)schedule_frame)[12];
} }
return pc; return pc;
......
...@@ -103,9 +103,9 @@ get_reg_addr(struct task_struct * task, unsigned long regno) ...@@ -103,9 +103,9 @@ get_reg_addr(struct task_struct * task, unsigned long regno)
unsigned long *addr; unsigned long *addr;
if (regno == 30) { if (regno == 30) {
addr = &task->thread_info->pcb.usp; addr = &task_thread_info(task)->pcb.usp;
} else if (regno == 65) { } else if (regno == 65) {
addr = &task->thread_info->pcb.unique; addr = &task_thread_info(task)->pcb.unique;
} else if (regno == 31 || regno > 65) { } else if (regno == 31 || regno > 65) {
zero = 0; zero = 0;
addr = &zero; addr = &zero;
...@@ -125,7 +125,7 @@ get_reg(struct task_struct * task, unsigned long regno) ...@@ -125,7 +125,7 @@ get_reg(struct task_struct * task, unsigned long regno)
if (regno == 63) { if (regno == 63) {
unsigned long fpcr = *get_reg_addr(task, regno); unsigned long fpcr = *get_reg_addr(task, regno);
unsigned long swcr 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); swcr = swcr_update_status(swcr, fpcr);
return fpcr | swcr; return fpcr | swcr;
} }
...@@ -139,8 +139,8 @@ static int ...@@ -139,8 +139,8 @@ static int
put_reg(struct task_struct *task, unsigned long regno, unsigned long data) put_reg(struct task_struct *task, unsigned long regno, unsigned long data)
{ {
if (regno == 63) { if (regno == 63) {
task->thread_info->ieee_state task_thread_info(task)->ieee_state
= ((task->thread_info->ieee_state & ~IEEE_SW_MASK) = ((task_thread_info(task)->ieee_state & ~IEEE_SW_MASK)
| (data & IEEE_SW_MASK)); | (data & IEEE_SW_MASK));
data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data); data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data);
} }
...@@ -188,35 +188,35 @@ ptrace_set_bpt(struct task_struct * child) ...@@ -188,35 +188,35 @@ ptrace_set_bpt(struct task_struct * child)
* branch (emulation can be tricky for fp branches). * branch (emulation can be tricky for fp branches).
*/ */
displ = ((s32)(insn << 11)) >> 9; 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 */ if (displ) /* guard against unoptimized code */
child->thread_info->bpt_addr[nsaved++] task_thread_info(child)->bpt_addr[nsaved++]
= pc + 4 + displ; = pc + 4 + displ;
DBG(DBG_BPT, ("execing branch\n")); DBG(DBG_BPT, ("execing branch\n"));
} else if (op_code == 0x1a) { } else if (op_code == 0x1a) {
reg_b = (insn >> 16) & 0x1f; 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")); DBG(DBG_BPT, ("execing jump\n"));
} else { } 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")); DBG(DBG_BPT, ("execing normal insn\n"));
} }
/* install breakpoints: */ /* install breakpoints: */
for (i = 0; i < nsaved; ++i) { 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); (int *) &insn);
if (res < 0) if (res < 0)
return res; return res;
child->thread_info->bpt_insn[i] = insn; task_thread_info(child)->bpt_insn[i] = insn;
DBG(DBG_BPT, (" -> next_pc=%lx\n", DBG(DBG_BPT, (" -> next_pc=%lx\n",
child->thread_info->bpt_addr[i])); task_thread_info(child)->bpt_addr[i]));
res = write_int(child, child->thread_info->bpt_addr[i], res = write_int(child, task_thread_info(child)->bpt_addr[i],
BREAKINST); BREAKINST);
if (res < 0) if (res < 0)
return res; return res;
} }
child->thread_info->bpt_nsaved = nsaved; task_thread_info(child)->bpt_nsaved = nsaved;
return 0; return 0;
} }
...@@ -227,9 +227,9 @@ ptrace_set_bpt(struct task_struct * child) ...@@ -227,9 +227,9 @@ ptrace_set_bpt(struct task_struct * child)
int int
ptrace_cancel_bpt(struct task_struct * child) 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) { if (nsaved > 2) {
printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved); printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
...@@ -237,8 +237,8 @@ ptrace_cancel_bpt(struct task_struct * child) ...@@ -237,8 +237,8 @@ ptrace_cancel_bpt(struct task_struct * child)
} }
for (i = 0; i < nsaved; ++i) { for (i = 0; i < nsaved; ++i) {
write_int(child, child->thread_info->bpt_addr[i], write_int(child, task_thread_info(child)->bpt_addr[i],
child->thread_info->bpt_insn[i]); task_thread_info(child)->bpt_insn[i]);
} }
return (nsaved != 0); return (nsaved != 0);
} }
...@@ -355,7 +355,7 @@ do_sys_ptrace(long request, long pid, long addr, long data, ...@@ -355,7 +355,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
if (!valid_signal(data)) if (!valid_signal(data))
break; break;
/* Mark single stepping. */ /* Mark single stepping. */
child->thread_info->bpt_nsaved = -1; task_thread_info(child)->bpt_nsaved = -1;
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
child->exit_code = data; child->exit_code = data;
wake_up_process(child); wake_up_process(child);
......
...@@ -302,7 +302,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle) ...@@ -302,7 +302,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
+ hwrpb->processor_offset + hwrpb->processor_offset
+ cpuid * hwrpb->processor_size); + cpuid * hwrpb->processor_size);
hwpcb = (struct pcb_struct *) cpu->hwpcb; 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 /* Initialize the CPU's HWPCB to something just good enough for
us to get started. Immediately after starting, we'll swpctx us to get started. Immediately after starting, we'll swpctx
......
...@@ -156,7 +156,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm, ...@@ -156,7 +156,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
/* Always update the PCB ASN. Another thread may have allocated /* Always update the PCB ASN. Another thread may have allocated
a new mm->context (via flush_tlb_mm) without the ASN serial a new mm->context (via flush_tlb_mm) without the ASN serial
number wrapping. We have no way to detect when this is needed. */ 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 __EXTERN_INLINE void
...@@ -235,7 +235,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -235,7 +235,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
if (cpu_online(i)) if (cpu_online(i))
mm->context[i] = 0; mm->context[i] = 0;
if (tsk != current) if (tsk != current)
tsk->thread_info->pcb.ptbr task_thread_info(tsk)->pcb.ptbr
= ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
return 0; return 0;
} }
...@@ -249,7 +249,7 @@ destroy_context(struct mm_struct *mm) ...@@ -249,7 +249,7 @@ destroy_context(struct mm_struct *mm)
static inline void static inline void
enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 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; = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
} }
......
...@@ -64,7 +64,7 @@ unsigned long get_wchan(struct task_struct *p); ...@@ -64,7 +64,7 @@ unsigned long get_wchan(struct task_struct *p);
(*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info))) (*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info)))
#define KSTK_ESP(tsk) \ #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() #define cpu_relax() barrier()
......
...@@ -131,10 +131,10 @@ struct el_common_EV6_mcheck { ...@@ -131,10 +131,10 @@ struct el_common_EV6_mcheck {
extern void halt(void) __attribute__((noreturn)); extern void halt(void) __attribute__((noreturn));
#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt)) #define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
#define switch_to(P,N,L) \ #define switch_to(P,N,L) \
do { \ do { \
(L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \ (L) = alpha_switch_to(virt_to_phys(&task_thread_info(N)->pcb), (P)); \
check_mmu_context(); \ check_mmu_context(); \
} while (0) } while (0)
struct task_struct; struct task_struct;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment