diff options
| author | Paul Mackerras <paulus@tango.paulus.ozlabs.org> | 2002-02-12 20:26:28 +1100 |
|---|---|---|
| committer | Paul Mackerras <paulus@quango.(none)> | 2002-02-12 20:26:28 +1100 |
| commit | 429c7cd2f91a46a5368a7eb3ba294e29727aeda8 (patch) | |
| tree | 29b6fe01a8fbd67ab819ec8523bb3940dceddbae | |
| parent | 9b3882db851cf53923237d3291fe089c6aeb8cef (diff) | |
Update PPC for recent generic changes; in particular adapt to
having the thread_info struct at the base of the stack and
the task_struct elsewhere.
| -rw-r--r-- | arch/ppc/Makefile | 11 | ||||
| -rw-r--r-- | arch/ppc/config.in | 1 | ||||
| -rw-r--r-- | arch/ppc/kernel/Makefile | 4 | ||||
| -rw-r--r-- | arch/ppc/kernel/checks.c | 58 | ||||
| -rw-r--r-- | arch/ppc/kernel/entry.S | 31 | ||||
| -rw-r--r-- | arch/ppc/kernel/head.S | 22 | ||||
| -rw-r--r-- | arch/ppc/kernel/head_4xx.S | 18 | ||||
| -rw-r--r-- | arch/ppc/kernel/head_8xx.S | 20 | ||||
| -rw-r--r-- | arch/ppc/kernel/iSeries_head.S | 22 | ||||
| -rw-r--r-- | arch/ppc/kernel/idle.c | 15 | ||||
| -rw-r--r-- | arch/ppc/kernel/mk_defs.c | 13 | ||||
| -rw-r--r-- | arch/ppc/kernel/process.c | 12 | ||||
| -rw-r--r-- | arch/ppc/kernel/ptrace.c | 21 | ||||
| -rw-r--r-- | arch/ppc/kernel/setup.c | 9 | ||||
| -rw-r--r-- | arch/ppc/platforms/pmac_setup.c | 17 | ||||
| -rw-r--r-- | include/asm-ppc/hardirq.h | 1 | ||||
| -rw-r--r-- | include/asm-ppc/pci.h | 10 | ||||
| -rw-r--r-- | include/asm-ppc/processor.h | 14 | ||||
| -rw-r--r-- | include/asm-ppc/scatterlist.h | 11 | ||||
| -rw-r--r-- | include/asm-ppc/smp.h | 2 | ||||
| -rw-r--r-- | include/asm-ppc/thread_info.h | 76 |
21 files changed, 199 insertions, 189 deletions
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile index 3fbf5d015cab..e2bb9d7c860b 100644 --- a/arch/ppc/Makefile +++ b/arch/ppc/Makefile @@ -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 diff --git a/arch/ppc/config.in b/arch/ppc/config.in index 647944799449..3f4208cc8a0a 100644 --- a/arch/ppc/config.in +++ b/arch/ppc/config.in @@ -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 diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile index d00aacf316d8..d2373a5850f5 100644 --- a/arch/ppc/kernel/Makefile +++ b/arch/ppc/kernel/Makefile @@ -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 index c9bff439dc7f..000000000000 --- a/arch/ppc/kernel/checks.c +++ /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; -} diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S index 70fae23e5ffd..8017ce55ca7c 100644 --- a/arch/ppc/kernel/entry.S +++ b/arch/ppc/kernel/entry.S @@ -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 /* diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S index 6a57fa4dad53..2f1de5e97f06 100644 --- a/arch/ppc/kernel/head.S +++ b/arch/ppc/kernel/head.S @@ -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 diff --git a/arch/ppc/kernel/head_4xx.S b/arch/ppc/kernel/head_4xx.S index 39553b2363e4..e561c77c7056 100644 --- a/arch/ppc/kernel/head_4xx.S +++ b/arch/ppc/kernel/head_4xx.S @@ -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) diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S index 766a59507e29..3d7f1496189f 100644 --- a/arch/ppc/kernel/head_8xx.S +++ b/arch/ppc/kernel/head_8xx.S @@ -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 diff --git a/arch/ppc/kernel/iSeries_head.S b/arch/ppc/kernel/iSeries_head.S index 46765589e983..1ee0f47ce893 100644 --- a/arch/ppc/kernel/iSeries_head.S +++ b/arch/ppc/kernel/iSeries_head.S @@ -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 diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c index e6f2230d835f..ed68a0397634 100644 --- a/arch/ppc/kernel/idle.c +++ b/arch/ppc/kernel/idle.c @@ -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(¤t->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 diff --git a/arch/ppc/kernel/mk_defs.c b/arch/ppc/kernel/mk_defs.c index cdc35c4d363e..a1c86e3ca362 100644 --- a/arch/ppc/kernel/mk_defs.c +++ b/arch/ppc/kernel/mk_defs.c @@ -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> @@ -41,11 +42,11 @@ 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 */ diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c index 9a00a0efb999..7bae83b927c7 100644 --- a/arch/ppc/kernel/process.c +++ b/arch/ppc/kernel/process.c @@ -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; diff --git a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c index f806de5d7184..88f8c37a1c2a 100644 --- a/arch/ppc/kernel/ptrace.c +++ b/arch/ppc/kernel/ptrace.c @@ -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; diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c index da82585918a1..9ae632b25d04 100644 --- a/arch/ppc/kernel/setup.c +++ b/arch/ppc/kernel/setup.c @@ -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; diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c index b074071d63f9..908a23e974f7 100644 --- a/arch/ppc/platforms/pmac_setup.c +++ b/arch/ppc/platforms/pmac_setup.c @@ -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))) diff --git a/include/asm-ppc/hardirq.h b/include/asm-ppc/hardirq.h index 2c4aa69aafd4..dcedb5213cd6 100644 --- a/include/asm-ppc/hardirq.h +++ b/include/asm-ppc/hardirq.h @@ -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 */ diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h index 4a843c6be601..532776aa8687 100644 --- a/include/asm-ppc/pci.h +++ b/include/asm-ppc/pci.h @@ -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; diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index 843b81218ed4..0ed0a0070075 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -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> @@ -558,7 +559,6 @@ #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); diff --git a/include/asm-ppc/scatterlist.h b/include/asm-ppc/scatterlist.h index 80be401b513f..5f34a504e038 100644 --- a/include/asm-ppc/scatterlist.h +++ b/include/asm-ppc/scatterlist.h @@ -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; }; /* diff --git a/include/asm-ppc/smp.h b/include/asm-ppc/smp.h index 9de96607a428..7c93fdeafb26 100644 --- a/include/asm-ppc/smp.h +++ b/include/asm-ppc/smp.h @@ -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 index 000000000000..caeda7e3bbfb --- /dev/null +++ b/include/asm-ppc/thread_info.h @@ -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 */ |
