target/arm: Fix CNTPOFF_EL2 trap to missing EL3
[qemu/armbru.git] / bsd-user / arm / target_arch_reg.h
blob070fa24da123c9113c89bc89fa9e32d0b8718b65
1 /*
2 * FreeBSD arm register structures
4 * Copyright (c) 2015 Stacey Son
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #ifndef TARGET_ARCH_REG_H
21 #define TARGET_ARCH_REG_H
23 /* See sys/arm/include/reg.h */
24 typedef struct target_reg {
25 uint32_t r[13];
26 uint32_t r_sp;
27 uint32_t r_lr;
28 uint32_t r_pc;
29 uint32_t r_cpsr;
30 } target_reg_t;
32 typedef struct target_fp_reg {
33 uint32_t fp_exponent;
34 uint32_t fp_mantissa_hi;
35 u_int32_t fp_mantissa_lo;
36 } target_fp_reg_t;
38 typedef struct target_fpreg {
39 uint32_t fpr_fpsr;
40 target_fp_reg_t fpr[8];
41 } target_fpreg_t;
43 #define tswapreg(ptr) tswapal(ptr)
45 static inline void target_copy_regs(target_reg_t *regs, const CPUARMState *env)
47 int i;
49 for (i = 0; i < 13; i++) {
50 regs->r[i] = tswapreg(env->regs[i + 1]);
52 regs->r_sp = tswapreg(env->regs[13]);
53 regs->r_lr = tswapreg(env->regs[14]);
54 regs->r_pc = tswapreg(env->regs[15]);
55 regs->r_cpsr = tswapreg(cpsr_read((CPUARMState *)env));
58 #undef tswapreg
60 #endif /* TARGET_ARCH_REG_H */