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 <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <limits.h> | 10 #include <limits.h> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 "nonsfi_loader with host libc\n"); | 74 "nonsfi_loader with host libc\n"); |
| 75 return; | 75 return; |
| 76 } | 76 } |
| 77 | 77 |
| 78 int rc = nacl_exception_set_handler(exception_handler); | 78 int rc = nacl_exception_set_handler(exception_handler); |
| 79 assert(rc == 0); | 79 assert(rc == 0); |
| 80 if (!setjmp(g_jmp_buf)) { | 80 if (!setjmp(g_jmp_buf)) { |
| 81 char value = *addr; | 81 char value = *addr; |
| 82 /* If we reach here, the assertion failed. */ | 82 /* If we reach here, the assertion failed. */ |
| 83 fprintf(stderr, "Address %p was readable, and contained %i\n", | 83 fprintf(stderr, "Address %p was readable, and contained %i\n", |
| 84 addr, value); | 84 static_cast<void *>(addr), value); |
|
Derek Schuff
2015/05/20 22:03:44
so, you can't cast away volatile like this with an
khimg
2015/05/20 22:16:18
Ugh. uintptr_t would properly require not %x but %
Derek Schuff
2015/05/22 16:38:49
agreed; switched to c-style casts with comment.
| |
| 85 exit(1); | 85 exit(1); |
| 86 } | 86 } |
| 87 /* | 87 /* |
| 88 * Clean up: Unregister the exception handler so that we do not | 88 * Clean up: Unregister the exception handler so that we do not |
| 89 * accidentally return through g_jmp_buf if an exception occurs. | 89 * accidentally return through g_jmp_buf if an exception occurs. |
| 90 */ | 90 */ |
| 91 rc = nacl_exception_set_handler(NULL); | 91 rc = nacl_exception_set_handler(NULL); |
| 92 assert(rc == 0); | 92 assert(rc == 0); |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 114 "nonsfi_loader with host libc\n"); | 114 "nonsfi_loader with host libc\n"); |
| 115 return; | 115 return; |
| 116 } | 116 } |
| 117 | 117 |
| 118 int rc = nacl_exception_set_handler(exception_handler); | 118 int rc = nacl_exception_set_handler(exception_handler); |
| 119 assert(rc == 0); | 119 assert(rc == 0); |
| 120 if (!setjmp(g_jmp_buf)) { | 120 if (!setjmp(g_jmp_buf)) { |
| 121 *addr = value; | 121 *addr = value; |
| 122 /* If we reach here, the assertion failed. */ | 122 /* If we reach here, the assertion failed. */ |
| 123 fprintf(stderr, "Address %p was writable, %i was written\n", | 123 fprintf(stderr, "Address %p was writable, %i was written\n", |
| 124 addr, value); | 124 static_cast<void *>(addr), value); |
| 125 exit(1); | 125 exit(1); |
| 126 } | 126 } |
| 127 /* | 127 /* |
| 128 * Clean up: Unregister the exception handler so that we do not | 128 * Clean up: Unregister the exception handler so that we do not |
| 129 * accidentally return through g_jmp_buf if an exception occurs. | 129 * accidentally return through g_jmp_buf if an exception occurs. |
| 130 */ | 130 */ |
| 131 rc = nacl_exception_set_handler(NULL); | 131 rc = nacl_exception_set_handler(NULL); |
| 132 assert(rc == 0); | 132 assert(rc == 0); |
| 133 } | 133 } |
| 134 | 134 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 // run the full test suite | 634 // run the full test suite |
| 635 passed = testSuite(); | 635 passed = testSuite(); |
| 636 | 636 |
| 637 if (passed) { | 637 if (passed) { |
| 638 printf("All tests PASSED\n"); | 638 printf("All tests PASSED\n"); |
| 639 exit(0); | 639 exit(0); |
| 640 } | 640 } |
| 641 printf("One or more tests FAILED\n"); | 641 printf("One or more tests FAILED\n"); |
| 642 exit(-1); | 642 exit(-1); |
| 643 } | 643 } |
| OLD | NEW |