OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can be | |
4 * found in the LICENSE file. | |
5 */ | |
6 | |
7 /* | |
8 * Assume 32-byte trampoline slots, 16-byte bundles. | |
9 */ | |
10 #define GETTIMEOFDAY_ADDR 0x10500 | |
11 #define STORE_MASK $t7 | |
12 #define JUMP_MASK $t6 | |
13 #define BREAK_INST .word 0xd | |
14 | |
15 .data | |
16 timebuf: | |
17 .space 0x200 /* enough for a timeval */ | |
18 .text | |
19 .globl SyscallReturnIsSandboxed | |
20 SyscallReturnIsSandboxed: | |
21 .set noreorder | |
22 | |
23 addiu $sp, $sp, -24 | |
24 and $sp, $sp, STORE_MASK | |
25 sw $ra, 20($sp) | |
26 lui $a0, %hi(timebuf) | |
27 | |
28 addiu $a0, $a0, %lo(timebuf) | |
29 addu $a1, $zero, $zero | |
30 lui $ra, %hi(bad) | |
31 addiu $ra, $ra, %lo(bad) | |
32 | |
33 lui $a2, %hi(GETTIMEOFDAY_ADDR) | |
34 addiu $a2, $a2, %lo(GETTIMEOFDAY_ADDR) | |
35 and $a2, $a2, JUMP_MASK | |
36 jr $a2 | |
37 | |
38 nop | |
Mark Seaborn
2013/03/12 21:55:24
FWIW, adding in ".p2align 4" as well makes this mo
| |
39 nop | |
40 nop | |
41 nop | |
42 | |
43 /* Expected return address */ | |
44 b done | |
45 nop | |
46 /* | |
47 * We don't expect the syscall to return to the following unaligned | |
48 * address or to align up to the bundle boundary after it. | |
49 */ | |
50 bad: | |
51 BREAK_INST /* Abort */ | |
52 BREAK_INST | |
53 | |
54 BREAK_INST | |
55 BREAK_INST | |
56 BREAK_INST | |
57 BREAK_INST | |
58 | |
59 done: | |
60 ori $v0, $zero, 1 /* Indicate success */ | |
61 lw $ra, 20($sp) | |
62 addiu $sp, $sp, 24 | |
63 and $sp, $sp, STORE_MASK | |
64 | |
65 and $ra, $ra, JUMP_MASK | |
66 jr $ra | |
67 nop | |
68 | |
OLD | NEW |