| 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 */
|
| + 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
|
| +
|
|
|