| OLD | NEW |
| 1 /* Native-dependent code for AMD64. | 1 /* Native-dependent code for AMD64. |
| 2 | 2 |
| 3 Copyright (C) 2003-2004, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2003-2004, 2007-2012 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 general-purpose register set. */ | 52 general-purpose register set. */ |
| 53 | 53 |
| 54 static int | 54 static int |
| 55 amd64_native_gregset_reg_offset (struct gdbarch *gdbarch, int regnum) | 55 amd64_native_gregset_reg_offset (struct gdbarch *gdbarch, int regnum) |
| 56 { | 56 { |
| 57 int *reg_offset = amd64_native_gregset64_reg_offset; | 57 int *reg_offset = amd64_native_gregset64_reg_offset; |
| 58 int num_regs = amd64_native_gregset64_num_regs; | 58 int num_regs = amd64_native_gregset64_num_regs; |
| 59 | 59 |
| 60 gdb_assert (regnum >= 0); | 60 gdb_assert (regnum >= 0); |
| 61 | 61 |
| 62 if (gdbarch_ptr_bit (gdbarch) == 32) | 62 if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) |
| 63 { | 63 { |
| 64 reg_offset = amd64_native_gregset32_reg_offset; | 64 reg_offset = amd64_native_gregset32_reg_offset; |
| 65 num_regs = amd64_native_gregset32_num_regs; | 65 num_regs = amd64_native_gregset32_num_regs; |
| 66 } | 66 } |
| 67 | 67 |
| 68 if (num_regs > gdbarch_num_regs (gdbarch)) | 68 if (num_regs > gdbarch_num_regs (gdbarch)) |
| 69 num_regs = gdbarch_num_regs (gdbarch); | 69 num_regs = gdbarch_num_regs (gdbarch); |
| 70 | 70 |
| 71 if (regnum < num_regs && regnum < gdbarch_num_regs (gdbarch)) | 71 if (regnum < num_regs && regnum < gdbarch_num_regs (gdbarch)) |
| 72 return reg_offset[regnum]; | 72 return reg_offset[regnum]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 | 89 |
| 90 void | 90 void |
| 91 amd64_supply_native_gregset (struct regcache *regcache, | 91 amd64_supply_native_gregset (struct regcache *regcache, |
| 92 const void *gregs, int regnum) | 92 const void *gregs, int regnum) |
| 93 { | 93 { |
| 94 const char *regs = gregs; | 94 const char *regs = gregs; |
| 95 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 95 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 96 int num_regs = amd64_native_gregset64_num_regs; | 96 int num_regs = amd64_native_gregset64_num_regs; |
| 97 int i; | 97 int i; |
| 98 | 98 |
| 99 if (gdbarch_ptr_bit (gdbarch) == 32) | 99 if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) |
| 100 num_regs = amd64_native_gregset32_num_regs; | 100 num_regs = amd64_native_gregset32_num_regs; |
| 101 | 101 |
| 102 if (num_regs > gdbarch_num_regs (gdbarch)) | 102 if (num_regs > gdbarch_num_regs (gdbarch)) |
| 103 num_regs = gdbarch_num_regs (gdbarch); | 103 num_regs = gdbarch_num_regs (gdbarch); |
| 104 | 104 |
| 105 for (i = 0; i < num_regs; i++) | 105 for (i = 0; i < num_regs; i++) |
| 106 { | 106 { |
| 107 if (regnum == -1 || regnum == i) | 107 if (regnum == -1 || regnum == i) |
| 108 { | 108 { |
| 109 int offset = amd64_native_gregset_reg_offset (gdbarch, i); | 109 int offset = amd64_native_gregset_reg_offset (gdbarch, i); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 120 | 120 |
| 121 void | 121 void |
| 122 amd64_collect_native_gregset (const struct regcache *regcache, | 122 amd64_collect_native_gregset (const struct regcache *regcache, |
| 123 void *gregs, int regnum) | 123 void *gregs, int regnum) |
| 124 { | 124 { |
| 125 char *regs = gregs; | 125 char *regs = gregs; |
| 126 struct gdbarch *gdbarch = get_regcache_arch (regcache); | 126 struct gdbarch *gdbarch = get_regcache_arch (regcache); |
| 127 int num_regs = amd64_native_gregset64_num_regs; | 127 int num_regs = amd64_native_gregset64_num_regs; |
| 128 int i; | 128 int i; |
| 129 | 129 |
| 130 if (gdbarch_ptr_bit (gdbarch) == 32) | 130 if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) |
| 131 { | 131 { |
| 132 num_regs = amd64_native_gregset32_num_regs; | 132 num_regs = amd64_native_gregset32_num_regs; |
| 133 | 133 |
| 134 /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and | 134 /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and |
| 135 %eip get zero-extended to 64 bits. */ | 135 %eip get zero-extended to 64 bits. */ |
| 136 for (i = 0; i <= I386_EIP_REGNUM; i++) | 136 for (i = 0; i <= I386_EIP_REGNUM; i++) |
| 137 { | 137 { |
| 138 if (regnum == -1 || regnum == i) | 138 if (regnum == -1 || regnum == i) |
| 139 memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8); | 139 memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8); |
| 140 } | 140 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 153 { | 153 { |
| 154 if (regnum == -1 || regnum == i) | 154 if (regnum == -1 || regnum == i) |
| 155 { | 155 { |
| 156 int offset = amd64_native_gregset_reg_offset (gdbarch, i); | 156 int offset = amd64_native_gregset_reg_offset (gdbarch, i); |
| 157 | 157 |
| 158 if (offset != -1) | 158 if (offset != -1) |
| 159 regcache_raw_collect (regcache, i, regs + offset); | 159 regcache_raw_collect (regcache, i, regs + offset); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 } | 162 } |
| OLD | NEW |