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:
@@ -14,7 +14,7 @@ std::atomic_ulong done;
|
||||
int futex = 1;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ std::atomic_ulong done;
|
||||
int futex = 1;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ int main(int argc, char **argv) {
|
||||
thread = std::thread(myfunc);
|
||||
while (!done.load()) {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user