1 /* 2 * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief Per-arch thread definition 10 * 11 * This file contains definitions for 12 * 13 * struct _thread_arch 14 * struct _callee_saved 15 * 16 * necessary to instantiate instances of struct k_thread. 17 */ 18 19 #ifndef ZEPHYR_INCLUDE_ARCH_ARM64_THREAD_H_ 20 #define ZEPHYR_INCLUDE_ARCH_ARM64_THREAD_H_ 21 22 #ifndef _ASMLANGUAGE 23 #include <zephyr/types.h> 24 #include <zephyr/arch/arm64/mm.h> 25 26 struct _callee_saved { 27 uint64_t x19; 28 uint64_t x20; 29 uint64_t x21; 30 uint64_t x22; 31 uint64_t x23; 32 uint64_t x24; 33 uint64_t x25; 34 uint64_t x26; 35 uint64_t x27; 36 uint64_t x28; 37 uint64_t x29; 38 uint64_t sp_el0; 39 uint64_t sp_elx; 40 uint64_t lr; 41 }; 42 43 typedef struct _callee_saved _callee_saved_t; 44 45 struct z_arm64_fp_context { 46 __int128 q0, q1, q2, q3, q4, q5, q6, q7; 47 __int128 q8, q9, q10, q11, q12, q13, q14, q15; 48 __int128 q16, q17, q18, q19, q20, q21, q22, q23; 49 __int128 q24, q25, q26, q27, q28, q29, q30, q31; 50 uint32_t fpsr, fpcr; 51 }; 52 53 struct _thread_arch { 54 #if defined(CONFIG_USERSPACE) || defined(CONFIG_ARM64_STACK_PROTECTION) 55 #if defined(CONFIG_ARM_MMU) 56 struct arm_mmu_ptables *ptables; 57 #endif 58 #if defined(CONFIG_ARM_MPU) 59 struct dynamic_region_info regions[ARM64_MPU_MAX_DYNAMIC_REGIONS]; 60 uint8_t region_num; 61 atomic_t flushing; 62 #endif 63 #endif 64 #ifdef CONFIG_ARM64_SAFE_EXCEPTION_STACK 65 uint64_t stack_limit; 66 #endif 67 #ifdef CONFIG_FPU_SHARING 68 struct z_arm64_fp_context saved_fp_context; 69 #endif 70 uint8_t exception_depth; 71 }; 72 73 typedef struct _thread_arch _thread_arch_t; 74 75 #endif /* _ASMLANGUAGE */ 76 77 #endif /* ZEPHYR_INCLUDE_ARCH_ARM64_THREAD_H_ */ 78