mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
fix wfe_ldxr_* examples with sevl to make things more hardware independant
This commit is contained in:
@@ -17523,7 +17523,7 @@ Also keep in mind that fused multiply add is FMADD.
|
|||||||
|
|
||||||
Examples at: xref:simd-assembly[xrefstyle=full]
|
Examples at: xref:simd-assembly[xrefstyle=full]
|
||||||
|
|
||||||
===== ARMv8 aarch64 ld2 instruction
|
===== ARMv8 aarch64 LD2 instruction
|
||||||
|
|
||||||
Example: link:userland/arch/aarch64/ld2.S[]
|
Example: link:userland/arch/aarch64/ld2.S[]
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ std::atomic_ulong done;
|
|||||||
int futex = 1;
|
int futex = 1;
|
||||||
|
|
||||||
void myfunc() {
|
void myfunc() {
|
||||||
__asm__ __volatile__ ("ldxr x0, [%0];wfe;wfe" : : "r" (&futex) : "x0");
|
__asm__ __volatile__ ("sevl;wfe;ldxr x0, [%0];wfe" : : "r" (&futex) : "x0");
|
||||||
done.store(futex);
|
done.store(futex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ std::atomic_ulong done;
|
|||||||
int futex = 1;
|
int futex = 1;
|
||||||
|
|
||||||
void myfunc() {
|
void myfunc() {
|
||||||
__asm__ __volatile__ ("ldxr x0, [%0];wfe;wfe" : : "r" (&futex) : "x0");
|
__asm__ __volatile__ ("sevl;wfe;ldxr x0, [%0];wfe" : : "r" (&futex) : "x0");
|
||||||
done.store(futex);
|
done.store(futex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ int main(int argc, char **argv) {
|
|||||||
thread = std::thread(myfunc);
|
thread = std::thread(myfunc);
|
||||||
while (!done.load()) {
|
while (!done.load()) {
|
||||||
if (do_sev) {
|
if (do_sev) {
|
||||||
__asm__ __volatile__ ("mov x0, 1;ldxr x0, [%0];stxr w1, x0, [%0]" : : "r" (&futex) : "x0", "x1");
|
__asm__ __volatile__ ("ldxr x0, [%0];mov x0, 1;stxr w1, x0, [%0]" : : "r" (&futex) : "x0", "x1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thread.join();
|
thread.join();
|
||||||
|
|||||||
Reference in New Issue
Block a user