mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 22:26:06 +00:00
[fuchsia][arm64] support vector registers
Bug: fuchsia:DX-642 Change-Id: I898b75e47d0dd810025db6ea27e2e0e73ec82768 Tested: CQ Reviewed-on: https://chromium-review.googlesource.com/c/1310513 Commit-Queue: Francois Rousseau <frousseau@google.com> Reviewed-by: Scott Graham <scottmg@chromium.org>
This commit is contained in:
parent
a4754a9ae9
commit
9d4afb0582
@ -47,8 +47,9 @@ void InitializeCPUContextX86_64_NoFloatingPoint(
|
|||||||
|
|
||||||
#elif defined(ARCH_CPU_ARM64)
|
#elif defined(ARCH_CPU_ARM64)
|
||||||
|
|
||||||
void InitializeCPUContextARM64_NoFloatingPoint(
|
void InitializeCPUContextARM64(
|
||||||
const zx_thread_state_general_regs_t& thread_context,
|
const zx_thread_state_general_regs_t& thread_context,
|
||||||
|
const zx_thread_state_vector_regs_t& vector_context,
|
||||||
CPUContextARM64* context) {
|
CPUContextARM64* context) {
|
||||||
memset(context, 0, sizeof(*context));
|
memset(context, 0, sizeof(*context));
|
||||||
|
|
||||||
@ -80,6 +81,12 @@ void InitializeCPUContextARM64_NoFloatingPoint(
|
|||||||
}
|
}
|
||||||
context->spsr =
|
context->spsr =
|
||||||
static_cast<decltype(context->spsr)>(thread_context.cpsr) & kNZCV;
|
static_cast<decltype(context->spsr)>(thread_context.cpsr) & kNZCV;
|
||||||
|
|
||||||
|
context->fpcr = vector_context.fpcr;
|
||||||
|
context->fpsr = vector_context.fpsr;
|
||||||
|
static_assert(sizeof(context->fpsimd) == sizeof(vector_context.v),
|
||||||
|
"registers size mismatch");
|
||||||
|
memcpy(&context->fpsimd, &vector_context.v, sizeof(vector_context.v));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // ARCH_CPU_X86_64
|
#endif // ARCH_CPU_X86_64
|
||||||
|
@ -45,12 +45,13 @@ void InitializeCPUContextX86_64_NoFloatingPoint(
|
|||||||
//! \brief Initializes a CPUContextARM64 structure from native context
|
//! \brief Initializes a CPUContextARM64 structure from native context
|
||||||
//! structures on Fuchsia.
|
//! structures on Fuchsia.
|
||||||
//!
|
//!
|
||||||
//! Floating point registers are currently initialized to zero.
|
|
||||||
//!
|
|
||||||
//! \param[in] thread_context The native thread context.
|
//! \param[in] thread_context The native thread context.
|
||||||
|
//! \param[in] vector_context The native vector context that also contains the
|
||||||
|
//! floating point registers.
|
||||||
//! \param[out] context The CPUContextARM64 structure to initialize.
|
//! \param[out] context The CPUContextARM64 structure to initialize.
|
||||||
void InitializeCPUContextARM64_NoFloatingPoint(
|
void InitializeCPUContextARM64(
|
||||||
const zx_thread_state_general_regs_t& thread_context,
|
const zx_thread_state_general_regs_t& thread_context,
|
||||||
|
const zx_thread_state_vector_regs_t& vector_context,
|
||||||
CPUContextARM64* context);
|
CPUContextARM64* context);
|
||||||
|
|
||||||
#endif // ARCH_CPU_ARM64 || DOXYGEN
|
#endif // ARCH_CPU_ARM64 || DOXYGEN
|
||||||
|
@ -65,9 +65,8 @@ void ExceptionSnapshotFuchsia::Initialize(
|
|||||||
#elif defined(ARCH_CPU_ARM64)
|
#elif defined(ARCH_CPU_ARM64)
|
||||||
context_.architecture = kCPUArchitectureARM64;
|
context_.architecture = kCPUArchitectureARM64;
|
||||||
context_.arm64 = &context_arch_;
|
context_.arm64 = &context_arch_;
|
||||||
// TODO(fuchsia/DX-642): Add float context once saved in |t|.
|
InitializeCPUContextARM64(
|
||||||
InitializeCPUContextARM64_NoFloatingPoint(t.general_registers,
|
t.general_registers, t.vector_registers, context_.arm64);
|
||||||
context_.arm64);
|
|
||||||
#else
|
#else
|
||||||
#error Port.
|
#error Port.
|
||||||
#endif
|
#endif
|
||||||
|
@ -276,15 +276,26 @@ void ProcessReaderFuchsia::InitializeThreads() {
|
|||||||
thread.state = thread_info.state;
|
thread.state = thread_info.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
zx_thread_state_general_regs_t regs;
|
zx_thread_state_general_regs_t general_regs;
|
||||||
status = thread_handles[i].read_state(
|
status = thread_handles[i].read_state(
|
||||||
ZX_THREAD_STATE_GENERAL_REGS, ®s, sizeof(regs));
|
ZX_THREAD_STATE_GENERAL_REGS, &general_regs, sizeof(general_regs));
|
||||||
if (status != ZX_OK) {
|
if (status != ZX_OK) {
|
||||||
ZX_LOG(WARNING, status) << "zx_thread_read_state";
|
ZX_LOG(WARNING, status)
|
||||||
|
<< "zx_thread_read_state(ZX_THREAD_STATE_GENERAL_REGS)";
|
||||||
} else {
|
} else {
|
||||||
thread.general_registers = regs;
|
thread.general_registers = general_regs;
|
||||||
|
|
||||||
GetStackRegions(regs, memory_map_, &thread.stack_regions);
|
GetStackRegions(general_regs, memory_map_, &thread.stack_regions);
|
||||||
|
}
|
||||||
|
|
||||||
|
zx_thread_state_vector_regs_t vector_regs;
|
||||||
|
status = thread_handles[i].read_state(
|
||||||
|
ZX_THREAD_STATE_VECTOR_REGS, &vector_regs, sizeof(vector_regs));
|
||||||
|
if (status != ZX_OK) {
|
||||||
|
ZX_LOG(WARNING, status)
|
||||||
|
<< "zx_thread_read_state(ZX_THREAD_STATE_VECTOR_REGS)";
|
||||||
|
} else {
|
||||||
|
thread.vector_registers = vector_regs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,6 +77,10 @@ class ProcessReaderFuchsia {
|
|||||||
//! returned by `zx_thread_read_state()`.
|
//! returned by `zx_thread_read_state()`.
|
||||||
zx_thread_state_general_regs_t general_registers = {};
|
zx_thread_state_general_regs_t general_registers = {};
|
||||||
|
|
||||||
|
//! \brief The raw architecture-specific `zx_thread_state_vector_regs_t` as
|
||||||
|
//! returned by `zx_thread_read_state()`.
|
||||||
|
zx_thread_state_vector_regs_t vector_registers = {};
|
||||||
|
|
||||||
//! \brief The regions representing the stack. The first entry in the vector
|
//! \brief The regions representing the stack. The first entry in the vector
|
||||||
//! represents the callstack, and further entries optionally identify
|
//! represents the callstack, and further entries optionally identify
|
||||||
//! other stack data when the thread uses a split stack representation.
|
//! other stack data when the thread uses a split stack representation.
|
||||||
|
@ -45,9 +45,8 @@ bool ThreadSnapshotFuchsia::Initialize(
|
|||||||
#elif defined(ARCH_CPU_ARM64)
|
#elif defined(ARCH_CPU_ARM64)
|
||||||
context_.architecture = kCPUArchitectureARM64;
|
context_.architecture = kCPUArchitectureARM64;
|
||||||
context_.arm64 = &context_arch_;
|
context_.arm64 = &context_arch_;
|
||||||
// TODO(fuchsia/DX-642): Add float context once saved in |thread|.
|
InitializeCPUContextARM64(
|
||||||
InitializeCPUContextARM64_NoFloatingPoint(thread.general_registers,
|
thread.general_registers, thread.vector_registers, context_.arm64);
|
||||||
context_.arm64);
|
|
||||||
#else
|
#else
|
||||||
#error Port.
|
#error Port.
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user