OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 #include "native_client/tests/barebones/barebones.h" | 7 #include "native_client/tests/barebones/barebones.h" |
8 | 8 |
9 /* | 9 /* |
10 * This is a test for the issue described in: | 10 * This is a test for the issue described in: |
11 * http://code.google.com/p/nativeclient/issues/detail?id=2909 | 11 * http://code.google.com/p/nativeclient/issues/detail?id=2909 |
12 */ | 12 */ |
13 | 13 |
14 void _start(unsigned int info[]) { | 14 void _start(unsigned int info[]) { |
15 #if defined(__arm__) | 15 #if defined(__arm__) |
16 char *sp, *scratch; | 16 char *sp, *scratch; |
17 __asm__("mov %0, sp" : "=r" (sp)); | 17 __asm__("mov %0, sp" : "=r" (sp)); |
18 __asm__ volatile( | 18 __asm__ volatile( |
19 ".p2align 4\n" | 19 ".p2align 4\n" |
20 "bic %0, %0, #0xc0000000\n" | 20 "bic %0, %0, #0xc0000000\n" |
21 "ldr %0, [%0, #-4095]\n" | 21 "ldr %0, [%0, #-4095]\n" |
22 : "=r" (scratch) : "0" (sp + 4095)); | 22 : "=r" (scratch) : "0" (sp + 4095)); |
23 #elif defined(__x86_64__) | 23 #elif defined(__x86_64__) |
24 unsigned long long scratch; | 24 unsigned long long scratch; |
25 __asm__ volatile( | 25 __asm__ volatile( |
26 ".p2align 5\n" | 26 ".p2align 5\n" |
27 "leal 4095(%%rsp), %k0\n" | 27 "leal 4095(%%rsp), %k0\n" |
28 "movl -4095(%%r15,%0), %k0" | 28 "movl -4095(%%r15,%0), %k0" |
29 : "=r" (scratch)); | 29 : "=r" (scratch)); |
| 30 #elif defined(__mips__) |
| 31 char *sp, *scratch; |
| 32 __asm__("move %0, $sp" : "=r" (sp)); |
| 33 __asm__ volatile( |
| 34 ".p2align 4\n" |
| 35 "and %0, %0, $t7\n" |
| 36 "lw %0, -0x7fff(%0)\n" |
| 37 : "=r" (scratch) : "0" (sp + 0x7fff)); |
30 #endif | 38 #endif |
31 NACL_SYSCALL(exit)(0); | 39 NACL_SYSCALL(exit)(0); |
32 } | 40 } |
OLD | NEW |