patch-2.3.13 linux/arch/m68k/kernel/process.c

Next file: linux/arch/m68k/kernel/ptrace.c
Previous file: linux/arch/m68k/kernel/m68k_ksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.12/linux/arch/m68k/kernel/process.c linux/arch/m68k/kernel/process.c
@@ -45,35 +45,47 @@
 struct mm_struct init_mm = INIT_MM(init_mm);
 
 union task_union init_task_union
-	__attribute__((section("init_task"), aligned(2*PAGE_SIZE)))
-	= { task: INIT_TASK };
+__attribute__((section("init_task"), aligned(THREAD_SIZE)))
+	= { task: INIT_TASK(init_task_union.task) };
+
+asmlinkage void ret_from_fork(void);
 
-asmlinkage void ret_from_exception(void);
 
 /*
  * The idle loop on an m68k..
  */
-asmlinkage int sys_idle(void)
+static void default_idle(void)
 {
-	if (current->pid != 0)
-		return -EPERM;
-
-	/* endless idle loop with no priority at all */
-	current->priority = 0;
-	current->counter = -100;
-	for (;;) {
+	while(1) {
 		if (!current->need_resched)
-#if defined(CONFIG_ATARI) && !defined(CONFIG_AMIGA) && !defined(CONFIG_MAC)
+#ifdef MACH_ATARI_ONLY
 			/* block out HSYNC on the atari (falcon) */
 			__asm__("stop #0x2200" : : : "cc");
-#else /* portable version */
+#else
 			__asm__("stop #0x2000" : : : "cc");
-#endif /* machine compilation types */ 
+#endif
 		schedule();
 		check_pgt_cache();
 	}
 }
 
+void (*idle)(void) = default_idle;
+
+/*
+ * The idle thread. There's no useful work to be
+ * done, so just try to conserve power and have a
+ * low exit latency (ie sit in a loop waiting for
+ * somebody to say that they'd like to reschedule)
+ */
+void cpu_idle(void)
+{
+	/* endless idle loop with no priority at all */
+	init_idle();
+	current->priority = 0;
+	current->counter = -100;
+	idle();
+}
+
 void machine_restart(char * __unused)
 {
 	if (mach_reset)
@@ -148,7 +160,7 @@
 {
 	unsigned long zero = 0;
 	set_fs(USER_DS);
-	current->tss.fs = __USER_DS;
+	current->thread.fs = __USER_DS;
 	asm volatile (".chip 68k/68881\n\t"
 		      "frestore %0@\n\t"
 		      ".chip 68k" : : "a" (&zero));
@@ -191,7 +203,7 @@
 	struct switch_stack * childstack, *stack;
 	unsigned long stack_offset, *retp;
 
-	stack_offset = 2*PAGE_SIZE - sizeof(struct pt_regs);
+	stack_offset = THREAD_SIZE - sizeof(struct pt_regs);
 	childregs = (struct pt_regs *) ((unsigned long) p + stack_offset);
 
 	*childregs = *regs;
@@ -202,26 +214,26 @@
 
 	childstack = ((struct switch_stack *) childregs) - 1;
 	*childstack = *stack;
-	childstack->retpc = (unsigned long) ret_from_exception;
+	childstack->retpc = (unsigned long)ret_from_fork;
 
-	p->tss.usp = usp;
-	p->tss.ksp = (unsigned long)childstack;
+	p->thread.usp = usp;
+	p->thread.ksp = (unsigned long)childstack;
 	/*
 	 * Must save the current SFC/DFC value, NOT the value when
 	 * the parent was last descheduled - RGH  10-08-96
 	 */
-	p->tss.fs = get_fs().seg;
+	p->thread.fs = get_fs().seg;
 
 	/* Copy the current fpu state */
-	asm volatile ("fsave %0" : : "m" (p->tss.fpstate[0]) : "memory");
+	asm volatile ("fsave %0" : : "m" (p->thread.fpstate[0]) : "memory");
 
-	if (!CPU_IS_060 ? p->tss.fpstate[0] : p->tss.fpstate[2])
+	if (!CPU_IS_060 ? p->thread.fpstate[0] : p->thread.fpstate[2])
 	  asm volatile ("fmovemx %/fp0-%/fp7,%0\n\t"
 			"fmoveml %/fpiar/%/fpcr/%/fpsr,%1"
-			: : "m" (p->tss.fp[0]), "m" (p->tss.fpcntl[0])
+			: : "m" (p->thread.fp[0]), "m" (p->thread.fpcntl[0])
 			: "memory");
 	/* Restore the state in case the fpu was busy */
-	asm volatile ("frestore %0" : : "m" (p->tss.fpstate[0]));
+	asm volatile ("frestore %0" : : "m" (p->thread.fpstate[0]));
 
 	return 0;
 }
@@ -230,7 +242,7 @@
 
 int dump_fpu (struct pt_regs *regs, struct user_m68kfp_struct *fpu)
 {
-  char fpustate[216];
+	char fpustate[216];
 
   /* First dump the fpu context to avoid protocol violation.  */
   asm volatile ("fsave %0" :: "m" (fpustate[0]) : "memory");

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)