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 #endif // !ASSEMBLY
33 #define ICACHE 1
34 #define DCACHE 2
35 #define UCACHE (ICACHE|DCACHE)
36 #ifndef ASSEMBLY
37 
38 void arch_disable_cache(uint flags);
39 void arch_enable_cache(uint flags);
40 
41 void arch_clean_cache_range(addr_t start, size_t len);
42 void arch_clean_invalidate_cache_range(addr_t start, size_t len);
43 void arch_invalidate_cache_range(addr_t start, size_t len);
44 void arch_sync_cache_range(addr_t start, size_t len);
45 
46 void arch_idle(void);
47 
48 __END_CDECLS
49 
50 #endif // !ASSEMBLY
51 
52 #include <arch/arch_ops.h>
53 
54