1 /* 2 * Copyright 2018 The Hafnium Authors. 3 * 4 * Use of this source code is governed by a BSD-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/BSD-3-Clause. 7 */ 8 9 #include "hf/arch/sve.h" 10 11 #include "hf/cpu.h" 12 #include "hf/offset_size_header.h" 13 #include "hf/vm.h" 14 15 DEFINE_SIZEOF(CPU_SIZE, struct cpu) 16 17 DEFINE_OFFSETOF(CPU_ID, struct cpu, id) 18 DEFINE_OFFSETOF(CPU_STACK_BOTTOM, struct cpu, stack_bottom) 19 DEFINE_OFFSETOF(VCPU_VM, struct vcpu, vm) 20 DEFINE_OFFSETOF(VCPU_CPU, struct vcpu, cpu) 21 DEFINE_OFFSETOF(VCPU_REGS, struct vcpu, regs) 22 DEFINE_OFFSETOF(VCPU_LAZY, struct vcpu, regs.lazy) 23 DEFINE_OFFSETOF(VCPU_FREGS, struct vcpu, regs.fp) 24 DEFINE_OFFSETOF(VCPU_FPSR, struct vcpu, regs.fpsr) 25 #if BRANCH_PROTECTION 26 DEFINE_OFFSETOF(VCPU_PAC, struct vcpu, regs.pac) 27 #endif 28 29 #if ENABLE_MTE 30 DEFINE_OFFSETOF(VCPU_MTE, struct vcpu, regs.mte) 31 #endif 32 33 DEFINE_OFFSETOF(VM_ID, struct vm, id) 34 35 #if GIC_VERSION == 3 || GIC_VERSION == 4 36 DEFINE_OFFSETOF(VCPU_GIC, struct vcpu, regs.gic) 37 #endif 38 39 DEFINE_SIZEOF(SVE_CTX_SIZE, struct sve_context_t) 40 DEFINE_OFFSETOF(SVE_CTX_PREDICATES, struct sve_context_t, predicates) 41 DEFINE_OFFSETOF(SVE_CTX_VECTORS, struct sve_context_t, vectors) 42