|
@@ -148,7 +148,8 @@ void cpu_idle_wait(void)
|
|
do {
|
|
do {
|
|
ssleep(1);
|
|
ssleep(1);
|
|
for_each_online_cpu(cpu) {
|
|
for_each_online_cpu(cpu) {
|
|
- if (cpu_isset(cpu, map) && !per_cpu(cpu_idle_state, cpu))
|
|
|
|
|
|
+ if (cpu_isset(cpu, map) &&
|
|
|
|
+ !per_cpu(cpu_idle_state, cpu))
|
|
cpu_clear(cpu, map);
|
|
cpu_clear(cpu, map);
|
|
}
|
|
}
|
|
cpus_and(map, map, cpu_online_map);
|
|
cpus_and(map, map, cpu_online_map);
|
|
@@ -278,7 +279,8 @@ void __show_regs(struct pt_regs * regs)
|
|
system_utsname.version);
|
|
system_utsname.version);
|
|
printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
|
|
printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
|
|
printk_address(regs->rip);
|
|
printk_address(regs->rip);
|
|
- printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp, regs->eflags);
|
|
|
|
|
|
+ printk("\nRSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, regs->rsp,
|
|
|
|
+ regs->eflags);
|
|
printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
|
|
printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
|
|
regs->rax, regs->rbx, regs->rcx);
|
|
regs->rax, regs->rbx, regs->rcx);
|
|
printk("RDX: %016lx RSI: %016lx RDI: %016lx\n",
|
|
printk("RDX: %016lx RSI: %016lx RDI: %016lx\n",
|
|
@@ -430,15 +432,14 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
|
|
struct pt_regs * childregs;
|
|
struct pt_regs * childregs;
|
|
struct task_struct *me = current;
|
|
struct task_struct *me = current;
|
|
|
|
|
|
- childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
|
|
|
|
-
|
|
|
|
|
|
+ childregs = ((struct pt_regs *)
|
|
|
|
+ (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
|
|
*childregs = *regs;
|
|
*childregs = *regs;
|
|
|
|
|
|
childregs->rax = 0;
|
|
childregs->rax = 0;
|
|
childregs->rsp = rsp;
|
|
childregs->rsp = rsp;
|
|
- if (rsp == ~0UL) {
|
|
|
|
|
|
+ if (rsp == ~0UL)
|
|
childregs->rsp = (unsigned long)childregs;
|
|
childregs->rsp = (unsigned long)childregs;
|
|
- }
|
|
|
|
|
|
|
|
p->thread.rsp = (unsigned long) childregs;
|
|
p->thread.rsp = (unsigned long) childregs;
|
|
p->thread.rsp0 = (unsigned long) (childregs+1);
|
|
p->thread.rsp0 = (unsigned long) (childregs+1);
|
|
@@ -460,7 +461,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
|
|
p->thread.io_bitmap_max = 0;
|
|
p->thread.io_bitmap_max = 0;
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
- memcpy(p->thread.io_bitmap_ptr, me->thread.io_bitmap_ptr, IO_BITMAP_BYTES);
|
|
|
|
|
|
+ memcpy(p->thread.io_bitmap_ptr, me->thread.io_bitmap_ptr,
|
|
|
|
+ IO_BITMAP_BYTES);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -497,7 +499,8 @@ out:
|
|
* - fold all the options into a flag word and test it with a single test.
|
|
* - fold all the options into a flag word and test it with a single test.
|
|
* - could test fs/gs bitsliced
|
|
* - could test fs/gs bitsliced
|
|
*/
|
|
*/
|
|
-struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
|
|
|
|
|
|
+struct task_struct *
|
|
|
|
+__switch_to(struct task_struct *prev_p, struct task_struct *next_p)
|
|
{
|
|
{
|
|
struct thread_struct *prev = &prev_p->thread,
|
|
struct thread_struct *prev = &prev_p->thread,
|
|
*next = &next_p->thread;
|
|
*next = &next_p->thread;
|
|
@@ -568,7 +571,8 @@ struct task_struct *__switch_to(struct task_struct *prev_p, struct task_struct *
|
|
prev->userrsp = read_pda(oldrsp);
|
|
prev->userrsp = read_pda(oldrsp);
|
|
write_pda(oldrsp, next->userrsp);
|
|
write_pda(oldrsp, next->userrsp);
|
|
write_pda(pcurrent, next_p);
|
|
write_pda(pcurrent, next_p);
|
|
- write_pda(kernelstack, (unsigned long)next_p->thread_info + THREAD_SIZE - PDA_STACKOFFSET);
|
|
|
|
|
|
+ write_pda(kernelstack,
|
|
|
|
+ (unsigned long)next_p->thread_info + THREAD_SIZE - PDA_STACKOFFSET);
|
|
|
|
|
|
/*
|
|
/*
|
|
* Now maybe reload the debug registers
|
|
* Now maybe reload the debug registers
|
|
@@ -649,7 +653,9 @@ asmlinkage long sys_fork(struct pt_regs *regs)
|
|
return do_fork(SIGCHLD, regs->rsp, regs, 0, NULL, NULL);
|
|
return do_fork(SIGCHLD, regs->rsp, regs, 0, NULL, NULL);
|
|
}
|
|
}
|
|
|
|
|
|
-asmlinkage long sys_clone(unsigned long clone_flags, unsigned long newsp, void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
|
|
|
|
|
|
+asmlinkage long
|
|
|
|
+sys_clone(unsigned long clone_flags, unsigned long newsp,
|
|
|
|
+ void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
|
|
{
|
|
{
|
|
if (!newsp)
|
|
if (!newsp)
|
|
newsp = regs->rsp;
|
|
newsp = regs->rsp;
|
|
@@ -685,7 +691,8 @@ unsigned long get_wchan(struct task_struct *p)
|
|
return 0;
|
|
return 0;
|
|
fp = *(u64 *)(p->thread.rsp);
|
|
fp = *(u64 *)(p->thread.rsp);
|
|
do {
|
|
do {
|
|
- if (fp < (unsigned long)stack || fp > (unsigned long)stack+THREAD_SIZE)
|
|
|
|
|
|
+ if (fp < (unsigned long)stack ||
|
|
|
|
+ fp > (unsigned long)stack+THREAD_SIZE)
|
|
return 0;
|
|
return 0;
|
|
rip = *(u64 *)(fp+8);
|
|
rip = *(u64 *)(fp+8);
|
|
if (!in_sched_functions(rip))
|
|
if (!in_sched_functions(rip))
|
|
@@ -720,8 +727,8 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
|
|
task->thread.gsindex = 0;
|
|
task->thread.gsindex = 0;
|
|
task->thread.gs = addr;
|
|
task->thread.gs = addr;
|
|
if (doit) {
|
|
if (doit) {
|
|
- load_gs_index(0);
|
|
|
|
- ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr);
|
|
|
|
|
|
+ load_gs_index(0);
|
|
|
|
+ ret = checking_wrmsrl(MSR_KERNEL_GS_BASE, addr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
put_cpu();
|
|
put_cpu();
|
|
@@ -738,7 +745,7 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
|
|
set_32bit_tls(task, FS_TLS, addr);
|
|
set_32bit_tls(task, FS_TLS, addr);
|
|
if (doit) {
|
|
if (doit) {
|
|
load_TLS(&task->thread, cpu);
|
|
load_TLS(&task->thread, cpu);
|
|
- asm volatile("movl %0,%%fs" :: "r" (FS_TLS_SEL));
|
|
|
|
|
|
+ asm volatile("movl %0,%%fs" :: "r"(FS_TLS_SEL));
|
|
}
|
|
}
|
|
task->thread.fsindex = FS_TLS_SEL;
|
|
task->thread.fsindex = FS_TLS_SEL;
|
|
task->thread.fs = 0;
|
|
task->thread.fs = 0;
|
|
@@ -748,8 +755,8 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
|
|
if (doit) {
|
|
if (doit) {
|
|
/* set the selector to 0 to not confuse
|
|
/* set the selector to 0 to not confuse
|
|
__switch_to */
|
|
__switch_to */
|
|
- asm volatile("movl %0,%%fs" :: "r" (0));
|
|
|
|
- ret = checking_wrmsrl(MSR_FS_BASE, addr);
|
|
|
|
|
|
+ asm volatile("movl %0,%%fs" :: "r" (0));
|
|
|
|
+ ret = checking_wrmsrl(MSR_FS_BASE, addr);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
put_cpu();
|
|
put_cpu();
|
|
@@ -758,9 +765,9 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
|
|
unsigned long base;
|
|
unsigned long base;
|
|
if (task->thread.fsindex == FS_TLS_SEL)
|
|
if (task->thread.fsindex == FS_TLS_SEL)
|
|
base = read_32bit_tls(task, FS_TLS);
|
|
base = read_32bit_tls(task, FS_TLS);
|
|
- else if (doit) {
|
|
|
|
|
|
+ else if (doit)
|
|
rdmsrl(MSR_FS_BASE, base);
|
|
rdmsrl(MSR_FS_BASE, base);
|
|
- } else
|
|
|
|
|
|
+ else
|
|
base = task->thread.fs;
|
|
base = task->thread.fs;
|
|
ret = put_user(base, (unsigned long __user *)addr);
|
|
ret = put_user(base, (unsigned long __user *)addr);
|
|
break;
|
|
break;
|
|
@@ -769,9 +776,9 @@ long do_arch_prctl(struct task_struct *task, int code, unsigned long addr)
|
|
unsigned long base;
|
|
unsigned long base;
|
|
if (task->thread.gsindex == GS_TLS_SEL)
|
|
if (task->thread.gsindex == GS_TLS_SEL)
|
|
base = read_32bit_tls(task, GS_TLS);
|
|
base = read_32bit_tls(task, GS_TLS);
|
|
- else if (doit) {
|
|
|
|
|
|
+ else if (doit)
|
|
rdmsrl(MSR_KERNEL_GS_BASE, base);
|
|
rdmsrl(MSR_KERNEL_GS_BASE, base);
|
|
- } else
|
|
|
|
|
|
+ else
|
|
base = task->thread.gs;
|
|
base = task->thread.gs;
|
|
ret = put_user(base, (unsigned long __user *)addr);
|
|
ret = put_user(base, (unsigned long __user *)addr);
|
|
break;
|
|
break;
|