Chromium Code Reviews| 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 <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 Loading... | |
| 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 | |
|
Mark Seaborn
2013/03/11 15:54:38
Add empty line before for consistent spacing
petarj
2013/03/14 01:13:03
Done.
| |
| 78 | 79 |
| 80 char recovery_stack[0x1000] __attribute__((aligned(8))); | |
| 81 | |
| 82 void bad_stack_exception_handler(struct NaClExceptionContext *context); | |
| 83 __asm__(".pushsection .text, \"ax\", @progbits\n" | |
| 84 "bad_stack_exception_handler:\n" | |
| 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 ".popsection\n"); | |
| 91 | |
| 92 void error_exit() { | |
| 93 _exit(1); | |
|
Mark Seaborn
2013/03/11 15:54:38
Add empty line after for consistent spacing
petarj
2013/03/14 01:13:03
Done.
| |
| 94 } | |
| 79 #else | 95 #else |
| 80 | 96 |
| 81 /* TODO(mseaborn): Implement a stack switcher, like the one above, for ARM. */ | 97 /* TODO(mseaborn): Implement a stack switcher, like the one above, for ARM. */ |
| 82 void bad_stack_exception_handler(struct NaClExceptionContext *context) { | 98 void bad_stack_exception_handler(struct NaClExceptionContext *context) { |
| 83 _exit(1); | 99 _exit(1); |
| 84 } | 100 } |
| 85 | 101 |
| 86 #endif | 102 #endif |
| 87 | 103 |
| 88 | 104 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 TRY_TEST(test_bad_handler); | 237 TRY_TEST(test_bad_handler); |
| 222 TRY_TEST(test_stack_outside_sandbox); | 238 TRY_TEST(test_stack_outside_sandbox); |
| 223 TRY_TEST(test_stack_in_rwdata); | 239 TRY_TEST(test_stack_in_rwdata); |
| 224 TRY_TEST(test_stack_in_rodata); | 240 TRY_TEST(test_stack_in_rodata); |
| 225 TRY_TEST(test_stack_in_code); | 241 TRY_TEST(test_stack_in_code); |
| 226 TRY_TEST(test_crash_in_syscall); | 242 TRY_TEST(test_crash_in_syscall); |
| 227 | 243 |
| 228 fprintf(stderr, "Error: Unknown test: \"%s\"\n", argv[1]); | 244 fprintf(stderr, "Error: Unknown test: \"%s\"\n", argv[1]); |
| 229 return 1; | 245 return 1; |
| 230 } | 246 } |
| OLD | NEW |