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 <pthread.h> | 7 #include <pthread.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 15 matching lines...) Expand all Loading... |
26 * top-level assembly. | 26 * top-level assembly. |
27 */ | 27 */ |
28 #if defined(__i386__) || defined(__x86_64__) | 28 #if defined(__i386__) || defined(__x86_64__) |
29 __asm__(".pushsection .text, \"ax\", @progbits\n" | 29 __asm__(".pushsection .text, \"ax\", @progbits\n" |
30 "fault_addr:\n" | 30 "fault_addr:\n" |
31 "hlt\n" | 31 "hlt\n" |
32 ".popsection\n"); | 32 ".popsection\n"); |
33 #elif defined(__arm__) | 33 #elif defined(__arm__) |
34 __asm__(".pushsection .text, \"ax\", %progbits\n" | 34 __asm__(".pushsection .text, \"ax\", %progbits\n" |
35 "fault_addr:\n" | 35 "fault_addr:\n" |
36 "bkpt 0x7777\n" | 36 "udf 0xede0\n" |
37 ".popsection\n"); | 37 ".popsection\n"); |
38 #else | 38 #else |
39 # error Update fault_addr for other architectures | 39 # error Update fault_addr for other architectures |
40 #endif | 40 #endif |
41 | 41 |
42 void set_registers_and_stop() { | 42 void set_registers_and_stop() { |
43 struct NaClSignalContext regs; | 43 struct NaClSignalContext regs; |
44 memset(®s, 0, sizeof(regs)); | 44 memset(®s, 0, sizeof(regs)); |
45 | 45 |
46 /* | 46 /* |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 /* We avoid using int3 because of a Mac OS X kernel bug. */ | 180 /* We avoid using int3 because of a Mac OS X kernel bug. */ |
181 __asm__("hlt"); | 181 __asm__("hlt"); |
182 #elif defined(__arm__) | 182 #elif defined(__arm__) |
183 /* | 183 /* |
184 * Arrange the breakpoint so that the test can skip over it by | 184 * Arrange the breakpoint so that the test can skip over it by |
185 * jumping to the next bundle. This means we never have to set the | 185 * jumping to the next bundle. This means we never have to set the |
186 * program counter to within a bundle, which could be unsafe, | 186 * program counter to within a bundle, which could be unsafe, |
187 * because BKPTs guard data literals in the ARM sandbox. | 187 * because BKPTs guard data literals in the ARM sandbox. |
188 */ | 188 */ |
189 __asm__(".p2align 4\n" | 189 __asm__(".p2align 4\n" |
190 "bkpt 0x7777\n" | 190 "bkpt 0x5bef\n" |
191 ".p2align 4\n"); | 191 ".p2align 4\n"); |
192 #else | 192 #else |
193 # error Unsupported architecture | 193 # error Unsupported architecture |
194 #endif | 194 #endif |
195 } | 195 } |
196 | 196 |
197 void *child_thread_func(void *thread_arg) { | 197 void *child_thread_func(void *thread_arg) { |
198 for (;;) { | 198 for (;;) { |
199 g_child_thread_var++; | 199 g_child_thread_var++; |
200 breakpoint(); | 200 breakpoint(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 if (strcmp(argv[1], "test_interrupt") == 0) { | 244 if (strcmp(argv[1], "test_interrupt") == 0) { |
245 test_interrupt(); | 245 test_interrupt(); |
246 return 0; | 246 return 0; |
247 } | 247 } |
248 if (strcmp(argv[1], "test_suspending_threads") == 0) { | 248 if (strcmp(argv[1], "test_suspending_threads") == 0) { |
249 test_suspending_threads(); | 249 test_suspending_threads(); |
250 return 0; | 250 return 0; |
251 } | 251 } |
252 return 1; | 252 return 1; |
253 } | 253 } |
OLD | NEW |