diff options
author | Kanoj Sarcar <kanoj@engr.sgi.com> | 2000-04-25 16:04:51 +0000 |
---|---|---|
committer | Kanoj Sarcar <kanoj@engr.sgi.com> | 2000-04-25 16:04:51 +0000 |
commit | 3eae3bd10dd78ad075f2e70d511534becaae7914 (patch) | |
tree | 5ea53d7ee9fd35af22416abba831e124fc160ac5 /include | |
parent | 35cf77f2195a9d93146076702d991663edddd267 (diff) |
We use the ST0_CU0 bit to determine whether we are coming into
kernel mode for the first time from user mode (on intr/exception/
syscall etc). If so, we need to set the sp to point to the kernel
stack. On UP kernels, the kernel stack pointer is stored in
the global variable "kernelsp". For SMP kernel, the physical
address of the current task structure is stuffed into the
watchlo/watchhi registers, so on first entry into the kernel,
we need to munge this value properly to setup the sp register.
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-mips64/current.h | 17 | ||||
-rw-r--r-- | include/asm-mips64/stackframe.h | 14 |
2 files changed, 14 insertions, 17 deletions
diff --git a/include/asm-mips64/current.h b/include/asm-mips64/current.h index abaab72af..d957f3a4c 100644 --- a/include/asm-mips64/current.h +++ b/include/asm-mips64/current.h @@ -15,21 +15,4 @@ register struct task_struct *current asm("$28"); #endif /* _LANGUAGE_C */ -#ifdef _LANGUAGE_ASSEMBLY - -/* - * Special variant for use by exception handlers when the stack pointer - * is not loaded. - */ -#define _GET_CURRENT(reg) \ - lui reg, %hi(kernelsp); \ - .set push; \ - .set noreorder; \ - ld reg, %lo(kernelsp)(reg); \ - .set pop; \ - ori reg, 0x3fff; \ - xori reg, 0x3fff - -#endif - #endif /* _ASM_CURRENT_H */ diff --git a/include/asm-mips64/stackframe.h b/include/asm-mips64/stackframe.h index aa0a15fc9..0257bb07a 100644 --- a/include/asm-mips64/stackframe.h +++ b/include/asm-mips64/stackframe.h @@ -11,8 +11,12 @@ #ifndef _ASM_STACKFRAME_H #define _ASM_STACKFRAME_H +#include <linux/config.h> + #include <asm/asm.h> #include <asm/offset.h> +#include <asm/processor.h> +#include <asm/addrspace.h> #ifdef _LANGUAGE_C @@ -82,8 +86,18 @@ move k1, sp .set reorder /* Called from user mode, new stack. */ +#ifndef CONFIG_SMP lui k1, %hi(kernelsp) ld k1, %lo(kernelsp)(k1) +#else + mfc0 k1, CP0_WATCHHI + mfc0 k0, CP0_WATCHLO + dsll32 k1, k1, 0 + or k1, k1, k0 + li k0, K0BASE + or k1, k1, k0 + daddiu k1, k1, KERNEL_STACK_SIZE-32 +#endif 8: move k0, sp dsubu sp, k1, PT_SIZE sd k0, PT_R29(sp) |