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

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: Minor change. 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 <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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 78
79 #elif NACL_ARCH(NACL_BUILD_ARCH) == NACL_mips
80
81 char recovery_stack[0x1000] __attribute__((aligned(8)));
82
83 void bad_stack_exception_handler(struct NaClExceptionContext *context);
84 __asm__(".pushsection .text, \"ax\", @progbits\n"
85 "bad_stack_exception_handler:\n"
86 "lui $t9, %hi(recovery_stack)\n"
87 "addiu $sp, $t9, %lo(recovery_stack)\n"
88 "and $sp, $sp, $t7\n"
89 "j error_exit\n"
90 "nop\n"
91 ".popsection\n");
92
93 void error_exit() {
94 _exit(1);
95 }
96
79 #else 97 #else
80 98
81 /* TODO(mseaborn): Implement a stack switcher, like the one above, for ARM. */ 99 /* TODO(mseaborn): Implement a stack switcher, like the one above, for ARM. */
82 void bad_stack_exception_handler(struct NaClExceptionContext *context) { 100 void bad_stack_exception_handler(struct NaClExceptionContext *context) {
83 _exit(1); 101 _exit(1);
84 } 102 }
85 103
86 #endif 104 #endif
87 105
88 106
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 TRY_TEST(test_bad_handler); 239 TRY_TEST(test_bad_handler);
222 TRY_TEST(test_stack_outside_sandbox); 240 TRY_TEST(test_stack_outside_sandbox);
223 TRY_TEST(test_stack_in_rwdata); 241 TRY_TEST(test_stack_in_rwdata);
224 TRY_TEST(test_stack_in_rodata); 242 TRY_TEST(test_stack_in_rodata);
225 TRY_TEST(test_stack_in_code); 243 TRY_TEST(test_stack_in_code);
226 TRY_TEST(test_crash_in_syscall); 244 TRY_TEST(test_crash_in_syscall);
227 245
228 fprintf(stderr, "Error: Unknown test: \"%s\"\n", argv[1]); 246 fprintf(stderr, "Error: Unknown test: \"%s\"\n", argv[1]);
229 return 1; 247 return 1;
230 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698