static inline void hlt(void)
{
- if (hlt_counter)
- return;
-
__asm__ __volatile__ ("sleep" : : : "memory");
}
/*
* The idle loop on a uniprocessor SH..
*/
-void default_idle(void)
+void cpu_idle(void)
{
/* endless idle loop with no priority at all */
while (1) {
if (hlt_counter) {
- while (1)
- if (need_resched())
- break;
+ while (!need_resched())
+ cpu_relax();
} else {
local_irq_disable();
while (!need_resched()) {
}
local_irq_enable();
}
+ preempt_enable_no_resched();
schedule();
+ preempt_disable();
}
-}
-void cpu_idle(void *unused)
-{
- default_idle();
}
void machine_restart(char * __unused)
int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
{
/* A bit less processor dependent than older sh ... */
-
unsigned int reply;
static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp)
null it here, there is no other path through which it would get safely
nulled. */
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
if (last_task_used_math == current) {
last_task_used_math = NULL;
}
/* Called by fs/exec.c (flush_old_exec) to remove traces of a
* previously running executable. */
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
if (last_task_used_math == current) {
last_task_used_math = NULL;
}
/* Force FPU state to be reinitialised after exec */
- current->used_math = 0;
+ clear_used_math();
#endif
/* if we are a kernel thread, about to change to user thread,
/* Fill in the fpu structure for a core dump.. */
int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
{
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
int fpvalid;
struct task_struct *tsk = current;
- fpvalid = tsk->used_math;
+ fpvalid = !!tsk_used_math(tsk);
if (fpvalid) {
if (current == last_task_used_math) {
grab_fpu();
struct pt_regs *childregs;
unsigned long long se; /* Sign extension */
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
if(last_task_used_math == current) {
grab_fpu();
fpsave(¤t->thread.fpu.hard);
}
#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;
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 */
childregs->sr |= SR_FD; /* Invalidate FPU flag */
- /* From sh */
- p->set_child_tid = p->clear_child_tid = NULL;
-
p->thread.sp = (unsigned long) childregs;
p->thread.pc = (unsigned long) ret_from_fork;
return 0;
}
-/*
- * fill in the user structure for a core dump..
- */
-void dump_thread(struct pt_regs * regs, struct user * dump)
-{
- dump->magic = CMAGIC;
- dump->start_code = current->mm->start_code;
- dump->start_data = current->mm->start_data;
- dump->start_stack = regs->regs[15] & ~(PAGE_SIZE - 1);
- dump->u_tsize = (current->mm->end_code - dump->start_code) >> PAGE_SHIFT;
- dump->u_dsize = (current->mm->brk + (PAGE_SIZE-1) - dump->start_data) >> PAGE_SHIFT;
- dump->u_ssize = (current->mm->start_stack - dump->start_stack +
- PAGE_SIZE - 1) >> PAGE_SHIFT;
- /* Debug registers will come here. */
-
- dump->regs = *regs;
-
- dump->u_fpvalid = dump_fpu(regs, &dump->fpu);
-}
-
asmlinkage int sys_fork(unsigned long r2, unsigned long r3,
unsigned long r4, unsigned long r5,
unsigned long r6, unsigned long r7,
{
if (!newsp)
newsp = pregs->regs[15];
- return do_fork(clone_flags & ~CLONE_IDLETASK, newsp, pregs, 0, 0, 0);
+ return do_fork(clone_flags, newsp, pregs, 0, 0, 0);
}
/*
(char __user * __user *)uargv,
(char __user * __user *)uenvp,
pregs);
- if (error == 0)
+ if (error == 0) {
+ task_lock(current);
current->ptrace &= ~PT_DTRACE;
+ task_unlock(current);
+ }
putname(filename);
out:
unlock_kernel();
*/
pc = thread_saved_pc(p);
-#if CONFIG_FRAME_POINTER
+#ifdef CONFIG_FRAME_POINTER
if (in_sh64_switch_to(pc)) {
sh64_switch_to_fp = (long) p->thread.sp;
/* r14 is saved at offset 4 in the sh64_switch_to frame */
int len=0;
struct task_struct *p;
read_lock(&tasklist_lock);
- for_each_task(p) {
+ for_each_process(p) {
int pid = p->pid;
struct mm_struct *mm;
if (!pid) continue;
unsigned long asid, context;
context = mm->context;
asid = (context & 0xff);
- len += sprintf(buf+len, "%5d : %02x\n", pid, asid);
+ len += sprintf(buf+len, "%5d : %02lx\n", pid, asid);
} else {
len += sprintf(buf+len, "%5d : (none)\n", pid);
}