L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cache.h
Go to the documentation of this file.
1
9/*
10 * (c) 2007-2009 Author(s)
11 * economic rights: Technische Universität Dresden (Germany)
12 *
13 * License: see LICENSE.spdx (in this directory or the directories above)
14 */
15#ifndef __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__
16#define __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__
17
18#include <l4/sys/compiler.h>
19#include <l4/sys/syscall_defs.h>
20
21#include_next <l4/sys/cache.h>
22
26L4_INLINE void
27l4_cache_op_arm_call(unsigned long op,
28 unsigned long start,
29 unsigned long end);
30
31L4_INLINE void
32l4_cache_op_arm_call(unsigned long op,
33 unsigned long start,
34 unsigned long end)
35{
36 register unsigned long _op __asm__ ("r0") = op;
37 register unsigned long _start __asm__ ("r1") = start;
38 register unsigned long _end __asm__ ("r2") = end;
39
40 __asm__ __volatile__
41 ("@ l4_cache_op_arm_call(start) \n\t"
42 "mov r5, %[sc] \n\t"
43 "blx __l4_sys_syscall \n\t"
44 "@ l4_cache_op_arm_call(end) \n\t"
45 :
46 "=r" (_op),
47 "=r" (_start),
48 "=r" (_end)
49 :
50 [sc] "i" (L4_SYSCALL_MEM_OP),
51 "0" (_op),
52 "1" (_start),
53 "2" (_end)
54 :
55 "cc", "memory", "r5", "ip", "lr"
56 );
57}
58
59enum L4_mem_cache_ops
60{
61 L4_MEM_CACHE_OP_CLEAN_DATA = 0,
62 L4_MEM_CACHE_OP_FLUSH_DATA = 1,
63 L4_MEM_CACHE_OP_INV_DATA = 2,
64 L4_MEM_CACHE_OP_COHERENT = 3,
65 L4_MEM_CACHE_OP_DMA_COHERENT = 4,
66 L4_MEM_CACHE_OP_DMA_COHERENT_FULL = 5,
67};
68
69L4_INLINE int
70l4_cache_clean_data(unsigned long start,
71 unsigned long end) L4_NOTHROW
72{
73 l4_cache_op_arm_call(L4_MEM_CACHE_OP_CLEAN_DATA, start, end);
74 return 0;
75}
76
77L4_INLINE int
78l4_cache_flush_data(unsigned long start,
79 unsigned long end) L4_NOTHROW
80{
81 l4_cache_op_arm_call(L4_MEM_CACHE_OP_FLUSH_DATA, start, end);
82 return 0;
83}
84
85L4_INLINE int
86l4_cache_inv_data(unsigned long start,
87 unsigned long end) L4_NOTHROW
88{
89 l4_cache_op_arm_call(L4_MEM_CACHE_OP_INV_DATA, start, end);
90 return 0;
91}
92
93L4_INLINE int
94l4_cache_coherent(unsigned long start,
95 unsigned long end) L4_NOTHROW
96{
97 l4_cache_op_arm_call(L4_MEM_CACHE_OP_COHERENT, start, end);
98 return 0;
99}
100
101L4_INLINE int
102l4_cache_dma_coherent(unsigned long start,
103 unsigned long end) L4_NOTHROW
104{
105 l4_cache_op_arm_call(L4_MEM_CACHE_OP_DMA_COHERENT, start, end);
106 return 0;
107}
108
109L4_INLINE int
111{
112 l4_cache_op_arm_call(L4_MEM_CACHE_OP_DMA_COHERENT_FULL, 0, 0);
113 return 0;
114}
115
116#endif /* ! __L4SYS__INCLUDE__ARCH_ARM__CACHE_H__ */
L4 compiler related defines.
int l4_cache_dma_coherent(unsigned long start, unsigned long end) L4_NOTHROW
Make memory coherent for use with external memory; writes back to PoC.
Definition cache.h:49
int l4_cache_dma_coherent_full(void) L4_NOTHROW
Make memory coherent for use with external memory; writes back to PoC.
Definition cache.h:57
int l4_cache_flush_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache flush a range; writes back to PoC.
Definition cache.h:25
int l4_cache_coherent(unsigned long start, unsigned long end) L4_NOTHROW
Make memory coherent between I-cache and D-cache; writes back to PoU.
Definition cache.h:41
int l4_cache_clean_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache clean a range in D-cache; writes back to PoC.
Definition cache.h:17
int l4_cache_inv_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache invalidate a range; might write back to PoC.
Definition cache.h:33
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:159
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Syscall entry definitions.