L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
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
24L4_INLINE void
25l4_cache_op_arm_call(unsigned long op,
26 unsigned long start,
27 unsigned long end);
28
29L4_INLINE void
30l4_cache_op_arm_call(unsigned long op,
31 unsigned long start,
32 unsigned long end)
33{
34 register unsigned long _op __asm__ ("r0") = op;
35 register unsigned long _start __asm__ ("r1") = start;
36 register unsigned long _end __asm__ ("r2") = end;
37
38 __asm__ __volatile__
39 ("@ l4_cache_op_arm_call(start) \n\t"
40 "mov r5, %[sc] \n\t"
41 "blx __l4_sys_syscall \n\t"
42 "@ l4_cache_op_arm_call(end) \n\t"
43 :
44 "=r" (_op),
45 "=r" (_start),
46 "=r" (_end)
47 :
48 [sc] "i" (L4_SYSCALL_MEM_OP),
49 "0" (_op),
50 "1" (_start),
51 "2" (_end)
52 :
53 "cc", "memory", "r5", "ip", "lr"
54 );
55}
56
57enum L4_mem_cache_ops
58{
59 L4_MEM_CACHE_OP_CLEAN_DATA = 0,
60 L4_MEM_CACHE_OP_FLUSH_DATA = 1,
61 L4_MEM_CACHE_OP_INV_DATA = 2,
62 L4_MEM_CACHE_OP_COHERENT = 3,
63 L4_MEM_CACHE_OP_DMA_COHERENT = 4,
64 L4_MEM_CACHE_OP_DMA_COHERENT_FULL = 5,
65};
66
67L4_INLINE int
68l4_cache_clean_data(unsigned long start,
69 unsigned long end) L4_NOTHROW
70{
71 l4_cache_op_arm_call(L4_MEM_CACHE_OP_CLEAN_DATA, start, end);
72 return 0;
73}
74
75L4_INLINE int
76l4_cache_flush_data(unsigned long start,
77 unsigned long end) L4_NOTHROW
78{
79 l4_cache_op_arm_call(L4_MEM_CACHE_OP_FLUSH_DATA, start, end);
80 return 0;
81}
82
83L4_INLINE int
84l4_cache_inv_data(unsigned long start,
85 unsigned long end) L4_NOTHROW
86{
87 l4_cache_op_arm_call(L4_MEM_CACHE_OP_INV_DATA, start, end);
88 return 0;
89}
90
91L4_INLINE int
92l4_cache_coherent(unsigned long start,
93 unsigned long end) L4_NOTHROW
94{
95 l4_cache_op_arm_call(L4_MEM_CACHE_OP_COHERENT, start, end);
96 return 0;
97}
98
99L4_INLINE int
100l4_cache_dma_coherent(unsigned long start,
101 unsigned long end) L4_NOTHROW
102{
103 l4_cache_op_arm_call(L4_MEM_CACHE_OP_DMA_COHERENT, start, end);
104 return 0;
105}
106
107L4_INLINE int
109{
110 l4_cache_op_arm_call(L4_MEM_CACHE_OP_DMA_COHERENT_FULL, 0, 0);
111 return 0;
112}
113
114#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:47
int l4_cache_dma_coherent_full(void) L4_NOTHROW
Make memory coherent for use with external memory; writes back to PoC.
Definition cache.h:55
int l4_cache_flush_data(unsigned long start, unsigned long end) L4_NOTHROW
Cache flush a range; writes back to PoC.
Definition cache.h:23
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:39
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:15
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:31
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:161
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Syscall entry definitions.