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 /arch/mips64 | |
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 'arch/mips64')
-rw-r--r-- | arch/mips64/kernel/head.S | 7 | ||||
-rw-r--r-- | arch/mips64/kernel/r4k_switch.S | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/arch/mips64/kernel/head.S b/arch/mips64/kernel/head.S index a789d818a..cc19d318c 100644 --- a/arch/mips64/kernel/head.S +++ b/arch/mips64/kernel/head.S @@ -64,7 +64,12 @@ NESTED(kernel_entry, 16, sp) # kernel entry point daddiu t0, $28, KERNEL_STACK_SIZE-32 sd t0, kernelsp dsubu sp, t0, 4*SZREG # init stack pointer - + move t0, $28 +#ifdef CONFIG_SMP + mtc0 t0, CP0_WATCHLO + dsrl32 t0, t0, 0 + mtc0 t0, CP0_WATCHHI +#endif jal start_kernel 1: b 1b # just in case ... END(kernel_entry) diff --git a/arch/mips64/kernel/r4k_switch.S b/arch/mips64/kernel/r4k_switch.S index 05ebac4de..8ad1c5eb0 100644 --- a/arch/mips64/kernel/r4k_switch.S +++ b/arch/mips64/kernel/r4k_switch.S @@ -9,6 +9,7 @@ * Copyright (C) 1994, 1995, 1996, by Andreas Busse * Copyright (C) 1999 Silicon Graphics, Inc. */ +#include <linux/config.h> #include <asm/asm.h> #include <asm/bootinfo.h> #include <asm/cachectl.h> @@ -43,8 +44,14 @@ */ move $28, a1 cpu_restore_nonscratch $28 +#ifndef CONFIG_SMP daddiu t0, $28, KERNEL_STACK_SIZE-32 sd t0, kernelsp +#else + mtc0 a1, CP0_WATCHLO + dsrl32 a1, a1, 0 + mtc0 a1, CP0_WATCHHI +#endif mfc0 t1, CP0_STATUS /* Do we really need this? */ li a3, 0xff00 and t1, a3 |