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

Side by Side Diff: tests/exception_test/exception_crash_test.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: Created 7 years, 10 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 <assert.h> 7 #include <assert.h>
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <string.h> 10 #include <string.h>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 "jmp error_exit\n" 68 "jmp error_exit\n"
69 # elif defined(__x86_64__) 69 # elif defined(__x86_64__)
70 "naclrestsp $recovery_stack - 8, %r15\n" 70 "naclrestsp $recovery_stack - 8, %r15\n"
71 "jmp error_exit\n" 71 "jmp error_exit\n"
72 # endif 72 # endif
73 ".popsection\n"); 73 ".popsection\n");
74 74
75 void error_exit(void) { 75 void error_exit(void) {
76 _exit(1); 76 _exit(1);
77 } 77 }
78 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips
78 79
80 char recovery_stack[0x1000] __attribute__((aligned(8)));
81
82 void bad_stack_exception_handler();
Mark Seaborn 2013/02/13 22:14:09 This probably fails to compile due to -Wstrict-pro
petarj 2013/03/05 17:50:04 Done.
83 __asm__("bad_stack_exception_handler:\n"
Mark Seaborn 2013/02/13 22:14:09 Nit: remove indentation
petarj 2013/03/05 17:50:04 Done.
84 ".text\n"
Mark Seaborn 2013/02/13 22:14:09 Use pushsection+popsection instead of .text
petarj 2013/03/05 17:50:04 Done.
85 "lui $t9, %hi(recovery_stack)\n"
86 "addiu $sp, $t9, %lo(recovery_stack)\n"
87 "and $sp, $sp, $t7\n"
88 "j error_exit\n"
89 "nop\n");
90
91 void error_exit() {
92 _exit(1);
93 }
79 #else 94 #else
80 95
81 /* TODO(mseaborn): Implement a stack switcher, like the one above, for ARM. */ 96 /* TODO(mseaborn): Implement a stack switcher, like the one above, for ARM. */
82 void bad_stack_exception_handler(struct NaClExceptionContext *context) { 97 void bad_stack_exception_handler(struct NaClExceptionContext *context) {
83 _exit(1); 98 _exit(1);
84 } 99 }
85 100
86 #endif 101 #endif
87 102
88 103
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 TRY_TEST(test_bad_handler); 238 TRY_TEST(test_bad_handler);
224 TRY_TEST(test_stack_outside_sandbox); 239 TRY_TEST(test_stack_outside_sandbox);
225 TRY_TEST(test_stack_in_rwdata); 240 TRY_TEST(test_stack_in_rwdata);
226 TRY_TEST(test_stack_in_rodata); 241 TRY_TEST(test_stack_in_rodata);
227 TRY_TEST(test_stack_in_code); 242 TRY_TEST(test_stack_in_code);
228 TRY_TEST(test_crash_in_syscall); 243 TRY_TEST(test_crash_in_syscall);
229 244
230 fprintf(stderr, "Error: Unknown test: \"%s\"\n", argv[1]); 245 fprintf(stderr, "Error: Unknown test: \"%s\"\n", argv[1]);
231 return 1; 246 return 1;
232 } 247 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698