1 /* 2 * Copyright (c) 2008-2014 Travis Geiselbrecht 3 * 4 * Use of this source code is governed by a MIT-style 5 * license that can be found in the LICENSE file or at 6 * https://opensource.org/licenses/MIT 7 */ 8 #pragma once 9 10 #ifndef ASSEMBLY 11 12 #include <sys/types.h> 13 #include <stddef.h> 14 #include <stdbool.h> 15 #include <lk/compiler.h> 16 17 __BEGIN_CDECLS 18 19 /* fast routines that most arches will implement inline */ 20 static void arch_enable_ints(void); 21 static void arch_disable_ints(void); 22 static bool arch_ints_disabled(void); 23 static bool arch_in_int_handler(void); 24 25 static ulong arch_cycle_count(void); 26 27 static uint arch_curr_cpu_num(void); 28 29 /* Use to align structures on cache lines to avoid cpu aliasing. */ 30 #define __CPU_ALIGN __ALIGNED(CACHE_LINE) 31 32 void arch_disable_cache(uint flags); 33 void arch_enable_cache(uint flags); 34 35 void arch_clean_cache_range(addr_t start, size_t len); 36 void arch_clean_invalidate_cache_range(addr_t start, size_t len); 37 void arch_invalidate_cache_range(addr_t start, size_t len); 38 void arch_sync_cache_range(addr_t start, size_t len); 39 40 void arch_idle(void); 41 42 __END_CDECLS 43 44 #endif // !ASSEMBLY 45 46 /* for the above arch enable/disable routines */ 47 #define ARCH_CACHE_FLAG_ICACHE 1 48 #define ARCH_CACHE_FLAG_DCACHE 2 49 #define ARCH_CACHE_FLAG_UCACHE (ARCH_CACHE_FLAG_ICACHE|ARCH_CACHE_FLAG_DCACHE) 50 51 #include <arch/arch_ops.h> 52 53