]> git.neil.brown.name Git - history.git/commitdiff
Update PPC for recent generic changes; in particular adapt to
authorPaul Mackerras <paulus@tango.paulus.ozlabs.org>
Tue, 12 Feb 2002 09:26:28 +0000 (20:26 +1100)
committerPaul Mackerras <paulus@quango.(none)>
Tue, 12 Feb 2002 09:26:28 +0000 (20:26 +1100)
having the thread_info struct at the base of the stack and
the task_struct elsewhere.

21 files changed:
arch/ppc/Makefile
arch/ppc/config.in
arch/ppc/kernel/Makefile
arch/ppc/kernel/checks.c [deleted file]
arch/ppc/kernel/entry.S
arch/ppc/kernel/head.S
arch/ppc/kernel/head_4xx.S
arch/ppc/kernel/head_8xx.S
arch/ppc/kernel/iSeries_head.S
arch/ppc/kernel/idle.c
arch/ppc/kernel/mk_defs.c
arch/ppc/kernel/process.c
arch/ppc/kernel/ptrace.c
arch/ppc/kernel/setup.c
arch/ppc/platforms/pmac_setup.c
include/asm-ppc/hardirq.h
include/asm-ppc/pci.h
include/asm-ppc/processor.h
include/asm-ppc/scatterlist.h
include/asm-ppc/smp.h
include/asm-ppc/thread_info.h [new file with mode: 0644]

index 3fbf5d015cabe10143f8273db8c1aa79b6101cfd..e2bb9d7c860b4e29f38725a074ae77ed59054c4b 100644 (file)
@@ -21,10 +21,6 @@ else
 KERNELLOAD     =0xc0000000
 endif
 
-ifeq ($(shell uname -m),ppc)
-CHECKS         = checks
-endif
-
 LINKFLAGS      = -T arch/ppc/vmlinux.lds -Ttext $(KERNELLOAD) -Bstatic
 CPPFLAGS       := $(CPPFLAGS) -I$(TOPDIR)/arch/$(ARCH)
 AFLAGS         := $(AFLAGS) -I$(TOPDIR)/arch/$(ARCH)
@@ -102,15 +98,12 @@ SUBDIRS += arch/ppc/iSeries
 CORE_FILES += arch/ppc/iSeries/iSeries.o
 endif
 
-checks:
-       @$(MAKE) -C arch/$(ARCH)/kernel checks
-
 BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd pImage vmlinux.sm
 
 # All the instructions talk about "make bzImage".
 bzImage: zImage
 
-$(BOOT_TARGETS): $(CHECKS) vmlinux
+$(BOOT_TARGETS): vmlinux
        @$(MAKEBOOT) $@
 
 %_config: arch/ppc/configs/%_defconfig
@@ -118,7 +111,7 @@ $(BOOT_TARGETS): $(CHECKS) vmlinux
        cp -f arch/ppc/configs/$(@:config=defconfig) arch/ppc/defconfig
 
 archclean:
-       rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name,checks}
+       rm -f arch/ppc/kernel/{mk_defs,ppc_defs.h,find_name}
        rm -f arch/ppc/iSeries/ReleaseData.h
        @$(MAKEBOOT) clean
 
index 6479447994497edfcce85b5c0eeb7b63d4323ac2..3f4208cc8a0ab741d7c3a8c721886864e1f39671 100644 (file)
@@ -169,6 +169,7 @@ bool 'Symmetric multi-processing support' CONFIG_SMP
 if [ "$CONFIG_SMP" = "y" ]; then
   bool '  Distribute interrupts on all CPUs by default' CONFIG_IRQ_ALL_CPUS
 fi
+define_bool CONFIG_PREEMPT n
 
 if [ "$CONFIG_6xx" = "y" -a "$CONFIG_8260" = "n" ];then
   bool 'AltiVec Support' CONFIG_ALTIVEC
index d00aacf316d8f402ae0fe1b328c4982d90016edc..d2373a5850f5cf7b3f966321c11986c07d193942 100644 (file)
@@ -123,7 +123,3 @@ ppc_defs.h: mk_defs.c ppc_defs.head \
 
 find_name : find_name.c
        $(HOSTCC) $(HOSTCFLAGS) -o find_name find_name.c
-
-checks: checks.c
-       $(HOSTCC) -I$(HPATH) $(HOSTCFLAGS) -D__KERNEL__ -fno-builtin -o checks checks.c
-       ./checks
diff --git a/arch/ppc/kernel/checks.c b/arch/ppc/kernel/checks.c
deleted file mode 100644 (file)
index c9bff43..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * BK Id: SCCS/s.checks.c 1.6 05/17/01 18:14:21 cort
- */
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/smp_lock.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
-
-#include <asm/pgtable.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/io.h>
-
-/*
- * Do various before compile checks of data structures
- * -- Cort
- */
-int main(void)
-{
-       int ret = 0;
-#if 0
-       if ( sizeof(struct thread_struct) % 16 )
-       {
-               printf("Thread struct is not modulo 16 bytes: "
-                       "%d bytes total, %d bytes off\n",
-                       sizeof(struct thread_struct),
-                       sizeof(struct thread_struct)%16);
-               ret = -1;
-       }
-#endif 
-
-       if ( sizeof(struct pt_regs) % 16 )
-       {
-               printf("pt_regs struct is not modulo 16 bytes: "
-                       "%d bytes total, %d bytes off\n",
-                       sizeof(struct pt_regs),
-                       sizeof(struct pt_regs)%16);
-               ret = -1;
-               
-       }
-
-       printf("Task size        : %d bytes\n"
-              "Tss size         : %d bytes\n"
-              "pt_regs size     : %d bytes\n"
-              "Kernel stack size: %d bytes\n",
-              sizeof(struct task_struct), sizeof(struct thread_struct),
-              sizeof(struct pt_regs),
-              sizeof(union task_union) - sizeof(struct task_struct));
-       return ret;
-}
index 70fae23e5ffd2a5abc44217167dff00be66846be..8017ce55ca7c802e20d81e96b03997080e612840 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/page.h>
 #include <asm/mmu.h>
 #include <asm/cputable.h>
+#include <asm/thread_info.h>
 #include <asm/ppc_asm.h>
 #include "ppc_defs.h"
 #ifdef CONFIG_PPC_ISERIES
@@ -95,8 +96,9 @@ _GLOBAL(DoSyscall)
        beq-    10f
        cmpi    0,r0,0x6666     /* Special case for 'sys_rt_sigreturn' */
        beq-    16f
-       lbz     r10,SYSCALL_TRACE(r2)
-       cmpwi   r10,0
+       rlwinm  r10,r1,0,0,18   /* current_thread_info() */
+       lwz     r10,TI_FLAGS(r10)
+       andi.   r10,r10,_TIF_SYSCALL_TRACE
        bne-    50f
        cmpli   0,r0,NR_syscalls
        bge-    66f
@@ -276,8 +278,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
        .globl  ret_from_fork
 ret_from_fork:
        bl      schedule_tail
-       lbz     r0,SYSCALL_TRACE(r2)
-       cmpwi   r0,0
+       rlwinm  r3,r1,0,0,18
+       lwz     r3,TI_FLAGS(r3)
+       andi.   r0,r3,_TIF_SYSCALL_TRACE
        bnel-   do_syscall_trace
        b       ret_from_except
 
@@ -295,8 +298,9 @@ ret_from_except:
        REST_8GPRS(23,r1)
        REST_GPR(31,r1)
 
-       /* Hard-disable interrupts so that current->work can't change
-        * between when we test it and when we return from the interrupt. */
+       /* Hard-disable interrupts so that current_thread_info()->flags
+        * can't change between when we test it and when we return
+        * from the interrupt. */
 recheck:
        mfmsr   r10
        rlwinm  r0,r10,0,17,15  /* clear MSR_EE in r0 */
@@ -310,9 +314,10 @@ recheck:
        andi.   r3,r3,MSR_PR
        beq+    restore         /* if not, just restore regs and return */
 
-       /* Check current->work */
-       lwz     r3,TASK_WORK(r2)
-       rlwinm. r0,r3,0,16,7    /* need_resched, sigpending, notify_resume */
+       /* Check current_thread_info()->flags */
+       rlwinm  r3,r1,0,0,18
+       lwz     r3,TI_FLAGS(r3)
+       andi.   r0,r3,(_TIF_SIGPENDING|_TIF_NEED_RESCHED)
        bne     do_work
 
        .globl ret_to_user_hook 
@@ -384,21 +389,19 @@ do_work:
        ori     r10,r10,MSR_EE
        SYNC
        mtmsr   r10             /* hard-enable interrupts */
-       rlwinm. r0,r3,0,0,7     /* test need_resched */
+       andi.   r0,r3,_TIF_NEED_RESCHED
        beq     1f
        bl      schedule
        b       recheck
 1:
-       rlwinm. r0,r3,0,16,23   /* test sigpending */
+       andi.   r0,r3,_TIF_SIGPENDING
        beq     2f
        li      r3,0
        addi    r4,r1,STACK_FRAME_OVERHEAD
        bl      do_signal
        b       recheck
 2:
-       /* nobody uses work.notify_resume yet */
-       li      r0,0
-       stb     r0,NOTIFY_RESUME(r2)
+       /* nobody uses the TIF_NOTIFY_RESUME bit yet */
        b       recheck
 
 /*
index 6a57fa4dad537da2cf4934515d23c468ab269f5e..2f1de5e97f06bcf713fcefb36f937675de509f40 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/pgtable.h>
 #include <asm/cputable.h>
 #include <asm/cache.h>
+#include <asm/thread_info.h>
 #include <asm/ppc_asm.h>
 #include "ppc_defs.h"
 
@@ -784,9 +785,9 @@ END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  */
 stack_ovf:
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       lis     r1,init_task_union@ha
-       addi    r1,r1,init_task_union@l
-       addi    r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
+       addi    r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
        lis     r24,StackOverflow@ha
        addi    r24,r24,StackOverflow@l
        li      r20,MSR_KERNEL
@@ -1228,7 +1229,7 @@ __secondary_start:
        lwzx    r2,r2,r24
 
        /* stack */
-       addi    r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+       addi    r1,r2,THREAD_SIZE-STACK_FRAME_OVERHEAD
        li      r0,0
        tophys(r3,r1)
        stw     r0,0(r3)
@@ -1437,8 +1438,8 @@ start_here:
        bl      call_setup_cpu
 
        /* ptr to current */
-       lis     r2,init_task_union@h
-       ori     r2,r2,init_task_union@l
+       lis     r2,init_task@h
+       ori     r2,r2,init_task@l
        /* Set up for using our exception vectors */
        /* ptr to phys current thread */
        tophys(r4,r2)
@@ -1449,9 +1450,10 @@ start_here:
        mtspr   SPRG2,r3        /* 0 => r1 has kernel sp */
 
        /* stack */
-       addi    r1,r2,TASK_UNION_SIZE
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
        li      r0,0
-       stwu    r0,-STACK_FRAME_OVERHEAD(r1)
+       stwu    r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
 /*
  * Do early bootinfo parsing, platform-specific initialization,
  * and set up the MMU.
@@ -1725,6 +1727,10 @@ m8260_gorom:
        .data
        .globl  sdata
 sdata:
+       .globl  init_thread_union
+init_thread_union:
+       .space  8192
+
        .globl  empty_zero_page
 empty_zero_page:
        .space  4096
index 39553b2363e449e35b6af0be0ddd009af93ae999..e561c77c7056a7aeec61c35e1e50ac2ea894cbce 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/pgtable.h>
 #include <asm/ibm4xx.h>
 #include <asm/cputable.h>
+#include <asm/thread_info.h>
 #include <asm/ppc_asm.h>
 #include "ppc_defs.h"
 
@@ -895,9 +896,9 @@ _GLOBAL(transfer_to_handler)
 
 stack_ovf:
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       lis     r1,init_task_union@ha
-       addi    r1,r1,init_task_union@l
-       addi    r1,r1,TASK_UNION_SIZE - STACK_FRAME_OVERHEAD
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
+       addi    r1,r1,THREAD_SIZE - STACK_FRAME_OVERHEAD
        lis     r24,StackOverflow@ha
        addi    r24,r24,StackOverflow@l
        li      r20,MSR_KERNEL
@@ -937,8 +938,8 @@ _GLOBAL(abort)
 start_here:
 
        /* ptr to current */
-       lis     r2,init_task_union@h
-       ori     r2,r2,init_task_union@l
+       lis     r2,init_task@h
+       ori     r2,r2,init_task@l
 
        /* ptr to phys current thread */
        tophys(r4,r2)
@@ -948,9 +949,10 @@ start_here:
        mtspr   SPRG2,r3        /* 0 => r1 has kernel sp */
 
        /* stack */
-       addi    r1,r2,TASK_UNION_SIZE
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
        li      r0,0
-       stwu    r0,-STACK_FRAME_OVERHEAD(r1)
+       stwu    r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
 
        bl      early_init      /* We have to do this with MMU on */
 
@@ -1080,6 +1082,8 @@ _GLOBAL(set_context)
  */
        .data
 _GLOBAL(sdata)
+_GLOBAL(init_thread_union)
+       .space  8192
 _GLOBAL(empty_zero_page)
        .space  4096
 _GLOBAL(swapper_pg_dir)
index 766a59507e29d813d260a72313d417f78cd5d23c..3d7f1496189f1f95f6b2288e5cef92624e3bd05f 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/cache.h>
 #include <asm/pgtable.h>
 #include <asm/cputable.h>
+#include <asm/thread_info.h>
 #include <asm/ppc_asm.h>
 #include "ppc_defs.h"
 
@@ -682,9 +683,9 @@ transfer_to_handler:
  */
 stack_ovf:
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       lis     r1,init_task_union@ha
-       addi    r1,r1,init_task_union@l
-       addi    r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
+       addi    r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
        lis     r24,StackOverflow@ha
        addi    r24,r24,StackOverflow@l
        li      r20,MSR_KERNEL
@@ -708,8 +709,8 @@ _GLOBAL(__setup_cpu_8xx)
 start_here:
 
        /* ptr to current */
-       lis     r2,init_task_union@h
-       ori     r2,r2,init_task_union@l
+       lis     r2,init_task@h
+       ori     r2,r2,init_task@l
 
        /* ptr to phys current thread */
        tophys(r4,r2)
@@ -719,9 +720,10 @@ start_here:
        mtspr   SPRG2,r3        /* 0 => r1 has kernel sp */
 
        /* stack */
-       addi    r1,r2,TASK_UNION_SIZE
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
        li      r0,0
-       stwu    r0,-STACK_FRAME_OVERHEAD(r1)
+       stwu    r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
 
        bl      early_init      /* We have to do this with MMU on */
 
@@ -969,6 +971,10 @@ set_dec_cpu6:
        .data
        .globl  sdata
 sdata:
+       .globl  init_thread_union
+init_thread_union:
+       .space  8192
+
        .globl  empty_zero_page
 empty_zero_page:
        .space  4096
index 46765589e9833d2f0105afec0f97ba594c1d73ab..1ee0f47ce89313fac5811df7285e2199252249fa 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/mmu.h>
 #include <asm/pgtable.h>
 #include <asm/ppc_asm.h>
+#include <asm/thread_info.h>
 #include "ppc_defs.h"
 #include "iSeries_asm.h"
 
@@ -565,9 +566,9 @@ transfer_to_handler:
  */
 stack_ovf:
        addi    r3,r1,STACK_FRAME_OVERHEAD
-       lis     r1,init_task_union@ha
-       addi    r1,r1,init_task_union@l
-       addi    r1,r1,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
+       addi    r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
        mfspr   r24,SPRG1
        li      r20,0
        stb     r20,PACAPROCENABLED(r24)        /* soft disable */
@@ -706,7 +707,7 @@ secondary_start:
        lwzx    r2,r2,r24
 
        /* stack */
-       addi    r1,r2,TASK_UNION_SIZE-STACK_FRAME_OVERHEAD
+       addi    r1,r2,THREAD_SIZE-STACK_FRAME_OVERHEAD
        li      r0,0
        stw     r0,0(r1)
 
@@ -767,8 +768,8 @@ start_here:
 
        /* ptr to current */
 
-       lis     r2,init_task_union@h
-       ori     r2,r2,init_task_union@l
+       lis     r2,init_task@h
+       ori     r2,r2,init_task@l
 
        /* Set up for using our exception vectors */
 
@@ -787,9 +788,10 @@ start_here:
 
        stb     r3,PACAPROCENABLED(r11) /* Soft disabled */
 
-       addi    r1,r2,TASK_UNION_SIZE
+       lis     r1,init_thread_union@ha
+       addi    r1,r1,init_thread_union@l
        li      r0,0
-       stwu    r0,-STACK_FRAME_OVERHEAD(r1)
+       stwu    r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
 
        /* fix klimit for system map */
        lis     r6,embedded_sysmap_end@ha
@@ -1495,6 +1497,10 @@ _GLOBAL(abort)
        .globl  sdata
 sdata:
 
+       .globl  init_thread_union
+init_thread_union:
+       .space  8192
+
        .globl  empty_zero_page
 empty_zero_page:
        .space  4096
index e6f2230d835fbad1540be803e71b1add10606981..ed68a0397634721947eb6244fc9bbf0b2644d0df 100644 (file)
@@ -78,16 +78,11 @@ int idled(void)
 #endif
 #ifdef CONFIG_SMP
                if (!do_power_save) {
-                       /*
-                        * Deal with another CPU just having chosen a thread to
-                        * run here:
-                        */
-                       unsigned long oldval;
-
-                       oldval = xchg(&current->work, 0xff000000);
-                       if (!(oldval & 0xff000000)) {
-                               while (current->work.need_resched == -1)
-                                       barrier();      /* Do Nothing */
+                       if (!need_resched()) {
+                               set_thread_flag(TIF_POLLING_NRFLAG);
+                               while (!test_thread_flag(TIF_NEED_RESCHED))
+                                       barrier();
+                               clear_thread_flag(TIF_POLLING_NRFLAG);
                        }
                }
 #endif
index cdc35c4d363eb880aef2ff20afb4e92321d8c252..a1c86e3ca3623fa2e895c37806cbe349c11d41de 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/pgtable.h>
 #include <asm/processor.h>
 #include <asm/cputable.h>
+#include <asm/thread_info.h>
 
 #ifdef CONFIG_PPC_ISERIES
 #include <asm/iSeries/Paca.h>
 int
 main(void)
 {
-       /*DEFINE(KERNELBASE, KERNELBASE);*/
+       DEFINE(THREAD_SIZE, THREAD_SIZE);
+       DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
+       DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
        DEFINE(STATE, offsetof(struct task_struct, state));
-       DEFINE(NEXT_TASK, offsetof(struct task_struct, next_task));
        DEFINE(THREAD, offsetof(struct task_struct, thread));
-       DEFINE(CPU, offsetof(struct task_struct, cpu));
        DEFINE(MM, offsetof(struct task_struct, mm));
        DEFINE(ACTIVE_MM, offsetof(struct task_struct, active_mm));
        DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
@@ -54,11 +55,6 @@ main(void)
        DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall));
        DEFINE(PT_REGS, offsetof(struct thread_struct, regs));
        DEFINE(TASK_FLAGS, offsetof(struct task_struct, flags));
-       DEFINE(TASK_WORK, offsetof(struct task_struct, work));
-       DEFINE(NEED_RESCHED, offsetof(struct task_struct, work.need_resched));
-       DEFINE(SYSCALL_TRACE, offsetof(struct task_struct, work.syscall_trace));
-       DEFINE(SIGPENDING, offsetof(struct task_struct, work.sigpending));
-       DEFINE(NOTIFY_RESUME, offsetof(struct task_struct, work.notify_resume));
        DEFINE(THREAD_FPEXC_MODE, offsetof(struct thread_struct, fpexc_mode));
        DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0]));
        DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr));
@@ -68,7 +64,6 @@ main(void)
        DEFINE(THREAD_VSCR, offsetof(struct thread_struct, vscr));
 #endif /* CONFIG_ALTIVEC */
        /* Interrupt register frame */
-       DEFINE(TASK_UNION_SIZE, sizeof(union task_union));
        DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD);
        DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs));
        /* in fact we only use gpr0 - gpr9 and gpr20 - gpr23 */
index 9a00a0efb999a7d033a14a84a357fb7863d0320b..7bae83b927c7e0ca31959f91820967526f3a35b4 100644 (file)
@@ -59,10 +59,8 @@ static struct files_struct init_files = INIT_FILES;
 static struct signal_struct init_signals = INIT_SIGNALS;
 struct mm_struct init_mm = INIT_MM(init_mm);
 
-/* this is 16-byte aligned because it has a stack in it */
-union task_union __attribute((aligned(16))) init_task_union = {
-       INIT_TASK(init_task_union.task)
-};
+/* initial task structure */
+struct task_struct init_task = INIT_TASK(init_task);
 
 /* only used to get secondary processor up */
 struct task_struct *current_set[NR_CPUS] = {&init_task, };
@@ -333,7 +331,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
 {
        struct pt_regs *childregs, *kregs;
        extern void ret_from_fork(void);
-       unsigned long sp = (unsigned long)p + sizeof(union task_union);
+       unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
        unsigned long childframe;
 
        /* Copy registers */
@@ -503,7 +501,7 @@ print_backtrace(unsigned long *sp)
 
 void show_trace_task(struct task_struct *tsk)
 {
-       unsigned long stack_top = (unsigned long) tsk + THREAD_SIZE;
+       unsigned long stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
        unsigned long sp, prev_sp;
        int count = 0;
 
@@ -623,7 +621,7 @@ extern void scheduling_functions_end_here(void);
 unsigned long get_wchan(struct task_struct *p)
 {
        unsigned long ip, sp;
-       unsigned long stack_page = (unsigned long) p;
+       unsigned long stack_page = (unsigned long) p->thread_info;
        int count = 0;
        if (!p || p == current || p->state == TASK_RUNNING)
                return 0;
index f806de5d718453db0eb2432ed2043339d35d2976..88f8c37a1c2ae732b5158b5e1863fc9b078981c4 100644 (file)
@@ -273,15 +273,9 @@ int sys_ptrace(long request, long pid, long addr, long data)
                if ((unsigned long) data > _NSIG)
                        break;
                if (request == PTRACE_SYSCALL) {
-                       if (!(child->ptrace & PT_SYSCALLTRACE)) {
-                               child->ptrace |= PT_SYSCALLTRACE;
-                               child->work.syscall_trace++;
-                       }
+                       set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
                } else {
-                       if (child->ptrace & PT_SYSCALLTRACE) {
-                               child->ptrace &= ~PT_SYSCALLTRACE;
-                               child->work.syscall_trace--;
-                       }
+                       clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
                }
                child->exit_code = data;
                /* make sure the single step bit is not set. */
@@ -311,10 +305,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                ret = -EIO;
                if ((unsigned long) data > _NSIG)
                        break;
-               if (child->ptrace & PT_SYSCALLTRACE) {
-                       child->ptrace &= ~PT_SYSCALLTRACE;
-                       child->work.syscall_trace--;
-               }
+               clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
                set_single_step(child);
                child->exit_code = data;
                /* give it a chance to run. */
@@ -350,7 +341,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
                break;
        }
 out_tsk:
-       free_task_struct(child);
+       put_task_struct(child);
 out:
        unlock_kernel();
        return ret;
@@ -358,8 +349,8 @@ out:
 
 void do_syscall_trace(void)
 {
-       if ((current->ptrace & (PT_PTRACED|PT_SYSCALLTRACE))
-           != (PT_PTRACED|PT_SYSCALLTRACE))
+        if (!test_thread_flag(TIF_SYSCALL_TRACE)
+           || !(current->ptrace & PT_PTRACED))
                return;
        current->exit_code = SIGTRAP;
        current->state = TASK_STOPPED;
index da82585918a1414a80121a0ddf9ae6714eb43181..9ae632b25d045816358e2aa94c8c73e5eda19811 100644 (file)
@@ -35,6 +35,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <asm/pmac_feature.h>
+#include <asm/thread_info.h>
 
 #if defined CONFIG_KGDB
 #include <asm/kgdb.h>
@@ -536,11 +537,14 @@ int __init ppc_init(void)
        if (ppc_md.init != NULL) {
                ppc_md.init();
        }
-       init_crc32();
+       return 0;
 }
 
 arch_initcall(ppc_init);
 
+/* Initial thread_info struct, copied into init_task_union */
+struct thread_info init_thread_values __initdata = INIT_THREAD_INFO(init_task);
+
 /* Warning, IO base is not yet inited */
 void __init setup_arch(char **cmdline_p)
 {
@@ -549,6 +553,9 @@ void __init setup_arch(char **cmdline_p)
        extern char *klimit;
        extern void do_init_bootmem(void);
 
+       /* initialize the thread_info for the init task */
+       init_thread_info = init_thread_values;
+
        /* so udelay does something sensible, assume <= 1000 bogomips */
        loops_per_jiffy = 500000000 / HZ;
 
index b074071d63f901959ccd7d59e159cfee907fe5e3..908a23e974f7c10952fcb73d42306f3278e1789c 100644 (file)
@@ -475,10 +475,10 @@ find_ide_boot(void)
        kdev_t __init pmac_find_ide_boot(char *bootdevice, int n);
 
        if (bootdevice == NULL)
-               return 0;
+               return NODEV;
        p = strrchr(bootdevice, '/');
        if (p == NULL)
-               return 0;
+               return NODEV;
        n = p - bootdevice;
 
        return pmac_find_ide_boot(bootdevice, n);
@@ -500,6 +500,16 @@ find_boot_device(void)
 #endif
 }
 
+static int initializing = 1;
+
+static int pmac_late_init(void)
+{
+       initializing = 0;
+       return 0;
+}
+
+late_initcall(pmac_late_init);
+
 /* can't be __init - can be called whenever a disk is first accessed */
 void __pmac
 note_bootable_part(kdev_t dev, int part, int goodness)
@@ -507,8 +517,7 @@ note_bootable_part(kdev_t dev, int part, int goodness)
        static int found_boot = 0;
        char *p;
 
-       /* Do nothing if the root has been mounted already. */
-       if (init_task.fs->rootmnt != NULL)
+       if (!initializing)
                return;
        if ((goodness <= current_root_goodness) &&
            !kdev_same(ROOT_DEV, to_kdev_t(DEFAULT_ROOT_DEVICE)))
index 2c4aa69aafd4e53d5d39f18ab0273a060bccf475..dcedb5213cd6f8847666314aa0508ba4054db1f0 100644 (file)
@@ -44,6 +44,7 @@ typedef struct {
 #define hardirq_exit(cpu)      (local_irq_count(cpu)--)
 
 #define synchronize_irq()      do { } while (0)
+#define release_irqlock(cpu)    do { } while (0)
 
 #else /* CONFIG_SMP */
 
index 4a843c6be6019ce87dbb9a29edac19423cc61c87..532776aa8687e94591e76e9deeb3a6b2406d3cf8 100644 (file)
@@ -171,15 +171,9 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
         * temporary 2.4 hack
         */
        for (i = 0; i < nents; i++) {
-               if (sg[i].address && sg[i].page)
+               if (!sg[i].page)
                        BUG();
-               else if (!sg[i].address && !sg[i].page)
-                       BUG();
-
-               if (sg[i].address)
-                       sg[i].dma_address = virt_to_bus(sg[i].address);
-               else
-                       sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
+               sg[i].dma_address = page_to_bus(sg[i].page) + sg[i].offset;
        }
 
        return nents;
index 843b81218ed473a1d92b2ed6d135a03c6973173c..0ed0a0070075a740ff47f84ca140ef5c437ade47 100644 (file)
@@ -12,6 +12,7 @@
 #define current_text_addr() ({ __label__ _l; _l: &&_l;})
 
 #include <linux/config.h>
+#include <linux/stringify.h>
 
 #include <asm/ptrace.h>
 #include <asm/types.h>
 #define _CHRP_Motorola 0x04  /* motorola chrp, the cobra */
 #define _CHRP_IBM      0x05  /* IBM chrp, the longtrail and longtrail 2 */
 
-#define __stringify(a) #a
 #define _GLOBAL(n)\
         .stabs __stringify(n:F-1),N_FUN,0,0,n;\
        .globl n;\
@@ -743,22 +743,10 @@ static inline unsigned int __pack_fe01(unsigned int fpmode)
        return ((fpmode << 10) & MSR_FE0) | ((fpmode << 8) & MSR_FE1);
 }
 
-/*
- * NOTE! The task struct and the stack go together
- */
-#define THREAD_SIZE (2*PAGE_SIZE)
-#define alloc_task_struct() \
-       ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
-#define free_task_struct(p)    free_pages((unsigned long)(p),1)
-#define get_task_struct(tsk)      atomic_inc(&virt_to_page(tsk)->count)
-
 /* in process.c - for early bootup debug -- Cort */
 int ll_printk(const char *, ...);
 void ll_puts(const char *);
 
-#define init_task      (init_task_union.task)
-#define init_stack     (init_task_union.stack)
-
 /* In misc.c */
 void _nmask_and_or_msr(unsigned long nmask, unsigned long or_val);
 
index 80be401b513f5702c92a3b1a0beefe1b39a82505..5f34a504e0386f5ca8aeef43796fbb1e989930db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * BK Id: SCCS/s.scatterlist.h 1.9 10/15/01 22:51:33 paulus
+ * BK Id: %F% %I% %G% %U% %#%
  */
 #ifdef __KERNEL__
 #ifndef _PPC_SCATTERLIST_H
@@ -8,11 +8,10 @@
 #include <asm/dma.h>
 
 struct scatterlist {
-       struct page * page;
-       unsigned int offset;
-
-       dma_addr_t dma_address; /* phys/bus dma address          */
-       unsigned int length;    /* length                        */
+       struct page     *page;
+       unsigned int    offset;
+       dma_addr_t      dma_address;
+       unsigned int    length;
 };
 
 /*
index 9de96607a428a90502f5e72517e293a327fd2f1f..7c93fdeafb2665b6340d7d8d09b24c68f65ce84e 100644 (file)
@@ -48,7 +48,7 @@ extern void smp_local_timer_interrupt(struct pt_regs *);
 #define cpu_logical_map(cpu) (cpu)
 #define cpu_number_map(x) (x)
 
-#define smp_processor_id() (current->cpu)
+#define smp_processor_id() (current_thread_info()->cpu)
 
 extern int smp_hw_index[NR_CPUS];
 #define hard_smp_processor_id() (smp_hw_index[smp_processor_id()])
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h
new file mode 100644 (file)
index 0000000..caeda7e
--- /dev/null
@@ -0,0 +1,76 @@
+/* thread_info.h: PPC low-level thread information
+ * adapted from the i386 version by Paul Mackerras
+ *
+ * Copyright (C) 2002  David Howells (dhowells@redhat.com)
+ * - Incorporating suggestions made by Linus Torvalds and Dave Miller
+ */
+
+#ifndef _ASM_THREAD_INFO_H
+#define _ASM_THREAD_INFO_H
+
+#ifdef __KERNEL__
+
+#ifndef __ASSEMBLY__
+#include <asm/processor.h>
+
+/*
+ * low level task data.
+ */
+struct thread_info {
+       struct task_struct *task;               /* main task structure */
+       struct exec_domain *exec_domain;        /* execution domain */
+       unsigned long   flags;                  /* low level flags */
+       int             cpu;                    /* cpu we're on */
+};
+
+/*
+ * macros/functions for gaining access to the thread information structure
+ */
+#define INIT_THREAD_INFO(tsk)                  \
+{                                              \
+       task:           &tsk,                   \
+       exec_domain:    &default_exec_domain,   \
+       flags:          0,                      \
+       cpu:            0,                      \
+}
+
+#define init_thread_info       (init_thread_union.thread_info)
+#define init_stack             (init_thread_union.stack)
+
+/* how to get the thread information struct from C */
+static inline struct thread_info *current_thread_info(void)
+{
+       struct thread_info *ti;
+       __asm__("rlwinm %0,1,0,0,18" : "=r"(ti));
+       return ti;
+}
+
+/* thread information allocation */
+#define alloc_thread_info() ((struct thread_info *) \
+                               __get_free_pages(GFP_KERNEL, 1))
+#define free_thread_info(ti)   free_pages((unsigned long) (ti), 1)
+#define get_thread_info(ti)    get_task_struct((ti)->task)
+#define put_thread_info(ti)    put_task_struct((ti)->task)
+#define THREAD_SIZE            (2*PAGE_SIZE)
+#endif /* __ASSEMBLY__ */
+
+/*
+ * thread information flag bit numbers
+ */
+#define TIF_SYSCALL_TRACE      0       /* syscall trace active */
+#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
+#define TIF_SIGPENDING         2       /* signal pending */
+#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling
+                                          TIF_NEED_RESCHED */
+
+/* as above, but as bit values */
+#define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
+#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
+#define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
+#define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
+#define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM_THREAD_INFO_H */