hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/arch/nds32/kernel/ex-entry.S
....@@ -7,6 +7,7 @@
77 #include <asm/errno.h>
88 #include <asm/asm-offsets.h>
99 #include <asm/page.h>
10
+#include <asm/fpu.h>
1011
1112 #ifdef CONFIG_HWZOL
1213 .macro push_zol
....@@ -15,12 +16,31 @@
1516 mfusr $r16, $LC
1617 .endm
1718 #endif
19
+ .macro skip_save_fucop_ctl
20
+#if defined(CONFIG_FPU)
21
+skip_fucop_ctl:
22
+ smw.adm $p0, [$sp], $p0, #0x1
23
+ j fucop_ctl_done
24
+#endif
25
+ .endm
1826
1927 .macro save_user_regs
20
-
28
+#if defined(CONFIG_FPU)
29
+ sethi $p0, hi20(has_fpu)
30
+ lbsi $p0, [$p0+lo12(has_fpu)]
31
+ beqz $p0, skip_fucop_ctl
32
+ mfsr $p0, $FUCOP_CTL
33
+ smw.adm $p0, [$sp], $p0, #0x1
34
+ bclr $p0, $p0, #FUCOP_CTL_offCP0EN
35
+ mtsr $p0, $FUCOP_CTL
36
+fucop_ctl_done:
37
+ /* move $SP to the bottom of pt_regs */
38
+ addi $sp, $sp, -FUCOP_CTL_OFFSET
39
+#else
2140 smw.adm $sp, [$sp], $sp, #0x1
2241 /* move $SP to the bottom of pt_regs */
2342 addi $sp, $sp, -OSP_OFFSET
43
+#endif
2444
2545 /* push $r0 ~ $r25 */
2646 smw.bim $r0, [$sp], $r25
....@@ -79,6 +99,7 @@
7999 .long eh_syscall !Syscall
80100 .long asm_do_IRQ !IRQ
81101
102
+ skip_save_fucop_ctl
82103 common_exception_handler:
83104 save_user_regs
84105 mfsr $p0, $ITYPE
....@@ -103,7 +124,6 @@
103124 mtsr $r21, $PSW
104125 dsb
105126 jr $p1
106
-
107127 /* syscall */
108128 1:
109129 addi $p1, $p0, #-NDS32_VECTOR_offEXCEPTION