OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Implementation of PreamblePatcher | 5 // Implementation of PreamblePatcher |
6 | 6 |
7 #include "sandbox/win/src/sidestep/preamble_patcher.h" | 7 #include "sandbox/win/src/sidestep/preamble_patcher.h" |
8 | 8 |
9 #include <stddef.h> | |
10 | |
11 #include "sandbox/win/src/sandbox_nt_util.h" | 9 #include "sandbox/win/src/sandbox_nt_util.h" |
12 #include "sandbox/win/src/sidestep/mini_disassembler.h" | 10 #include "sandbox/win/src/sidestep/mini_disassembler.h" |
13 | 11 |
14 // Definitions of assembly statements we need | 12 // Definitions of assembly statements we need |
15 #define ASM_JMP32REL 0xE9 | 13 #define ASM_JMP32REL 0xE9 |
16 #define ASM_INT3 0xCC | 14 #define ASM_INT3 0xCC |
17 | 15 |
18 namespace { | 16 namespace { |
19 | 17 |
20 // Very basic memcpy. We are copying 4 to 12 bytes most of the time, so there | 18 // Very basic memcpy. We are copying 4 to 12 bytes most of the time, so there |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // stub contains the first stub_size bytes of the original target | 170 // stub contains the first stub_size bytes of the original target |
173 // function's preamble code, followed by a relative jump back to the next | 171 // function's preamble code, followed by a relative jump back to the next |
174 // instruction after the first cbPreamble bytes. | 172 // instruction after the first cbPreamble bytes. |
175 | 173 |
176 return SIDESTEP_SUCCESS; | 174 return SIDESTEP_SUCCESS; |
177 } | 175 } |
178 | 176 |
179 }; // namespace sidestep | 177 }; // namespace sidestep |
180 | 178 |
181 #undef ASSERT | 179 #undef ASSERT |
OLD | NEW |