diff --git a/client/crashpad_client_linux.cc b/client/crashpad_client_linux.cc index 4d0d111b..e7fa162c 100644 --- a/client/crashpad_client_linux.cc +++ b/client/crashpad_client_linux.cc @@ -210,19 +210,12 @@ bool CrashpadClient::StartHandlerForClient( void CrashpadClient::DumpWithoutCrash(NativeCPUContext* context) { DCHECK(g_crash_handler); -#if defined(ARCH_CPU_X86) - memset(&context->__fpregs_mem, 0, sizeof(context->__fpregs_mem)); - context->__fpregs_mem.status = 0xffff0000; -#elif defined(ARCH_CPU_X86_64) - memset(&context->__fpregs_mem, 0, sizeof(context->__fpregs_mem)); -#elif defined(ARCH_CPU_ARMEL) +#if defined(ARCH_CPU_ARMEL) memset(context->uc_regspace, 0, sizeof(context->uc_regspace)); #elif defined(ARCH_CPU_ARM64) memset(context->uc_mcontext.__reserved, 0, sizeof(context->uc_mcontext.__reserved)); -#else -#error Port. #endif siginfo_t siginfo; diff --git a/util/misc/capture_context_linux.S b/util/misc/capture_context_linux.S index 5541643f..6ec72454 100644 --- a/util/misc/capture_context_linux.S +++ b/util/misc/capture_context_linux.S @@ -128,6 +128,8 @@ CAPTURECONTEXT_SYMBOL2: movl %ecx, 0x5c(%eax) // context->uc_mcontext.xss // TODO(jperaza): save floating-point registers. + xorl %ecx, %ecx + movl %ecx, 0x60(%eax) // context->uc_mcontext.fpregs // Clean up by restoring clobbered registers, even those considered volatile // by the ABI, so that the captured context represents the state at this @@ -224,14 +226,15 @@ CAPTURECONTEXT_SYMBOL2: movq %r8, 0xd0(%rdi) // context->uc_mcontext.oldmask movq %r8, 0xd8(%rdi) // context->uc_mcontext.cr2 + // TODO(jperaza): save floating-point registers. + movq %r8, 0xe0(%rdi) // context->uc_mcontext.fpregs + // Clean up by restoring clobbered registers, even those considered volatile // by the ABI, so that the captured context represents the state at this // function’s exit. movq 0x90(%rdi), %rax movq 0x28(%rdi), %r8 - // TODO(jperaza): save floating-point registers. - popfq popq %rbp diff --git a/util/misc/capture_context_test_util_linux.cc b/util/misc/capture_context_test_util_linux.cc index fb64e5d4..3ba13d85 100644 --- a/util/misc/capture_context_test_util_linux.cc +++ b/util/misc/capture_context_test_util_linux.cc @@ -23,10 +23,13 @@ namespace test { void SanityCheckContext(const NativeCPUContext& context) { #if defined(ARCH_CPU_X86) - // Nothing to do here yet. + // TODO(jperaza): fpregs is nullptr until CaptureContext() supports capturing + // floating point context. + EXPECT_EQ(context.uc_mcontext.fpregs, nullptr); #elif defined(ARCH_CPU_X86_64) EXPECT_EQ(context.uc_mcontext.gregs[REG_RDI], FromPointerCast(&context)); + EXPECT_EQ(context.uc_mcontext.fpregs, nullptr); #elif defined(ARCH_CPU_ARMEL) EXPECT_EQ(context.uc_mcontext.arm_r0, FromPointerCast(&context)); #elif defined(ARCH_CPU_ARM64)