Revision 5b50e790 target-i386/gdbstub.c

b/target-i386/gdbstub.c
17 17
 * You should have received a copy of the GNU Lesser General Public
18 18
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
19 19
 */
20
#include "config.h"
21
#include "qemu-common.h"
22
#include "exec/gdbstub.h"
20 23

  
21 24
#ifdef TARGET_X86_64
22 25
static const int gpr_map[16] = {
......
35 38
#define IDX_XMM_REGS    (IDX_FP_REGS + 16)
36 39
#define IDX_MXCSR_REG   (IDX_XMM_REGS + CPU_NB_REGS)
37 40

  
38
static int cpu_gdb_read_register(CPUX86State *env, uint8_t *mem_buf, int n)
41
int x86_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
39 42
{
43
    X86CPU *cpu = X86_CPU(cs);
44
    CPUX86State *env = &cpu->env;
45

  
40 46
    if (n < CPU_NB_REGS) {
41 47
        if (TARGET_LONG_BITS == 64 && env->hflags & HF_CS64_MASK) {
42 48
            return gdb_get_reg64(mem_buf, env->regs[gpr_map[n]]);
......
108 114
    return 0;
109 115
}
110 116

  
111
static int cpu_x86_gdb_load_seg(CPUX86State *env, int sreg, uint8_t *mem_buf)
117
static int x86_cpu_gdb_load_seg(X86CPU *cpu, int sreg, uint8_t *mem_buf)
112 118
{
119
    CPUX86State *env = &cpu->env;
113 120
    uint16_t selector = ldl_p(mem_buf);
114 121

  
115 122
    if (selector != env->segs[sreg].selector) {
......
135 142
    return 4;
136 143
}
137 144

  
138
static int cpu_gdb_write_register(CPUX86State *env, uint8_t *mem_buf, int n)
145
int x86_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
139 146
{
147
    X86CPU *cpu = X86_CPU(cs);
148
    CPUX86State *env = &cpu->env;
140 149
    uint32_t tmp;
141 150

  
142 151
    if (n < CPU_NB_REGS) {
......
179 188
            return 4;
180 189

  
181 190
        case IDX_SEG_REGS:
182
            return cpu_x86_gdb_load_seg(env, R_CS, mem_buf);
191
            return x86_cpu_gdb_load_seg(cpu, R_CS, mem_buf);
183 192
        case IDX_SEG_REGS + 1:
184
            return cpu_x86_gdb_load_seg(env, R_SS, mem_buf);
193
            return x86_cpu_gdb_load_seg(cpu, R_SS, mem_buf);
185 194
        case IDX_SEG_REGS + 2:
186
            return cpu_x86_gdb_load_seg(env, R_DS, mem_buf);
195
            return x86_cpu_gdb_load_seg(cpu, R_DS, mem_buf);
187 196
        case IDX_SEG_REGS + 3:
188
            return cpu_x86_gdb_load_seg(env, R_ES, mem_buf);
197
            return x86_cpu_gdb_load_seg(cpu, R_ES, mem_buf);
189 198
        case IDX_SEG_REGS + 4:
190
            return cpu_x86_gdb_load_seg(env, R_FS, mem_buf);
199
            return x86_cpu_gdb_load_seg(cpu, R_FS, mem_buf);
191 200
        case IDX_SEG_REGS + 5:
192
            return cpu_x86_gdb_load_seg(env, R_GS, mem_buf);
201
            return x86_cpu_gdb_load_seg(cpu, R_GS, mem_buf);
193 202

  
194 203
        case IDX_FP_REGS + 8:
195 204
            env->fpuc = ldl_p(mem_buf);

Also available in: Unified diff