Commit 4e43e5df authored by Huacai Chen's avatar Huacai Chen Committed by Thomas Bogendoerfer

MIPS: context switch: Use save/restore instead of set/clear for Status.CU2

Some processors (such as Loongson-3) need to enable CU2 in kernel mode,
current set/clear method will lose Status.CU2 during context switching,
so use save/restore method instead.
Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
Signed-off-by: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 6fa573a3
...@@ -117,6 +117,8 @@ do { \ ...@@ -117,6 +117,8 @@ do { \
__restore_dsp(next); \ __restore_dsp(next); \
} \ } \
if (cop2_present) { \ if (cop2_present) { \
u32 status = read_c0_status(); \
\
set_c0_status(ST0_CU2); \ set_c0_status(ST0_CU2); \
if ((KSTK_STATUS(prev) & ST0_CU2)) { \ if ((KSTK_STATUS(prev) & ST0_CU2)) { \
if (cop2_lazy_restore) \ if (cop2_lazy_restore) \
...@@ -127,7 +129,7 @@ do { \ ...@@ -127,7 +129,7 @@ do { \
!cop2_lazy_restore) { \ !cop2_lazy_restore) { \
cop2_restore(next); \ cop2_restore(next); \
} \ } \
clear_c0_status(ST0_CU2); \ write_c0_status(status); \
} \ } \
__clear_r5_hw_ll_bit(); \ __clear_r5_hw_ll_bit(); \
__clear_software_ll_bit(); \ __clear_software_ll_bit(); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment