| 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 <alloca.h> | 7 #include <alloca.h> |
| 8 #include <assert.h> | 8 #include <assert.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 int local_var = 2 * arg; | 99 int local_var = 2 * arg; |
| 100 global_var += local_var + arg; | 100 global_var += local_var + arg; |
| 101 } | 101 } |
| 102 | 102 |
| 103 void mmap_breakpoint(void) { | 103 void mmap_breakpoint(void) { |
| 104 global_var = 0; | 104 global_var = 0; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ret_sequence(void) { | 107 void ret_sequence(void) { |
| 108 #if defined(__i386__) | 108 #if defined(__i386__) |
| 109 asm( | 109 __asm__( |
| 110 ".globl ret_start\n" | 110 ".globl ret_start\n" |
| 111 ".globl ret_end\n" | 111 ".globl ret_end\n" |
| 112 ".align 32\n" | 112 ".align 32\n" |
| 113 "ret_start:\n" | 113 "ret_start:\n" |
| 114 "naclret\n" | 114 "naclret\n" |
| 115 "ret_end:\n"); | 115 "ret_end:\n"); |
| 116 #elif defined(__x86_64__) | 116 #elif defined(__x86_64__) |
| 117 asm( | 117 __asm__( |
| 118 ".globl ret_start\n" | 118 ".globl ret_start\n" |
| 119 ".globl ret_end\n" | 119 ".globl ret_end\n" |
| 120 ".align 32\n" | 120 ".align 32\n" |
| 121 "ret_start:\n" | 121 "ret_start:\n" |
| 122 "naclret\n" | 122 "naclret\n" |
| 123 "ret_end:\n"); | 123 "ret_end:\n"); |
| 124 #endif | 124 #endif |
| 125 } | 125 } |
| 126 | 126 |
| 127 typedef void (*func_t)(void); | 127 typedef void (*func_t)(void); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 } | 292 } |
| 293 if (strcmp(test_command, "invalid_memory") == 0) { | 293 if (strcmp(test_command, "invalid_memory") == 0) { |
| 294 return 0; | 294 return 0; |
| 295 } | 295 } |
| 296 if (strcmp(test_command, "mmap") == 0) { | 296 if (strcmp(test_command, "mmap") == 0) { |
| 297 test_mmap(); | 297 test_mmap(); |
| 298 return 0; | 298 return 0; |
| 299 } | 299 } |
| 300 return 1; | 300 return 1; |
| 301 } | 301 } |
| OLD | NEW |