[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 22/37] bsd-user/arm/target_arch_reg.h: Implement core dump reg
From: |
Warner Losh |
Subject: |
[PATCH v5 22/37] bsd-user/arm/target_arch_reg.h: Implement core dump register copying |
Date: |
Sun, 7 Nov 2021 20:51:21 -0700 |
Implement the register copying routines to extract registers from the
cpu for core dump generation.
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/arm/target_arch_reg.h | 60 ++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
create mode 100644 bsd-user/arm/target_arch_reg.h
diff --git a/bsd-user/arm/target_arch_reg.h b/bsd-user/arm/target_arch_reg.h
new file mode 100644
index 0000000000..ef5ed5154f
--- /dev/null
+++ b/bsd-user/arm/target_arch_reg.h
@@ -0,0 +1,60 @@
+/*
+ * FreeBSD arm register structures
+ *
+ * Copyright (c) 2015 Stacey Son
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _TARGET_ARCH_REG_H_
+#define _TARGET_ARCH_REG_H_
+
+/* See sys/arm/include/reg.h */
+typedef struct target_reg {
+ uint32_t r[13];
+ uint32_t r_sp;
+ uint32_t r_lr;
+ uint32_t r_pc;
+ uint32_t r_cpsr;
+} target_reg_t;
+
+typedef struct target_fp_reg {
+ uint32_t fp_exponent;
+ uint32_t fp_mantissa_hi;
+ u_int32_t fp_mantissa_lo;
+} target_fp_reg_t;
+
+typedef struct target_fpreg {
+ uint32_t fpr_fpsr;
+ target_fp_reg_t fpr[8];
+} target_fpreg_t;
+
+#define tswapreg(ptr) tswapal(ptr)
+
+static inline void target_copy_regs(target_reg_t *regs, const CPUARMState *env)
+{
+ int i;
+
+ for (i = 0; i < 13; i++) {
+ regs->r[i] = tswapreg(env->regs[i + 1]);
+ }
+ regs->r_sp = tswapreg(env->regs[13]);
+ regs->r_lr = tswapreg(env->regs[14]);
+ regs->r_pc = tswapreg(env->regs[15]);
+ regs->r_cpsr = tswapreg(cpsr_read((CPUARMState *)env));
+}
+
+#undef tswapreg
+
+#endif /* !_TARGET_ARCH_REG_H_ */
--
2.33.0
- [PATCH v5 13/37] bsd-user/arm/target_arch_sysarch.h: Use consistent include guards, (continued)
- [PATCH v5 13/37] bsd-user/arm/target_arch_sysarch.h: Use consistent include guards, Warner Losh, 2021/11/07
- [PATCH v5 14/37] bsd-user/arm/target_syscall.h: Add copyright and update name, Warner Losh, 2021/11/07
- [PATCH v5 30/37] bsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals, Warner Losh, 2021/11/07
- [PATCH v5 34/37] bsd-user/arm/signal.c: arm set_mcontext, Warner Losh, 2021/11/07
- [PATCH v5 15/37] bsd-user/arm/target_arch_cpu.c: Target specific TLS routines, Warner Losh, 2021/11/07
- [PATCH v5 36/37] bsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZE, Warner Losh, 2021/11/07
- [PATCH v5 29/37] bsd-user/arm/target_arch_signal.h: arm specific signal registers and stack, Warner Losh, 2021/11/07
- [PATCH v5 32/37] bsd-user/arm/signal.c: arm set_sigtramp_args, Warner Losh, 2021/11/07
- [PATCH v5 21/37] bsd-user/arm/target_arch_cpu.h: Implement system call dispatch, Warner Losh, 2021/11/07
- [PATCH v5 22/37] bsd-user/arm/target_arch_reg.h: Implement core dump register copying,
Warner Losh <=
- [PATCH v5 18/37] bsd-user/arm/target_arch_cpu.h: Dummy target_cpu_loop implementation, Warner Losh, 2021/11/07
- [PATCH v5 31/37] bsd-user/arm/target_arch_signal.h: Define size of *context_t, Warner Losh, 2021/11/07
- [PATCH v5 37/37] bsd-user: add arm target build, Warner Losh, 2021/11/07
- [PATCH v5 20/37] bsd-user/arm/target_arch_cpu.h: Implement data abort exceptions, Warner Losh, 2021/11/07
- [PATCH v5 09/37] bsd-user/x86_64/target_arch_signal.h: use new target_os_ucontext.h, Warner Losh, 2021/11/07
- [PATCH v5 23/37] bsd-user/arm/target_arch_vmparam.h: Parameters for arm address space, Warner Losh, 2021/11/07