1 /* 2 * FreeBSD arm register structures 3 * 4 * Copyright (c) 2015 Stacey Son 5 * 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. 10 * 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. 15 * 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/>. 18 */ 19 20 #ifndef _TARGET_ARCH_REG_H_ 21 #define _TARGET_ARCH_REG_H_ 22 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; 31 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; 37 38 typedef struct target_fpreg { 39 uint32_t fpr_fpsr; 40 target_fp_reg_t fpr[8]; 41 } target_fpreg_t; 42 43 #define tswapreg(ptr) tswapal(ptr) 44 45 static inline void target_copy_regs(target_reg_t *regs, const CPUARMState *env) 46 { 47 int i; 48 49 for (i = 0; i < 13; i++) { 50 regs->r[i] = tswapreg(env->regs[i + 1]); 51 } 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)); 56 } 57 58 #undef tswapreg 59 60 #endif /* !_TARGET_ARCH_REG_H_ */ 61