status_t CpuStateX8664::UpdateDebugState(void* state, size_t size) const { if (size != sizeof(x86_64_debug_cpu_state)) return B_BAD_VALUE; x86_64_debug_cpu_state* x64State = (x86_64_debug_cpu_state*)state; x64State->rip = InstructionPointer(); x64State->rsp = StackPointer(); x64State->rbp = StackFramePointer(); x64State->rax = IntRegisterValue(X86_64_REGISTER_RAX); x64State->rbx = IntRegisterValue(X86_64_REGISTER_RBX); x64State->rcx = IntRegisterValue(X86_64_REGISTER_RCX); x64State->rdx = IntRegisterValue(X86_64_REGISTER_RDX); x64State->rsi = IntRegisterValue(X86_64_REGISTER_RSI); x64State->rdi = IntRegisterValue(X86_64_REGISTER_RDI); x64State->r8 = IntRegisterValue(X86_64_REGISTER_R8); x64State->r9 = IntRegisterValue(X86_64_REGISTER_R9); x64State->r10 = IntRegisterValue(X86_64_REGISTER_R10); x64State->r11 = IntRegisterValue(X86_64_REGISTER_R11); x64State->r12 = IntRegisterValue(X86_64_REGISTER_R12); x64State->r13 = IntRegisterValue(X86_64_REGISTER_R13); x64State->r14 = IntRegisterValue(X86_64_REGISTER_R14); x64State->r15 = IntRegisterValue(X86_64_REGISTER_R15); x64State->cs = IntRegisterValue(X86_64_REGISTER_CS); x64State->ds = IntRegisterValue(X86_64_REGISTER_DS); x64State->es = IntRegisterValue(X86_64_REGISTER_ES); x64State->fs = IntRegisterValue(X86_64_REGISTER_FS); x64State->gs = IntRegisterValue(X86_64_REGISTER_GS); x64State->ss = IntRegisterValue(X86_64_REGISTER_SS); return B_OK; }
status_t CpuStateX86::UpdateDebugState(void* state, size_t size) const { if (size != sizeof(x86_debug_cpu_state)) return B_BAD_VALUE; x86_debug_cpu_state* x86State = (x86_debug_cpu_state*)state; x86State->eip = InstructionPointer(); x86State->user_esp = StackPointer(); x86State->ebp = StackFramePointer(); x86State->eax = IntRegisterValue(X86_REGISTER_EAX); x86State->ebx = IntRegisterValue(X86_REGISTER_EBX); x86State->ecx = IntRegisterValue(X86_REGISTER_ECX); x86State->edx = IntRegisterValue(X86_REGISTER_EDX); x86State->esi = IntRegisterValue(X86_REGISTER_ESI); x86State->edi = IntRegisterValue(X86_REGISTER_EDI); x86State->cs = IntRegisterValue(X86_REGISTER_CS); x86State->ds = IntRegisterValue(X86_REGISTER_DS); x86State->es = IntRegisterValue(X86_REGISTER_ES); x86State->fs = IntRegisterValue(X86_REGISTER_FS); x86State->gs = IntRegisterValue(X86_REGISTER_GS); x86State->user_ss = IntRegisterValue(X86_REGISTER_SS); x86State->vector = fInterruptVector; return B_OK; }
status_t CpuStateX8664::UpdateDebugState(void* state, size_t size) const { if (size != sizeof(x86_64_debug_cpu_state)) return B_BAD_VALUE; x86_64_debug_cpu_state* x64State = (x86_64_debug_cpu_state*)state; x64State->rip = InstructionPointer(); x64State->rsp = StackPointer(); x64State->rbp = StackFramePointer(); x64State->rax = IntRegisterValue(X86_64_REGISTER_RAX); x64State->rbx = IntRegisterValue(X86_64_REGISTER_RBX); x64State->rcx = IntRegisterValue(X86_64_REGISTER_RCX); x64State->rdx = IntRegisterValue(X86_64_REGISTER_RDX); x64State->rsi = IntRegisterValue(X86_64_REGISTER_RSI); x64State->rdi = IntRegisterValue(X86_64_REGISTER_RDI); x64State->r8 = IntRegisterValue(X86_64_REGISTER_R8); x64State->r9 = IntRegisterValue(X86_64_REGISTER_R9); x64State->r10 = IntRegisterValue(X86_64_REGISTER_R10); x64State->r11 = IntRegisterValue(X86_64_REGISTER_R11); x64State->r12 = IntRegisterValue(X86_64_REGISTER_R12); x64State->r13 = IntRegisterValue(X86_64_REGISTER_R13); x64State->r14 = IntRegisterValue(X86_64_REGISTER_R14); x64State->r15 = IntRegisterValue(X86_64_REGISTER_R15); x64State->cs = IntRegisterValue(X86_64_REGISTER_CS); x64State->ds = IntRegisterValue(X86_64_REGISTER_DS); x64State->es = IntRegisterValue(X86_64_REGISTER_ES); x64State->fs = IntRegisterValue(X86_64_REGISTER_FS); x64State->gs = IntRegisterValue(X86_64_REGISTER_GS); x64State->ss = IntRegisterValue(X86_64_REGISTER_SS); for (int32 i = 0; i < 8; i++) { *(long double*)(x64State->extended_registers.fp_registers[i].value) = (long double)FloatRegisterValue(X86_64_REGISTER_ST0 + i); if (IsRegisterSet(X86_64_REGISTER_MM0 + i)) { memcpy(&x64State->extended_registers.mmx_registers[i], &fMMXRegisters[i], sizeof(x86_64_fp_register)); } } for (int32 i = 0; i < 16; i++) { if (IsRegisterSet(X86_64_REGISTER_XMM0 + i)) { memcpy(&x64State->extended_registers.xmm_registers[i], &fXMMRegisters[i], sizeof(x86_64_xmm_register)); } else { memset(&x64State->extended_registers.xmm_registers[i], 0, sizeof(x86_64_xmm_register)); } } return B_OK; }