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 <errno.h> | 8 #include <errno.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <setjmp.h> | 10 #include <setjmp.h> |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 /* | 56 /* |
| 57 * We do this check in a separate function in an attempt to prevent | 57 * We do this check in a separate function in an attempt to prevent |
| 58 * the compiler from optimising away the check for a stack-allocated | 58 * the compiler from optimising away the check for a stack-allocated |
| 59 * variable. | 59 * variable. |
| 60 * | 60 * |
| 61 * We test for an alignment that is small enough for the compiler to | 61 * We test for an alignment that is small enough for the compiler to |
| 62 * assume on x86-32, even if sel_ldr sets up a larger alignment. | 62 * assume on x86-32, even if sel_ldr sets up a larger alignment. |
| 63 */ | 63 */ |
| 64 __attribute__((noinline)) | 64 __attribute__((noinline)) |
| 65 void check_pointer_is_aligned(void *pointer) { | 65 void check_pointer_is_aligned(void *pointer) { |
| 66 #if defined(__mips__) | |
| 67 assert((uintptr_t) pointer % 8 == 0); | |
|
Mark Seaborn
2013/02/13 22:14:09
But we declared it with __attribute__((aligned(16)
petarj
2013/03/05 17:50:04
attribute aligned does not work for variables on s
Mark Seaborn
2013/03/14 15:48:00
Answering your earlier question...
On 2013/03/05
| |
| 68 #else | |
| 66 assert((uintptr_t) pointer % 16 == 0); | 69 assert((uintptr_t) pointer % 16 == 0); |
| 70 #endif | |
| 67 } | 71 } |
| 68 | 72 |
| 69 void check_stack_is_aligned(void) { | 73 void check_stack_is_aligned(void) { |
| 70 struct AlignedType var; | 74 struct AlignedType var; |
| 71 check_pointer_is_aligned(&var); | 75 check_pointer_is_aligned(&var); |
| 72 } | 76 } |
| 73 | 77 |
| 74 | 78 |
| 75 void crash_at_known_address(void); | 79 void crash_at_known_address(void); |
| 76 extern char prog_ctr_at_crash[]; | 80 extern char prog_ctr_at_crash[]; |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 RUN_TEST(test_unsetting_x86_direction_flag); | 349 RUN_TEST(test_unsetting_x86_direction_flag); |
| 346 #endif | 350 #endif |
| 347 | 351 |
| 348 fprintf(stderr, "** intended_exit_status=0\n"); | 352 fprintf(stderr, "** intended_exit_status=0\n"); |
| 349 return 0; | 353 return 0; |
| 350 } | 354 } |
| 351 | 355 |
| 352 int main(void) { | 356 int main(void) { |
| 353 return RunTests(TestMain); | 357 return RunTests(TestMain); |
| 354 } | 358 } |
| OLD | NEW |