Commit 369a5360 authored by Paul Mackerras's avatar Paul Mackerras Committed by Linus Torvalds

[PATCH] Make paca xCurrent field be a pointer

The paca struct contains a pointer to the current task, which is used
for the `current' macro.  For some reason, this field is a u64, and
every time we use it we need a cast, because it is really a pointer.
This patch cleans things up a little by making it a pointer to struct
task_struct and removing the casts.  It also removes a now-incorrect
comment which said that r13 contains current (it now holds
&paca[smp_processor_id()]).
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent eb18549a
......@@ -390,8 +390,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
}
/* Fixup atomic count: it exited inside IRQ handler. */
((struct task_struct *)paca[lcpu].xCurrent)->thread_info->preempt_count
= 0;
paca[lcpu].xCurrent->thread_info->preempt_count = 0;
/* Fixup SLB round-robin so next segment (kernel) goes in segment 0 */
paca[lcpu].xStab_data.next_round_robin = 0;
......@@ -817,7 +816,7 @@ static void __init smp_create_idle(unsigned int cpu)
init_idle(p, cpu);
unhash_process(p);
paca[cpu].xCurrent = (u64)p;
paca[cpu].xCurrent = p;
current_set[cpu] = p->thread_info;
}
......@@ -869,7 +868,7 @@ void __devinit smp_prepare_boot_cpu(void)
/* cpu_possible is set up in prom.c */
cpu_set(boot_cpuid, cpu_online_map);
paca[boot_cpuid].xCurrent = (u64)current;
paca[boot_cpuid].xCurrent = current;
current_set[boot_cpuid] = current->thread_info;
}
......
......@@ -8,13 +8,11 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Use r13 for current since the ppc64 ABI reserves it - Anton
*/
#include <asm/thread_info.h>
#define get_current() ((struct task_struct *)(get_paca()->xCurrent))
#define get_current() (get_paca()->xCurrent)
#define current get_current()
#endif /* !(_PPC64_CURRENT_H) */
......@@ -37,6 +37,8 @@ extern struct paca_struct paca[];
register struct paca_struct *local_paca asm("r13");
#define get_paca() local_paca
struct task_struct;
/*============================================================================
* Name_______: paca
*
......@@ -59,7 +61,7 @@ struct paca_struct {
*/
struct ItLpPaca *xLpPacaPtr; /* Pointer to LpPaca for PLIC 0x00 */
struct ItLpRegSave *xLpRegSavePtr; /* Pointer to LpRegSave for PLIC 0x08 */
u64 xCurrent; /* Pointer to current 0x10 */
struct task_struct *xCurrent; /* Pointer to current 0x10 */
/* Note: the spinlock functions in arch/ppc64/lib/locks.c load lock_token and
xPacaIndex with a single lwz instruction, using the constant offset 24.
If you move either field, fix the spinlocks and rwlocks. */
......
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