| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 pushl %ebp | 32 pushl %ebp |
| 33 .cfi_def_cfa_offset 8 | 33 .cfi_def_cfa_offset 8 |
| 34 .cfi_offset %ebp, -8 | 34 .cfi_offset %ebp, -8 |
| 35 movl %esp, %ebp | 35 movl %esp, %ebp |
| 36 .cfi_def_cfa_register %ebp | 36 .cfi_def_cfa_register %ebp |
| 37 | 37 |
| 38 // Note that 16-byte stack alignment is not maintained because this function | 38 // Note that 16-byte stack alignment is not maintained because this function |
| 39 // does not call out to any other. | 39 // does not call out to any other. |
| 40 | 40 |
| 41 // pushfl first, because some instructions (but probably none used here) | 41 // pushfl first, because some instructions (but probably none used here) |
| 42 // affect %eflags. %eflags will be in -4(%rbp). | 42 // affect %eflags. %eflags will be in -4(%ebp). |
| 43 pushfl | 43 pushfl |
| 44 | 44 |
| 45 // Save the original value of %eax, and use %eax to hold the x86_thread_state* | 45 // Save the original value of %eax, and use %eax to hold the x86_thread_state* |
| 46 // argument. The original value of %eax will be in -8(%rbp). | 46 // argument. The original value of %eax will be in -8(%ebp). |
| 47 pushl %eax | 47 pushl %eax |
| 48 movl 8(%ebp), %eax | 48 movl 8(%ebp), %eax |
| 49 | 49 |
| 50 // Initialize the header identifying the x86_thread_state_t structure as | 50 // Initialize the header identifying the x86_thread_state_t structure as |
| 51 // carrying an x86_thread_state32_t (flavor x86_THREAD_STATE32) of size | 51 // carrying an x86_thread_state32_t (flavor x86_THREAD_STATE32) of size |
| 52 // x86_THREAD_STATE32_COUNT 32-bit values. | 52 // x86_THREAD_STATE32_COUNT 32-bit values. |
| 53 movl $1, (%eax) // x86_thread_state->tsh.flavor | 53 movl $1, (%eax) // x86_thread_state->tsh.flavor |
| 54 movl $16, 4(%eax) // x86_thread_state->tsh.count | 54 movl $16, 4(%eax) // x86_thread_state->tsh.count |
| 55 | 55 |
| 56 // General-purpose registers whose values haven’t changed can be captured | 56 // General-purpose registers whose values haven’t changed can be captured |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 movw %es, %dx | 100 movw %es, %dx |
| 101 movl %edx, 60(%eax) // x86_thread_state->uts.ts32.__es | 101 movl %edx, 60(%eax) // x86_thread_state->uts.ts32.__es |
| 102 movw %fs, %dx | 102 movw %fs, %dx |
| 103 movl %edx, 64(%eax) // x86_thread_state->uts.ts32.__fs | 103 movl %edx, 64(%eax) // x86_thread_state->uts.ts32.__fs |
| 104 movw %gs, %dx | 104 movw %gs, %dx |
| 105 movl %edx, 68(%eax) // x86_thread_state->uts.ts32.__gs | 105 movl %edx, 68(%eax) // x86_thread_state->uts.ts32.__gs |
| 106 | 106 |
| 107 // Clean up by restoring clobbered registers, even those considered volatile | 107 // Clean up by restoring clobbered registers, even those considered volatile |
| 108 // by the ABI, so that the captured context represents the state at this | 108 // by the ABI, so that the captured context represents the state at this |
| 109 // function’s exit. | 109 // function’s exit. |
| 110 movl 20(%eax), %edx // x86_thread_state->uts.ts32.__edx |
| 110 popl %eax | 111 popl %eax |
| 111 popfl | 112 popfl |
| 112 | 113 |
| 113 popl %ebp | 114 popl %ebp |
| 114 | 115 |
| 115 ret | 116 ret |
| 116 | 117 |
| 117 .cfi_endproc | 118 .cfi_endproc |
| 118 | 119 |
| 119 #elif defined(__x86_64__) | 120 #elif defined(__x86_64__) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 209 |
| 209 ret | 210 ret |
| 210 | 211 |
| 211 .cfi_endproc | 212 .cfi_endproc |
| 212 | 213 |
| 213 #endif | 214 #endif |
| 214 | 215 |
| 215 .subsections_via_symbols | 216 .subsections_via_symbols |
| 216 | 217 |
| 217 #endif | 218 #endif |
| OLD | NEW |