diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1997-06-09 06:20:52 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1997-06-09 06:20:52 +0000 |
commit | 0b898e7acdab77a9eb047edf7235cb25151ee6da (patch) | |
tree | e297c006a447dd9b6869754f8f201b5330a02da1 /arch | |
parent | a2320c942ccf93dc1c72869f91829e7779e50ee6 (diff) |
Fix a couple of bug related to the new handling of the stack and the
current pointer.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/head.S | 32 | ||||
-rw-r--r-- | arch/mips/kernel/process.c | 9 | ||||
-rw-r--r-- | arch/mips/kernel/r4k_misc.S | 3 |
3 files changed, 12 insertions, 32 deletions
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S index d7f3855c0..27c700a95 100644 --- a/arch/mips/kernel/head.S +++ b/arch/mips/kernel/head.S @@ -12,6 +12,7 @@ #include <linux/tasks.h> #include <asm/asm.h> +#include <asm/current.h> #include <asm/offset.h> #include <asm/processor.h> #include <asm/regdef.h> @@ -22,18 +23,6 @@ #include <asm/bootinfo.h> #include <asm/cpu.h> -/* - * Get current task pointer - */ -#define GET_CURRENT(reg) \ - lui reg, %hi(kernelsp); \ - .set push; \ - .set noreorder; \ - lw reg, %lo(kernelsp)(reg); \ - .set pop; \ - ori reg, 8191; \ - xori reg, 8191 - .text /* * Reserved space for exception handlers. @@ -55,7 +44,7 @@ LEAF(except_vec0_r4000) .set mips3 mfc0 k0, CP0_BADVADDR # Get faulting address - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 # get pgd only bits lw k1, THREAD_PGDIR(k1) # get task pg_dir sll k0, k0, 2 @@ -82,7 +71,7 @@ LEAF(except_vec0_r4600) .set mips3 mfc0 k0, CP0_BADVADDR - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 lw k1, THREAD_PGDIR(k1) sll k0, k0, 2 @@ -108,7 +97,7 @@ LEAF(except_vec0_r45k_bvahwbug) .set mips3 mfc0 k0, CP0_BADVADDR - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 lw k1, THREAD_PGDIR(k1) sll k0, k0, 2 @@ -138,7 +127,7 @@ LEAF(except_vec0_r4k_mphwbug) .set mips3 mfc0 k0, CP0_BADVADDR - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 lw k1, THREAD_PGDIR(k1) sll k0, k0, 2 @@ -168,7 +157,7 @@ LEAF(except_vec0_r4k_250MHZhwbug) .set mips3 mfc0 k0, CP0_BADVADDR - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 lw k1, THREAD_PGDIR(k1) sll k0, k0, 2 @@ -198,7 +187,7 @@ LEAF(except_vec0_r4k_MP250MHZhwbug) .set mips3 mfc0 k0, CP0_BADVADDR - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 lw k1, THREAD_PGDIR(k1) sll k0, k0, 2 @@ -230,7 +219,7 @@ LEAF(except_vec0_r2300) .set mips1 mfc0 k0, CP0_BADVADDR - GET_CURRENT(k1) # get current task ptr + _GET_CURRENT(k1) # get current task ptr srl k0, k0, 22 lw k1, THREAD_PGDIR(k1) sll k0, k0, 2 @@ -408,12 +397,9 @@ probe_done: /* * Stack for kernel and init - * - * Kernelsp will never be referenced for process 0. */ 9: la sp, init_task_union+(KERNEL_STACK_SIZE-4*SZREG) - la t0, init_task_union+(KERNEL_STACK_SIZE) - sw t0, kernelsp + sw sp, kernelsp /* Disable coprocessors */ mfc0 t0, CP0_STATUS diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 08dd13c6c..3ffb9b258 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c @@ -64,20 +64,13 @@ void release_thread(struct task_struct *dead_task) { } -#define roundup(val, rnd) ({ \ - unsigned _v = val; \ - unsigned long _r = rnd; \ - _v = (_v + _r - 1) & ~(_r - 1); \ - _v; \ -}) - int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, struct task_struct * p, struct pt_regs * regs) { struct pt_regs * childregs; long childksp; - childksp = roundup((unsigned long)p, KERNEL_STACK_SIZE) - 8; + childksp = (unsigned long)p + KERNEL_STACK_SIZE - 8; /* set up new TSS. */ childregs = ((struct pt_regs *) ((unsigned long)p + KERNEL_STACK_SIZE)) - 1; diff --git a/arch/mips/kernel/r4k_misc.S b/arch/mips/kernel/r4k_misc.S index 5c9ad4d84..0cbc2222f 100644 --- a/arch/mips/kernel/r4k_misc.S +++ b/arch/mips/kernel/r4k_misc.S @@ -7,6 +7,7 @@ * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com) */ #include <asm/asm.h> +#include <asm/current.h> #include <asm/offset.h> #include <asm/bootinfo.h> #include <asm/cachectl.h> @@ -31,7 +32,7 @@ #define LOAD_PTE(pte, ptr) \ mfc0 pte, CP0_BADVADDR; \ srl pte, pte, 22; \ - GET_CURRENT(ptr); \ + _GET_CURRENT(ptr); \ sll pte, pte, 2; \ lw ptr, THREAD_PGDIR(ptr); \ addu ptr, pte, ptr; \ |