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