 Chromium Code Reviews
 Chromium Code Reviews Issue 616813002:
  Non-SFI Mode: Enable compiling exception_test for x86-32.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
    
  
    Issue 616813002:
  Non-SFI Mode: Enable compiling exception_test for x86-32.  (Closed) 
  Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master| Index: tests/exception_test/exception_test.c | 
| diff --git a/tests/exception_test/exception_test.c b/tests/exception_test/exception_test.c | 
| index b00d3a40a7e51a235b88777619ec269947818276..618ddd560aa8825a2a1b74607cdcb3f53f2d496f 100644 | 
| --- a/tests/exception_test/exception_test.c | 
| +++ b/tests/exception_test/exception_test.c | 
| @@ -182,8 +182,16 @@ void exception_handler_wrapped(struct NaClSignalContext *entry_regs) { | 
| assert(frame_base % STACK_ALIGNMENT == 0); | 
| char *frame_top = (char *) (frame_base + kArgSizeOnStack + | 
| sizeof(struct CombinedContext)); | 
| - /* Check that no more than the stack alignment size is wasted. */ | 
| - assert(stack_top - STACK_ALIGNMENT < frame_top); | 
| + if (NONSFI_MODE) { | 
| 
Mark Seaborn
2014/09/30 20:32:29
As with the previous change, can you only do chang
 
Junichi Uekawa
2014/10/01 04:17:13
Done.
 | 
| + /* | 
| + * Non-SFI mode exception stack will have ucontext_t and | 
| + * siginfo_t, which would be anywhere from 400 bytes to 1.5k | 
| + */ | 
| + assert(stack_top - 1500 < frame_top); | 
| + } else { | 
| + /* Check that no more than the stack alignment size is wasted. */ | 
| + assert(stack_top - STACK_ALIGNMENT < frame_top); | 
| + } | 
| assert(frame_top <= stack_top); | 
| #if defined(__x86_64__) | 
| @@ -200,12 +208,15 @@ void test_exception_stack_with_size(char *stack, size_t stack_size) { | 
| printf("failed to set exception handler\n"); | 
| exit(4); | 
| } | 
| +#if !NONSFI_MODE | 
| + /* TODO(uekawa): Implement set_stack for Non-SFI mode. */ | 
| if (0 != nacl_exception_set_stack(stack, stack_size)) { | 
| printf("failed to set alt stack\n"); | 
| exit(5); | 
| } | 
| g_registered_stack = stack; | 
| g_registered_stack_size = stack_size; | 
| +#endif | 
| char crash_stack[0x1000]; | 
| RegsFillTestValues(&g_regs_at_crash, /* seed= */ 0); | 
| @@ -396,9 +407,14 @@ void run_test(const char *test_name, void (*test_func)(void)) { | 
| int TestMain(void) { | 
| RUN_TEST(test_exceptions_minimally); | 
| - RUN_TEST(test_exception_stack_alignments); | 
| - RUN_TEST(test_getting_previous_handler); | 
| - RUN_TEST(test_invalid_handlers); | 
| + if (!NONSFI_MODE) { | 
| + /* TODO(uekawa): Implement set_stack for Non-SFI mode. */ | 
| + RUN_TEST(test_exception_stack_alignments); | 
| + /* NACL_SYSCALL not supported on nonsfi mode */ | 
| + RUN_TEST(test_getting_previous_handler); | 
| + /* Those handlers are not invalid in NonSFI NaCl. */ | 
| + RUN_TEST(test_invalid_handlers); | 
| + } | 
| /* pthread_join() is broken under qemu-arm. */ | 
| if (getenv("UNDER_QEMU_ARM") == NULL) | 
| RUN_TEST(test_exceptions_on_non_main_thread); |