| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/include/arm_sandbox.h" |
| 8 |
| 7 /* | 9 /* |
| 8 * assume 32-byte trampoline slots, 16-byte bundles. | 10 * assume 32-byte trampoline slots, 16-byte bundles. |
| 9 */ | 11 */ |
| 10 #define GETTIMEOFDAY_ADDR 0x10500 | 12 #define GETTIMEOFDAY_ADDR 0x10500 |
| 11 | 13 |
| 12 .data | 14 .data |
| 13 timebuf: | 15 timebuf: |
| 14 .space 0x200 /* enough for a timeval */ | 16 .space 0x200 /* enough for a timeval */ |
| 15 | 17 |
| 16 .text | 18 .text |
| 17 .globl SyscallReturnIsSandboxed | 19 .globl SyscallReturnIsSandboxed |
| 18 SyscallReturnIsSandboxed: | 20 SyscallReturnIsSandboxed: |
| 19 nop | 21 nop |
| 20 push {lr} | 22 push {lr} |
| 21 ldr r0, addrOfTimeBuf | 23 ldr r0, addrOfTimeBuf |
| 22 mov r1, #0 | 24 mov r1, #0 |
| 23 | 25 |
| 24 adr lr, bad | 26 adr lr, bad |
| 25 ldr r2, addrOfGetTimeOfDaySyscallAddr | 27 ldr r2, addrOfGetTimeOfDaySyscallAddr |
| 26 bic r2, r2, #0xf000000f | 28 bic r2, r2, #0xf000000f |
| 27 bx r2 | 29 bx r2 |
| 28 | 30 |
| 29 eor r0, r0, #1 | 31 eor r0, r0, #1 |
| 30 bad: pop {lr} | 32 bad: pop {lr} |
| 31 bic lr, lr, #0xf000000f | 33 bic lr, lr, #0xf000000f |
| 32 bx lr | 34 bx lr |
| 33 | 35 |
| 34 | 36 |
| 35 bkpt 0x7777 | 37 .word NACL_INSTR_LITERAL_POOL_HEAD |
| 36 /* | 38 /* |
| 37 * Put a disallowed instruction here to ensure that the bkpt | 39 * Put a disallowed instruction here to ensure that the bkpt |
| 38 * data bundle marker works. If the marker does not work, then | 40 * data bundle marker works. If the marker does not work, then |
| 39 * whether this code passes the validator is a matter of chance. | 41 * whether this code passes the validator is a matter of chance. |
| 40 */ | 42 */ |
| 41 mov pc, r0 | 43 mov pc, r0 |
| 42 addrOfGetTimeOfDaySyscallAddr: | 44 addrOfGetTimeOfDaySyscallAddr: |
| 43 .word GETTIMEOFDAY_ADDR | 45 .word GETTIMEOFDAY_ADDR |
| 44 addrOfTimeBuf: | 46 addrOfTimeBuf: |
| 45 .word timebuf | 47 .word timebuf |
| OLD | NEW |