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

Unified Diff: tests/syscall_return_sandboxing/sandboxed_mips.S

Issue 12667019: [MIPS] Support for building tests for MIPS (Closed) Base URL: http://git.chromium.org/native_client/src/native_client.git@master
Patch Set: updates to sandboxed_mips.S. Created 7 years, 9 months 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
Index: tests/syscall_return_sandboxing/sandboxed_mips.S
diff --git a/tests/syscall_return_sandboxing/sandboxed_mips.S b/tests/syscall_return_sandboxing/sandboxed_mips.S
new file mode 100644
index 0000000000000000000000000000000000000000..ff2882115fffb8112ff23290b0df44a0a1fd8c4c
--- /dev/null
+++ b/tests/syscall_return_sandboxing/sandboxed_mips.S
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2013 The Native Client Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * Assume 32-byte trampoline slots, 16-byte bundles.
+ */
+#define GETTIMEOFDAY_ADDR 0x10500
+#define STORE_MASK $t7
+#define JUMP_MASK $t6
+#define BREAK_INST .word 0xd
+
+ .data
+timebuf:
+ .space 0x200 /* enough for a timeval */
+ .text
+ .globl SyscallReturnIsSandboxed
+SyscallReturnIsSandboxed:
+ .set noreorder
+
+ addiu $sp, $sp, -24
+ and $sp, $sp, STORE_MASK
+ sw $ra, 20($sp)
+ lui $a0, %hi(timebuf)
+
+ addiu $a0, $a0, %lo(timebuf)
+ addu $a1, $zero, $zero
+ lui $ra, %hi(bad)
+ addiu $ra, $ra, %lo(bad)
+
+ lui $a2, %hi(GETTIMEOFDAY_ADDR)
+ addiu $a2, $a2, %lo(GETTIMEOFDAY_ADDR)
+ and $a2, $a2, JUMP_MASK
+ jr $a2
+
+ nop
Mark Seaborn 2013/03/12 21:55:24 FWIW, adding in ".p2align 4" as well makes this mo
+ nop
+ nop
+ nop
+
+ /* Expected return address */
+ b done
+ nop
+ /*
+ * We don't expect the syscall to return to the following unaligned
+ * address or to align up to the bundle boundary after it.
+ */
+bad:
+ BREAK_INST /* Abort */
+ BREAK_INST
+
+ BREAK_INST
+ BREAK_INST
+ BREAK_INST
+ BREAK_INST
+
+done:
+ ori $v0, $zero, 1 /* Indicate success */
+ lw $ra, 20($sp)
+ addiu $sp, $sp, 24
+ and $sp, $sp, STORE_MASK
+
+ and $ra, $ra, JUMP_MASK
+ jr $ra
+ nop
+
« no previous file with comments | « tests/syscall_return_sandboxing/nacl.scons ('k') | tests/thread_capture/arch/mips/thread_capture_test_injection.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698