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