master
h 48 lines 1.08 KB
Raw
1 /*
2 * FreeBSD arm register structures
3 *
4 * Copyright (c) 2015 Stacey D. Son
5 *
6 * SPDX-License-Identifier: GPL-2.0-or-later
7 */
8 #ifndef TARGET_ARCH_REG_H
9 #define TARGET_ARCH_REG_H
10
11 /* See sys/arm/include/reg.h */
12 typedef struct target_reg {
13 uint32_t r[13];
14 uint32_t r_sp;
15 uint32_t r_lr;
16 uint32_t r_pc;
17 uint32_t r_cpsr;
18 } target_reg_t;
19
20 typedef struct target_fp_reg {
21 uint32_t fp_exponent;
22 uint32_t fp_mantissa_hi;
23 u_int32_t fp_mantissa_lo;
24 } target_fp_reg_t;
25
26 typedef struct target_fpreg {
27 uint32_t fpr_fpsr;
28 target_fp_reg_t fpr[8];
29 } target_fpreg_t;
30
31 #define tswapreg(ptr) tswapal(ptr)
32
33 static inline void target_copy_regs(target_reg_t *regs, const CPUARMState *env)
34 {
35 int i;
36
37 for (i = 0; i < 13; i++) {
38 regs->r[i] = tswapreg(env->regs[i + 1]);
39 }
40 regs->r_sp = tswapreg(env->regs[13]);
41 regs->r_lr = tswapreg(env->regs[14]);
42 regs->r_pc = tswapreg(env->regs[15]);
43 regs->r_cpsr = tswapreg(cpsr_read((CPUARMState *)env));
44 }
45
46 #undef tswapreg
47
48 #endif /* TARGET_ARCH_REG_H */