fix wfe_ldxr_* examples with sevl to make things more hardware independant

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-01-13 00:00:00 +00:00
parent 3b3f073e2c
commit cc1d34f862
3 changed files with 4 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -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();