allocator-test: fix trusted stack revocation probe
Ensure that the compiler loads the to be revoked pointer into a register
prior to releasing the main thread. Otherwise, there is a chance that
we never hold an unrevoked copy in the register file.
Embarrassing fix to
https://github.com/CHERIoT-Platform/cheriot-rtos/pull/422
diff --git a/tests/allocator-test.cc b/tests/allocator-test.cc
index ae71d5d..87af6c3 100644
--- a/tests/allocator-test.cc
+++ b/tests/allocator-test.cc
@@ -126,14 +126,12 @@
async([=]() {
int ptag, scratch;
- // Tell the main thread to go
- state = 0;
-
/*
- * Busy spin, ensuring that our test pointer is in a register
- * throughout, then get its tag.
+ * Release the main thread, then busy spin, ensuring that our
+ * test pointer is in a register throughout, then get its tag.
*/
- __asm__ volatile("1:\n"
+ __asm__ volatile("csw zero, 0(%[state])\n"
+ "1:\n"
"clw %[scratch], 0(%[state])\n"
"beqz %[scratch], 1b\n"
"cgettag %[out], %[p]\n"