forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/mips/kernel/syscall.c
....@@ -37,6 +37,7 @@
3737 #include <asm/signal.h>
3838 #include <asm/sim.h>
3939 #include <asm/shmparam.h>
40
+#include <asm/sync.h>
4041 #include <asm/sysmips.h>
4142 #include <asm/switch_to.h>
4243
....@@ -80,6 +81,7 @@
8081
8182 save_static_function(sys_fork);
8283 save_static_function(sys_clone);
84
+save_static_function(sys_clone3);
8385
8486 SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
8587 {
....@@ -101,11 +103,12 @@
101103 if (unlikely(addr & 3))
102104 return -EINVAL;
103105
104
- if (unlikely(!access_ok(VERIFY_WRITE, (const void __user *)addr, 4)))
106
+ if (unlikely(!access_ok((const void __user *)addr, 4)))
105107 return -EINVAL;
106108
107
- if (cpu_has_llsc && R10000_LLSC_WAR) {
109
+ if (cpu_has_llsc && IS_ENABLED(CONFIG_WAR_R10000_LLSC)) {
108110 __asm__ __volatile__ (
111
+ " .set push \n"
109112 " .set arch=r4000 \n"
110113 " li %[err], 0 \n"
111114 "1: ll %[old], (%[addr]) \n"
....@@ -122,7 +125,7 @@
122125 " "STR(PTR)" 1b, 4b \n"
123126 " "STR(PTR)" 2b, 4b \n"
124127 " .previous \n"
125
- " .set mips0 \n"
128
+ " .set pop \n"
126129 : [old] "=&r" (old),
127130 [err] "=&r" (err),
128131 [tmp] "=&r" (tmp)
....@@ -132,9 +135,11 @@
132135 : "memory");
133136 } else if (cpu_has_llsc) {
134137 __asm__ __volatile__ (
138
+ " .set push \n"
135139 " .set "MIPS_ISA_ARCH_LEVEL" \n"
136140 " li %[err], 0 \n"
137141 "1: \n"
142
+ " " __SYNC(full, loongson3_war) " \n"
138143 user_ll("%[old]", "(%[addr])")
139144 " move %[tmp], %[new] \n"
140145 "2: \n"
....@@ -150,7 +155,7 @@
150155 " "STR(PTR)" 1b, 5b \n"
151156 " "STR(PTR)" 2b, 5b \n"
152157 " .previous \n"
153
- " .set mips0 \n"
158
+ " .set pop \n"
154159 : [old] "=&r" (old),
155160 [err] "=&r" (err),
156161 [tmp] "=&r" (tmp)