| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2011 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 .global template_func | 7 .global template_func |
| 8 .global template_func_end | 8 .global template_func_end |
| 9 template_func: | 9 template_func: |
| 10 #if defined(__i386__) | 10 #if defined(__i386__) |
| 11 movl $1234, %eax | 11 movl $1234, %eax |
| 12 popl %ecx | 12 popl %ecx |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 * and target address outside | 58 * and target address outside |
| 59 * modified section */ | 59 * modified section */ |
| 60 test $0xffffffff,%r11d | 60 test $0xffffffff,%r11d |
| 61 movq $4321, %rax /* replaces constant */ | 61 movq $4321, %rax /* replaces constant */ |
| 62 #else | 62 #else |
| 63 # error "Unsupported architecture" | 63 # error "Unsupported architecture" |
| 64 #endif | 64 #endif |
| 65 template_func_replacement_end: | 65 template_func_replacement_end: |
| 66 | 66 |
| 67 | 67 |
| 68 #if defined(__i386__) |
| 69 .global jump_into_super_inst_original |
| 70 .global jump_into_super_inst_original_end |
| 71 .p2align 5 |
| 72 jump_into_super_inst_original: |
| 73 jump_is_ok: |
| 74 and $0xffffffe0,%ecx |
| 75 jmp *%ecx |
| 76 call jump_is_ok |
| 77 jump_into_super_inst_original_end: |
| 78 |
| 79 |
| 80 /* This should not validate, so keep it as data. */ |
| 81 .data |
| 82 .global jump_into_super_inst_modified |
| 83 .global jump_into_super_inst_modified_end |
| 84 .p2align 5 |
| 85 jump_into_super_inst_modified: |
| 86 and $0xffffffe0,%ecx |
| 87 jump_is_awful: |
| 88 jmp *%ecx |
| 89 call jump_is_awful |
| 90 jump_into_super_inst_modified_end: |
| 91 .text |
| 92 #endif |
| 93 |
| 94 |
| 95 #if defined(__x86_64__) |
| 96 .global jump_into_super_inst_original |
| 97 .global jump_into_super_inst_original_end |
| 98 .p2align 5 |
| 99 jump_into_super_inst_original: |
| 100 jump_is_ok: |
| 101 andl $0xffffffe0,%r11d |
| 102 addq %r15,%r11 |
| 103 jmpq *%r11 |
| 104 call jump_is_ok |
| 105 jump_into_super_inst_original_end: |
| 106 |
| 107 |
| 108 /* This should not validate, so keep it as data. */ |
| 109 .data |
| 110 .global jump_into_super_inst_modified |
| 111 .global jump_into_super_inst_modified_end |
| 112 .p2align 5 |
| 113 jump_into_super_inst_modified: |
| 114 andl $0xffffffe0,%r11d |
| 115 addq %r15,%r11 |
| 116 jump_is_awful: |
| 117 jmpq *%r11 |
| 118 call jump_is_awful |
| 119 jump_into_super_inst_modified_end: |
| 120 .text |
| 121 #endif |
| 122 |
| 123 |
| 68 .global template_func_nonreplacement | 124 .global template_func_nonreplacement |
| 69 .global template_func_nonreplacement_end | 125 .global template_func_nonreplacement_end |
| 70 .global template_func_misaligned_replacement | 126 .global template_func_misaligned_replacement |
| 71 .global template_func_misaligned_replacement_end | 127 .global template_func_misaligned_replacement_end |
| 72 .p2align 5 | 128 .p2align 5 |
| 73 template_func_nonreplacement: | 129 template_func_nonreplacement: |
| 74 template_func_misaligned_replacement: | 130 template_func_misaligned_replacement: |
| 75 #if defined(__i386__) | 131 #if defined(__i386__) |
| 76 nop /* nop creates misalignment in | 132 nop /* nop creates misalignment in |
| 77 * replacing section which makes | 133 * replacing section which makes |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 .global template_instr_end | 364 .global template_instr_end |
| 309 .global template_instr_replace | 365 .global template_instr_replace |
| 310 .global template_instr_replace_end | 366 .global template_instr_replace_end |
| 311 template_instr: | 367 template_instr: |
| 312 mov $0,%eax | 368 mov $0,%eax |
| 313 template_instr_end: | 369 template_instr_end: |
| 314 template_instr_replace: | 370 template_instr_replace: |
| 315 mov $0x11111111,%eax | 371 mov $0x11111111,%eax |
| 316 template_instr_replace_end: | 372 template_instr_replace_end: |
| 317 | 373 |
| OLD | NEW |