1 /* Copyright (c) 2022 Intel Corporation 2 * SPDX-License-Identifier: Apache-2.0 3 */ 4 5 6 #ifndef ZEPHYR_SOC_INTEL_ADSP_DEBUG_HELPERS_H_ 7 #define ZEPHYR_SOC_INTEL_ADSP_DEBUG_HELPERS_H_ 8 9 #include <adsp_memory.h> 10 #include <zephyr/linker/linker-defs.h> 11 12 extern char _imr_start[]; 13 extern char _imr_end[]; 14 extern char _end[]; 15 extern char _heap_sentry[]; 16 extern char _cached_start[]; 17 extern char _cached_end[]; 18 intel_adsp_ptr_executable(const void * p)19static inline bool intel_adsp_ptr_executable(const void *p) 20 { 21 return (p >= (void *)__text_region_start && p <= (void *)__text_region_end) || 22 (p >= (void *)_imr_start && p <= (void *)_imr_end); 23 } 24 intel_adsp_ptr_is_sane(uint32_t sp)25static inline bool intel_adsp_ptr_is_sane(uint32_t sp) 26 { 27 return ((char *)sp >= _end && (char *)sp <= _heap_sentry) || 28 ((char *)sp >= _cached_start && (char *)sp <= _cached_end) || 29 (sp >= (IMR_BOOT_LDR_MANIFEST_BASE - CONFIG_ISR_STACK_SIZE) 30 && sp <= IMR_BOOT_LDR_MANIFEST_BASE); 31 } 32 33 34 #endif /* ZEPHYR_SOC_INTEL_ADSP_DEBUG_HELPERS_H_ */ 35