Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: tests/thread_suspension/suspend_test_guest.c

Issue 121833002: [MIPS] Add support for thread_suspension test (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: Remove strayed backslashes. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/trusted/service_runtime/thread_suspension_unwind.c ('k') | tests/thread_suspension/suspend_test_host.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/thread_suspension/suspend_test_guest.c
diff --git a/tests/thread_suspension/suspend_test_guest.c b/tests/thread_suspension/suspend_test_guest.c
index 2d2f84793a353c223bfdf03e70e3ecc1e27f433a..1773ed53f7e1551dfbadf98a63e9c2292dff9b2c 100644
--- a/tests/thread_suspension/suspend_test_guest.c
+++ b/tests/thread_suspension/suspend_test_guest.c
@@ -105,6 +105,19 @@ static void RegisterSetterThread(struct SuspendTestShm *test_shm) {
"str r0, [r0]\n"
"spin_instruction:\n"
"b spin_instruction\n");
+#elif defined(__mips__)
+ regs->a0 = (uintptr_t) test_shm;
+ ASM_WITH_REGS(
+ regs,
+ /* Align to ensure no NOPs are inserted in the code that follows. */
+ ".p2align 4\n"
+ /* Set "test_shm->var = test_shm" to indicate that we are ready. */
+ "and $a0, $a0, $t7\n"
+ "sw $a0, 0($a0)\n"
+ ".global spin_instruction\n"
+ "spin_instruction:\n"
+ "b spin_instruction\n"
+ "nop\n");
#else
# error Unsupported architecture
#endif
@@ -161,6 +174,15 @@ static void SyscallRegisterSetterThread(struct SuspendTestShm *test_shm) {
&call_regs,
"bic r1, r1, #0xf000000f\n"
"bx r1\n");
+#elif defined(__mips__)
+ call_regs.a0 = (uintptr_t) test_shm; /* Set syscall argument */
+ call_regs.t9 = syscall_addr; /* Scratch register */
+ call_regs.return_addr = (uintptr_t) ContinueAfterSyscall;
+ ASM_WITH_REGS(
+ &call_regs,
+ "and $t9, $t9, $t6\n"
+ "jr $t9\n"
+ "nop\n");
#else
# error Unsupported architecture
#endif
@@ -193,6 +215,17 @@ __asm__(".pushsection .text, \"ax\", %progbits\n"
"bic r4, r4, #0xc000000f\n"
"bx r4\n"
".popsection\n");
+#elif defined(__mips__)
+__asm__(".pushsection .text, \"ax\", %progbits\n"
+ ".p2align 4\n"
+ ".global SyscallReturnAddress\n"
+ "SyscallReturnAddress:\n"
+ "lui $ra, %hi(SyscallReturnAddress)\n"
+ "addiu $ra, $ra, %lo(SyscallReturnAddress)\n"
+ "and $s0, $s0, $t6\n"
+ "jr $s0\n"
+ "nop\n"
+ ".popsection\n");
#else
# error Unsupported architecture
#endif
@@ -220,6 +253,8 @@ static void SyscallRegisterSetterLoopThread(struct SuspendTestShm *test_shm) {
regs->r12 = syscall_addr;
#elif defined(__arm__)
regs->r4 = syscall_addr;
+#elif defined(__mips__)
+ regs->s0 = syscall_addr;
#else
# error Unsupported architecture
#endif
« no previous file with comments | « src/trusted/service_runtime/thread_suspension_unwind.c ('k') | tests/thread_suspension/suspend_test_host.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698