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

Side by Side Diff: tests/stubout_mode/partly_invalid.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: Minor cleanup. 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
« no previous file with comments | « tests/stubout_mode/nacl.scons ('k') | tests/toolchain/eh_return.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 The Native Client Authors. All rights reserved. 2 * Copyright (c) 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 be
4 * be found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 void unfixed_code(void); 9 void unfixed_code(void);
10 10
11 #if defined(__i386__) || defined(__x86_64__) 11 #if defined(__i386__) || defined(__x86_64__)
12 __asm__("unfixed_code: ret\n"); 12 __asm__("unfixed_code: ret\n");
13 #elif defined(__mips__)
14 /*
15 * We need to mark unfixed_code as global, otherwise linker can not resolve pic
16 * CALL16 relocation against local symbol unfixed_code.
17 */
18 __asm__(".global unfixed_code\n"
19 "unfixed_code: jr $ra\n"
20 "nop\n");
13 #else 21 #else
14 # error "Unsupported architecture" 22 # error "Unsupported architecture"
15 #endif 23 #endif
16 24
17 /* Test a large number of validator errors. This is a regression test 25 /* Test a large number of validator errors. This is a regression test
18 for a bug in which the validator would only stub out the first 100 26 for a bug in which the validator would only stub out the first 100
19 bad instructions. 27 bad instructions.
20 See http://code.google.com/p/nativeclient/issues/detail?id=1194. 28 See http://code.google.com/p/nativeclient/issues/detail?id=1194.
21 The assembler does not provide an obvious repeat/loop construct, so 29 The assembler does not provide an obvious repeat/loop construct, so
22 we use ".fill" with a numeric value to generate an instruction many 30 we use ".fill" with a numeric value to generate an instruction many
23 times. */ 31 times. */
24 #if defined(__i386__) 32 #if defined(__i386__)
25 __asm__(".p2align 5\n" 33 __asm__(".p2align 5\n"
26 /* "cd 80" disassembles to "int $0x80". */ 34 /* "cd 80" disassembles to "int $0x80". */
27 ".fill 1000, 2, 0x80cd\n" 35 ".fill 1000, 2, 0x80cd\n"
28 ".p2align 5\n"); 36 ".p2align 5\n");
29 #elif defined(__x86_64__) 37 #elif defined(__x86_64__)
30 __asm__(".p2align 5\n" 38 __asm__(".p2align 5\n"
31 /* "0f 05" disassembles to "syscall". */ 39 /* "0f 05" disassembles to "syscall". */
32 ".fill 1000, 2, 0x050f\n" 40 ".fill 1000, 2, 0x050f\n"
33 ".p2align 5\n"); 41 ".p2align 5\n");
42 #elif defined(__mips__)
43 __asm__(".p2align 4\n"
44 /* "0xc" disassembles to "syscall". */
45 ".fill 1000, 4, 0x0000000c\n"
46 ".p2align 4\n");
34 #else 47 #else
35 # error "Unsupported architecture" 48 # error "Unsupported architecture"
36 #endif 49 #endif
37 50
38 int main(void) { 51 int main(void) {
39 printf("Before non-validating instruction\n"); 52 printf("Before non-validating instruction\n");
40 fflush(stdout); 53 fflush(stdout);
41 unfixed_code(); 54 unfixed_code();
42 printf("After non-validating instruction\n"); 55 printf("After non-validating instruction\n");
43 return 0; 56 return 0;
44 } 57 }
OLDNEW
« no previous file with comments | « tests/stubout_mode/nacl.scons ('k') | tests/toolchain/eh_return.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698