OLD | NEW |
1 /* BFD support for the Intel 386 architecture. | 1 /* BFD support for the Intel 386 architecture. |
2 Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2005, | 2 Copyright 1992, 1994, 1995, 1996, 1998, 2000, 2001, 2002, 2004, 2005, |
3 2007, 2009, 2010, 2011 | 3 2007, 2009, 2010, 2011, 2013 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
(...skipping 29 matching lines...) Expand all Loading... |
43 } | 43 } |
44 | 44 |
45 /* Fill the buffer with zero or nop instruction if CODE is TRUE. Use | 45 /* Fill the buffer with zero or nop instruction if CODE is TRUE. Use |
46 multi byte nop instructions if LONG_NOP is TRUE. */ | 46 multi byte nop instructions if LONG_NOP is TRUE. */ |
47 | 47 |
48 static void * | 48 static void * |
49 bfd_arch_i386_fill (bfd_size_type count, bfd_boolean code, | 49 bfd_arch_i386_fill (bfd_size_type count, bfd_boolean code, |
50 bfd_boolean long_nop) | 50 bfd_boolean long_nop) |
51 { | 51 { |
52 /* nop */ | 52 /* nop */ |
53 static const char nop_1[] = { 0x90 };» | 53 static const char nop_1[] = { 0x90 }; |
54 /* xchg %ax,%ax */ | 54 /* xchg %ax,%ax */ |
55 static const char nop_2[] = { 0x66, 0x90 }; | 55 static const char nop_2[] = { 0x66, 0x90 }; |
56 /* nopl (%[re]ax) */ | 56 /* nopl (%[re]ax) */ |
57 static const char nop_3[] = { 0x0f, 0x1f, 0x00 }; | 57 static const char nop_3[] = { 0x0f, 0x1f, 0x00 }; |
58 /* nopl 0(%[re]ax) */ | 58 /* nopl 0(%[re]ax) */ |
59 static const char nop_4[] = { 0x0f, 0x1f, 0x40, 0x00 }; | 59 static const char nop_4[] = { 0x0f, 0x1f, 0x40, 0x00 }; |
60 /* nopl 0(%[re]ax,%[re]ax,1) */ | 60 /* nopl 0(%[re]ax,%[re]ax,1) */ |
61 static const char nop_5[] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 }; | 61 static const char nop_5[] = { 0x0f, 0x1f, 0x44, 0x00, 0x00 }; |
62 /* nopw 0(%[re]ax,%[re]ax,1) */ | 62 /* nopw 0(%[re]ax,%[re]ax,1) */ |
63 static const char nop_6[] = { 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 }; | 63 static const char nop_6[] = { 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 }; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 /* Fill the buffer with zero or long nop instruction if CODE is TRUE. */ | 112 /* Fill the buffer with zero or long nop instruction if CODE is TRUE. */ |
113 | 113 |
114 static void * | 114 static void * |
115 bfd_arch_i386_long_nop_fill (bfd_size_type count, | 115 bfd_arch_i386_long_nop_fill (bfd_size_type count, |
116 bfd_boolean is_bigendian ATTRIBUTE_UNUSED, | 116 bfd_boolean is_bigendian ATTRIBUTE_UNUSED, |
117 bfd_boolean code) | 117 bfd_boolean code) |
118 { | 118 { |
119 return bfd_arch_i386_fill (count, code, TRUE); | 119 return bfd_arch_i386_fill (count, code, TRUE); |
120 } | 120 } |
121 | 121 |
| 122 /* Fill the buffer with zero, or one-byte nop instructions if CODE is TRUE. */ |
| 123 |
| 124 static void * |
| 125 bfd_arch_i386_onebyte_nop_fill (bfd_size_type count, |
| 126 bfd_boolean is_bigendian ATTRIBUTE_UNUSED, |
| 127 bfd_boolean code) |
| 128 { |
| 129 void *fill = bfd_malloc (count); |
| 130 if (fill != NULL) |
| 131 memset (fill, code ? 0x90 : 0, count); |
| 132 return fill; |
| 133 } |
| 134 |
| 135 |
| 136 static const bfd_arch_info_type bfd_x64_32_nacl_arch = |
| 137 { |
| 138 64, /* 64 bits in a word */ |
| 139 64, /* 64 bits in an address */ |
| 140 8, /* 8 bits in a byte */ |
| 141 bfd_arch_i386, |
| 142 bfd_mach_x64_32_nacl, |
| 143 "i386", |
| 144 "i386:x64-32:nacl", |
| 145 3, |
| 146 FALSE, |
| 147 bfd_i386_compatible, |
| 148 bfd_default_scan, |
| 149 bfd_arch_i386_onebyte_nop_fill, |
| 150 NULL |
| 151 }; |
| 152 |
| 153 static const bfd_arch_info_type bfd_x86_64_nacl_arch = |
| 154 { |
| 155 64, /* 64 bits in a word */ |
| 156 64, /* 64 bits in an address */ |
| 157 8, /* 8 bits in a byte */ |
| 158 bfd_arch_i386, |
| 159 bfd_mach_x86_64_nacl, |
| 160 "i386", |
| 161 "i386:x86-64:nacl", |
| 162 3, |
| 163 FALSE, |
| 164 bfd_i386_compatible, |
| 165 bfd_default_scan, |
| 166 bfd_arch_i386_onebyte_nop_fill, |
| 167 &bfd_x64_32_nacl_arch |
| 168 }; |
| 169 |
| 170 const bfd_arch_info_type bfd_i386_nacl_arch = |
| 171 { |
| 172 32, /* 32 bits in a word */ |
| 173 32, /* 32 bits in an address */ |
| 174 8, /* 8 bits in a byte */ |
| 175 bfd_arch_i386, |
| 176 bfd_mach_i386_i386_nacl, |
| 177 "i386", |
| 178 "i386:nacl", |
| 179 3, |
| 180 TRUE, |
| 181 bfd_i386_compatible, |
| 182 bfd_default_scan, |
| 183 bfd_arch_i386_onebyte_nop_fill, |
| 184 &bfd_x86_64_nacl_arch |
| 185 }; |
| 186 |
122 static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax = | 187 static const bfd_arch_info_type bfd_x64_32_arch_intel_syntax = |
123 { | 188 { |
124 64, /* 64 bits in a word */ | 189 64, /* 64 bits in a word */ |
125 64, /* 64 bits in an address */ | 190 64, /* 64 bits in an address */ |
126 8, /* 8 bits in a byte */ | 191 8, /* 8 bits in a byte */ |
127 bfd_arch_i386, | 192 bfd_arch_i386, |
128 bfd_mach_x64_32_intel_syntax, | 193 bfd_mach_x64_32_intel_syntax, |
129 "i386:intel", | 194 "i386:intel", |
130 "i386:x64-32:intel", | 195 "i386:x64-32:intel", |
131 3, | 196 3, |
132 FALSE, | 197 FALSE, |
133 bfd_i386_compatible, | 198 bfd_i386_compatible, |
134 bfd_default_scan, | 199 bfd_default_scan, |
135 bfd_arch_i386_long_nop_fill, | 200 bfd_arch_i386_long_nop_fill, |
136 0 | 201 &bfd_i386_nacl_arch |
137 }; | 202 }; |
138 | 203 |
139 static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = | 204 static const bfd_arch_info_type bfd_x86_64_arch_intel_syntax = |
140 { | 205 { |
141 64, /* 64 bits in a word */ | 206 64, /* 64 bits in a word */ |
142 64, /* 64 bits in an address */ | 207 64, /* 64 bits in an address */ |
143 8, /* 8 bits in a byte */ | 208 8, /* 8 bits in a byte */ |
144 bfd_arch_i386, | 209 bfd_arch_i386, |
145 bfd_mach_x86_64_intel_syntax, | 210 bfd_mach_x86_64_intel_syntax, |
146 "i386:intel", | 211 "i386:intel", |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 bfd_mach_i386_i386, | 295 bfd_mach_i386_i386, |
231 "i386", | 296 "i386", |
232 "i386", | 297 "i386", |
233 3, | 298 3, |
234 TRUE, | 299 TRUE, |
235 bfd_i386_compatible, | 300 bfd_i386_compatible, |
236 bfd_default_scan, | 301 bfd_default_scan, |
237 bfd_arch_i386_short_nop_fill, | 302 bfd_arch_i386_short_nop_fill, |
238 &bfd_x86_64_arch | 303 &bfd_x86_64_arch |
239 }; | 304 }; |
OLD | NEW |