Skip to content

Commit 37bfbaf

Browse files
Al ViroLinus Torvalds
authored andcommitted
[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: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 9fc6587 commit 37bfbaf

6 files changed

Lines changed: 30 additions & 30 deletions

File tree

‎arch/alpha/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ unsigned long
493493
thread_saved_pc(task_t *t)
494494
{
495495
unsigned long base = (unsigned long)t->thread_info;
496-
unsigned long fp, sp = t->thread_info->pcb.ksp;
496+
unsigned long fp, sp = task_thread_info(t)->pcb.ksp;
497497

498498
if (sp > base && sp+6*8 < base + 16*1024) {
499499
fp = ((unsigned long*)sp)[6];
@@ -523,7 +523,7 @@ get_wchan(struct task_struct *p)
523523

524524
pc = thread_saved_pc(p);
525525
if (in_sched_functions(pc)) {
526-
schedule_frame = ((unsigned long *)p->thread_info->pcb.ksp)[6];
526+
schedule_frame = ((unsigned long *)task_thread_info(p)->pcb.ksp)[6];
527527
return ((unsigned long *)schedule_frame)[12];
528528
}
529529
return pc;

‎arch/alpha/kernel/ptrace.c‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ get_reg_addr(struct task_struct * task, unsigned long regno)
103103
unsigned long *addr;
104104

105105
if (regno == 30) {
106-
addr = &task->thread_info->pcb.usp;
106+
addr = &task_thread_info(task)->pcb.usp;
107107
} else if (regno == 65) {
108-
addr = &task->thread_info->pcb.unique;
108+
addr = &task_thread_info(task)->pcb.unique;
109109
} else if (regno == 31 || regno > 65) {
110110
zero = 0;
111111
addr = &zero;
@@ -125,7 +125,7 @@ get_reg(struct task_struct * task, unsigned long regno)
125125
if (regno == 63) {
126126
unsigned long fpcr = *get_reg_addr(task, regno);
127127
unsigned long swcr
128-
= task->thread_info->ieee_state & IEEE_SW_MASK;
128+
= task_thread_info(task)->ieee_state & IEEE_SW_MASK;
129129
swcr = swcr_update_status(swcr, fpcr);
130130
return fpcr | swcr;
131131
}
@@ -139,8 +139,8 @@ static int
139139
put_reg(struct task_struct *task, unsigned long regno, unsigned long data)
140140
{
141141
if (regno == 63) {
142-
task->thread_info->ieee_state
143-
= ((task->thread_info->ieee_state & ~IEEE_SW_MASK)
142+
task_thread_info(task)->ieee_state
143+
= ((task_thread_info(task)->ieee_state & ~IEEE_SW_MASK)
144144
| (data & IEEE_SW_MASK));
145145
data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data);
146146
}
@@ -188,35 +188,35 @@ ptrace_set_bpt(struct task_struct * child)
188188
* branch (emulation can be tricky for fp branches).
189189
*/
190190
displ = ((s32)(insn << 11)) >> 9;
191-
child->thread_info->bpt_addr[nsaved++] = pc + 4;
191+
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
192192
if (displ) /* guard against unoptimized code */
193-
child->thread_info->bpt_addr[nsaved++]
193+
task_thread_info(child)->bpt_addr[nsaved++]
194194
= pc + 4 + displ;
195195
DBG(DBG_BPT, ("execing branch\n"));
196196
} else if (op_code == 0x1a) {
197197
reg_b = (insn >> 16) & 0x1f;
198-
child->thread_info->bpt_addr[nsaved++] = get_reg(child, reg_b);
198+
task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
199199
DBG(DBG_BPT, ("execing jump\n"));
200200
} else {
201-
child->thread_info->bpt_addr[nsaved++] = pc + 4;
201+
task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
202202
DBG(DBG_BPT, ("execing normal insn\n"));
203203
}
204204

205205
/* install breakpoints: */
206206
for (i = 0; i < nsaved; ++i) {
207-
res = read_int(child, child->thread_info->bpt_addr[i],
207+
res = read_int(child, task_thread_info(child)->bpt_addr[i],
208208
(int *) &insn);
209209
if (res < 0)
210210
return res;
211-
child->thread_info->bpt_insn[i] = insn;
211+
task_thread_info(child)->bpt_insn[i] = insn;
212212
DBG(DBG_BPT, (" -> next_pc=%lx\n",
213-
child->thread_info->bpt_addr[i]));
214-
res = write_int(child, child->thread_info->bpt_addr[i],
213+
task_thread_info(child)->bpt_addr[i]));
214+
res = write_int(child, task_thread_info(child)->bpt_addr[i],
215215
BREAKINST);
216216
if (res < 0)
217217
return res;
218218
}
219-
child->thread_info->bpt_nsaved = nsaved;
219+
task_thread_info(child)->bpt_nsaved = nsaved;
220220
return 0;
221221
}
222222

@@ -227,18 +227,18 @@ ptrace_set_bpt(struct task_struct * child)
227227
int
228228
ptrace_cancel_bpt(struct task_struct * child)
229229
{
230-
int i, nsaved = child->thread_info->bpt_nsaved;
230+
int i, nsaved = task_thread_info(child)->bpt_nsaved;
231231

232-
child->thread_info->bpt_nsaved = 0;
232+
task_thread_info(child)->bpt_nsaved = 0;
233233

234234
if (nsaved > 2) {
235235
printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
236236
nsaved = 2;
237237
}
238238

239239
for (i = 0; i < nsaved; ++i) {
240-
write_int(child, child->thread_info->bpt_addr[i],
241-
child->thread_info->bpt_insn[i]);
240+
write_int(child, task_thread_info(child)->bpt_addr[i],
241+
task_thread_info(child)->bpt_insn[i]);
242242
}
243243
return (nsaved != 0);
244244
}
@@ -355,7 +355,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
355355
if (!valid_signal(data))
356356
break;
357357
/* Mark single stepping. */
358-
child->thread_info->bpt_nsaved = -1;
358+
task_thread_info(child)->bpt_nsaved = -1;
359359
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
360360
child->exit_code = data;
361361
wake_up_process(child);

‎arch/alpha/kernel/smp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
302302
+ hwrpb->processor_offset
303303
+ cpuid * hwrpb->processor_size);
304304
hwpcb = (struct pcb_struct *) cpu->hwpcb;
305-
ipcb = &idle->thread_info->pcb;
305+
ipcb = &task_thread_info(idle)->pcb;
306306

307307
/* Initialize the CPU's HWPCB to something just good enough for
308308
us to get started. Immediately after starting, we'll swpctx

‎include/asm-alpha/mmu_context.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ ev5_switch_mm(struct mm_struct *prev_mm, struct mm_struct *next_mm,
156156
/* Always update the PCB ASN. Another thread may have allocated
157157
a new mm->context (via flush_tlb_mm) without the ASN serial
158158
number wrapping. We have no way to detect when this is needed. */
159-
next->thread_info->pcb.asn = mmc & HARDWARE_ASN_MASK;
159+
task_thread_info(next)->pcb.asn = mmc & HARDWARE_ASN_MASK;
160160
}
161161

162162
__EXTERN_INLINE void
@@ -235,7 +235,7 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
235235
if (cpu_online(i))
236236
mm->context[i] = 0;
237237
if (tsk != current)
238-
tsk->thread_info->pcb.ptbr
238+
task_thread_info(tsk)->pcb.ptbr
239239
= ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
240240
return 0;
241241
}
@@ -249,7 +249,7 @@ destroy_context(struct mm_struct *mm)
249249
static inline void
250250
enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
251251
{
252-
tsk->thread_info->pcb.ptbr
252+
task_thread_info(tsk)->pcb.ptbr
253253
= ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
254254
}
255255

‎include/asm-alpha/processor.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ unsigned long get_wchan(struct task_struct *p);
6464
(*(unsigned long *)(PT_REG(pc) + (unsigned long) ((tsk)->thread_info)))
6565

6666
#define KSTK_ESP(tsk) \
67-
((tsk) == current ? rdusp() : (tsk)->thread_info->pcb.usp)
67+
((tsk) == current ? rdusp() : task_thread_info(tsk)->pcb.usp)
6868

6969
#define cpu_relax() barrier()
7070

‎include/asm-alpha/system.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ struct el_common_EV6_mcheck {
131131
extern void halt(void) __attribute__((noreturn));
132132
#define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
133133

134-
#define switch_to(P,N,L) \
135-
do { \
136-
(L) = alpha_switch_to(virt_to_phys(&(N)->thread_info->pcb), (P)); \
137-
check_mmu_context(); \
134+
#define switch_to(P,N,L) \
135+
do { \
136+
(L) = alpha_switch_to(virt_to_phys(&task_thread_info(N)->pcb), (P)); \
137+
check_mmu_context(); \
138138
} while (0)
139139

140140
struct task_struct;

0 commit comments

Comments
 (0)