Lines Matching +full:8 +full:- +full:cpu

4  * Copyright (c) 2003-2005 Fabrice Bellard
21 #include "accel/tcg/vcpu-state.h"
22 #include "cpu.h"
26 #include "linux-user/qemu.h"
32 8, 9, 10, 11, 12, 13, 14, 15
37 static const int gpr_map32[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
41 * gdb_num_core_regs in target/i386/cpu.c
50 * general regs -----> 8 or 16
58 * fpu regs ----------> 8 or 16
62 * total ----> 8+1+1+9+6+16+8+1=50 or 16+1+1+9+6+16+16+1=66
98 return 8; in gdb_write_reg_cs64()
107 if (env->hflags & HF_CS64_MASK) { in gdb_get_reg()
119 X86CPU *cpu = X86_CPU(cs); in x86_cpu_gdb_read_register() local
120 CPUX86State *env = &cpu->env; in x86_cpu_gdb_read_register()
125 of a session. So if we're in 32-bit mode on a 64-bit cpu, still act in x86_cpu_gdb_read_register()
126 as if we're on a 64-bit cpu. */ in x86_cpu_gdb_read_register()
130 if (env->hflags & HF_CS64_MASK) { in x86_cpu_gdb_read_register()
131 return gdb_get_reg64(mem_buf, env->regs[gpr_map[n]]); in x86_cpu_gdb_read_register()
134 env->regs[gpr_map[n]] & 0xffffffffUL); in x86_cpu_gdb_read_register()
139 return gdb_get_reg32(mem_buf, env->regs[gpr_map32[n]]); in x86_cpu_gdb_read_register()
141 } else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) { in x86_cpu_gdb_read_register()
142 int st_index = n - IDX_FP_REGS; in x86_cpu_gdb_read_register()
143 int r_index = (st_index + env->fpstt) % 8; in x86_cpu_gdb_read_register()
144 floatx80 *fp = &env->fpregs[r_index].d; in x86_cpu_gdb_read_register()
145 int len = gdb_get_reg64(mem_buf, cpu_to_le64(fp->low)); in x86_cpu_gdb_read_register()
146 len += gdb_get_reg16(mem_buf, cpu_to_le16(fp->high)); in x86_cpu_gdb_read_register()
149 n -= IDX_XMM_REGS; in x86_cpu_gdb_read_register()
152 env->xmm_regs[n].ZMM_Q(1), in x86_cpu_gdb_read_register()
153 env->xmm_regs[n].ZMM_Q(0)); in x86_cpu_gdb_read_register()
158 return gdb_get_reg(env, mem_buf, env->eip); in x86_cpu_gdb_read_register()
160 return gdb_get_reg32(mem_buf, env->eflags); in x86_cpu_gdb_read_register()
163 return gdb_get_reg32(mem_buf, env->segs[R_CS].selector); in x86_cpu_gdb_read_register()
165 return gdb_get_reg32(mem_buf, env->segs[R_SS].selector); in x86_cpu_gdb_read_register()
167 return gdb_get_reg32(mem_buf, env->segs[R_DS].selector); in x86_cpu_gdb_read_register()
169 return gdb_get_reg32(mem_buf, env->segs[R_ES].selector); in x86_cpu_gdb_read_register()
171 return gdb_get_reg32(mem_buf, env->segs[R_FS].selector); in x86_cpu_gdb_read_register()
173 return gdb_get_reg32(mem_buf, env->segs[R_GS].selector); in x86_cpu_gdb_read_register()
175 return gdb_read_reg_cs64(env->hflags, mem_buf, env->segs[R_FS].base); in x86_cpu_gdb_read_register()
177 return gdb_read_reg_cs64(env->hflags, mem_buf, env->segs[R_GS].base); in x86_cpu_gdb_read_register()
179 case IDX_SEG_REGS + 8: in x86_cpu_gdb_read_register()
181 return gdb_read_reg_cs64(env->hflags, mem_buf, env->kernelgsbase); in x86_cpu_gdb_read_register()
186 case IDX_FP_REGS + 8: in x86_cpu_gdb_read_register()
187 return gdb_get_reg32(mem_buf, env->fpuc); in x86_cpu_gdb_read_register()
189 return gdb_get_reg32(mem_buf, (env->fpus & ~0x3800) | in x86_cpu_gdb_read_register()
190 (env->fpstt & 0x7) << 11); in x86_cpu_gdb_read_register()
206 return gdb_get_reg32(mem_buf, env->mxcsr); in x86_cpu_gdb_read_register()
209 return gdb_read_reg_cs64(env->hflags, mem_buf, env->cr[0]); in x86_cpu_gdb_read_register()
211 return gdb_read_reg_cs64(env->hflags, mem_buf, env->cr[2]); in x86_cpu_gdb_read_register()
213 return gdb_read_reg_cs64(env->hflags, mem_buf, env->cr[3]); in x86_cpu_gdb_read_register()
215 return gdb_read_reg_cs64(env->hflags, mem_buf, env->cr[4]); in x86_cpu_gdb_read_register()
218 tpr = cpu_get_apic_tpr(cpu->apic_state); in x86_cpu_gdb_read_register()
222 return gdb_read_reg_cs64(env->hflags, mem_buf, tpr); in x86_cpu_gdb_read_register()
225 return gdb_read_reg_cs64(env->hflags, mem_buf, env->efer); in x86_cpu_gdb_read_register()
231 static int x86_cpu_gdb_load_seg(X86CPU *cpu, X86Seg sreg, uint8_t *mem_buf) in x86_cpu_gdb_load_seg() argument
233 CPUX86State *env = &cpu->env; in x86_cpu_gdb_load_seg()
236 if (selector != env->segs[sreg].selector) { in x86_cpu_gdb_load_seg()
243 if (!(env->cr[0] & CR0_PE_MASK) || (env->eflags & VM_MASK)) { in x86_cpu_gdb_load_seg()
244 int dpl = (env->eflags & VM_MASK) ? 3 : 0; in x86_cpu_gdb_load_seg()
264 if (env->hflags & HF_CS64_MASK) { in gdb_write_reg()
269 return 8; in gdb_write_reg()
278 X86CPU *cpu = X86_CPU(cs); in x86_cpu_gdb_write_register() local
279 CPUX86State *env = &cpu->env; in x86_cpu_gdb_write_register()
284 of a session. So if we're in 32-bit mode on a 64-bit cpu, still act in x86_cpu_gdb_write_register()
285 as if we're on a 64-bit cpu. */ in x86_cpu_gdb_write_register()
289 if (env->hflags & HF_CS64_MASK) { in x86_cpu_gdb_write_register()
290 env->regs[gpr_map[n]] = ldtul_p(mem_buf); in x86_cpu_gdb_write_register()
292 env->regs[gpr_map[n]] = ldtul_p(mem_buf) & 0xffffffffUL; in x86_cpu_gdb_write_register()
297 env->regs[n] &= ~0xffffffffUL; in x86_cpu_gdb_write_register()
298 env->regs[n] |= (uint32_t)ldl_p(mem_buf); in x86_cpu_gdb_write_register()
301 } else if (n >= IDX_FP_REGS && n < IDX_FP_REGS + 8) { in x86_cpu_gdb_write_register()
302 floatx80 *fp = (floatx80 *) &env->fpregs[n - IDX_FP_REGS]; in x86_cpu_gdb_write_register()
303 fp->low = le64_to_cpu(* (uint64_t *) mem_buf); in x86_cpu_gdb_write_register()
304 fp->high = le16_to_cpu(* (uint16_t *) (mem_buf + 8)); in x86_cpu_gdb_write_register()
307 n -= IDX_XMM_REGS; in x86_cpu_gdb_write_register()
309 env->xmm_regs[n].ZMM_Q(0) = ldq_p(mem_buf); in x86_cpu_gdb_write_register()
310 env->xmm_regs[n].ZMM_Q(1) = ldq_p(mem_buf + 8); in x86_cpu_gdb_write_register()
316 return gdb_write_reg(env, mem_buf, &env->eip); in x86_cpu_gdb_write_register()
318 env->eflags = ldl_p(mem_buf); in x86_cpu_gdb_write_register()
322 return x86_cpu_gdb_load_seg(cpu, R_CS, mem_buf); in x86_cpu_gdb_write_register()
324 return x86_cpu_gdb_load_seg(cpu, R_SS, mem_buf); in x86_cpu_gdb_write_register()
326 return x86_cpu_gdb_load_seg(cpu, R_DS, mem_buf); in x86_cpu_gdb_write_register()
328 return x86_cpu_gdb_load_seg(cpu, R_ES, mem_buf); in x86_cpu_gdb_write_register()
330 return x86_cpu_gdb_load_seg(cpu, R_FS, mem_buf); in x86_cpu_gdb_write_register()
332 return x86_cpu_gdb_load_seg(cpu, R_GS, mem_buf); in x86_cpu_gdb_write_register()
334 return gdb_write_reg_cs64(env->hflags, mem_buf, &env->segs[R_FS].base); in x86_cpu_gdb_write_register()
336 return gdb_write_reg_cs64(env->hflags, mem_buf, &env->segs[R_GS].base); in x86_cpu_gdb_write_register()
337 case IDX_SEG_REGS + 8: in x86_cpu_gdb_write_register()
339 return gdb_write_reg_cs64(env->hflags, mem_buf, &env->kernelgsbase); in x86_cpu_gdb_write_register()
343 case IDX_FP_REGS + 8: in x86_cpu_gdb_write_register()
348 env->fpstt = (tmp >> 11) & 7; in x86_cpu_gdb_write_register()
349 env->fpus = tmp & ~0x3800; in x86_cpu_gdb_write_register()
369 len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); in x86_cpu_gdb_write_register()
376 len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); in x86_cpu_gdb_write_register()
378 env->cr[2] = tmp; in x86_cpu_gdb_write_register()
383 len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); in x86_cpu_gdb_write_register()
390 len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); in x86_cpu_gdb_write_register()
397 len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); in x86_cpu_gdb_write_register()
399 cpu_set_apic_tpr(cpu->apic_state, tmp); in x86_cpu_gdb_write_register()
404 len = gdb_write_reg_cs64(env->hflags, mem_buf, &tmp); in x86_cpu_gdb_write_register()
422 X86CPU *cpu = X86_CPU(cs); in x86_cpu_gdb_read_linux_register() local
423 CPUX86State *env = &cpu->env; in x86_cpu_gdb_read_linux_register()
427 return gdb_get_reg(env, mem_buf, get_task_state(cs)->orig_ax); in x86_cpu_gdb_read_linux_register()
435 X86CPU *cpu = X86_CPU(cs); in x86_cpu_gdb_write_linux_register() local
436 CPUX86State *env = &cpu->env; in x86_cpu_gdb_write_linux_register()
440 return gdb_write_reg(env, mem_buf, &get_task_state(cs)->orig_ax); in x86_cpu_gdb_write_linux_register()
453 gdb_find_static_feature("i386-64bit-linux.xml"), in x86_cpu_gdb_init()
455 gdb_find_static_feature("i386-32bit-linux.xml"), in x86_cpu_gdb_init()