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

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: 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..02725743c12a70f123d092b54c6cf0bab4490403
--- /dev/null
+++ b/tests/syscall_return_sandboxing/sandboxed_mips.S
@@ -0,0 +1,48 @@
+/*
+ * 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
+
+ .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 /* sandboxed (bundle aligned) return address */
Mark Seaborn 2013/03/12 00:39:29 This would be more robust as: .p2align 4 /* Exp
+ xor $v0, $v0, 1 /* expected return value */
+bad: lw $ra, 20($sp) /* non-sandboxed return address */
+ nop
+
+ 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