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

Side by Side Diff: tests/barebones/top_of_sandbox.c

Issue 12256018: [MIPS] Add remaining parts for building tests for MIPS (Closed) Base URL: http://src.chromium.org/native_client/trunk/src/native_client/
Patch Set: Update per codereview. 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 unified diff | Download patch
OLDNEW
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, -32767(%0)\n"
Mark Seaborn 2013/03/11 15:54:38 Can you write -0x7fff instead for readability? Sa
petarj 2013/03/14 01:13:03 Done.
37 : "=r" (scratch) : "0" (sp + 32767));
30 #endif 38 #endif
31 NACL_SYSCALL(exit)(0); 39 NACL_SYSCALL(exit)(0);
32 } 40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698