L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mem_op.h
Go to the documentation of this file.
1
9/*
10 * (c) 2010 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__MEM_OP_H__
16#define __L4SYS__INCLUDE__ARCH_ARM__MEM_OP_H__
17
18#include <l4/sys/compiler.h>
19#include <l4/sys/syscall_defs.h>
20
22
46
59L4_INLINE unsigned long
60l4_mem_read(unsigned long virtaddress, unsigned width);
61
74L4_INLINE void
75l4_mem_write(unsigned long virtaddress, unsigned width,
76 unsigned long value);
77
78enum L4_mem_ops
79{
80 L4_MEM_OP_MEM_READ = 0x10,
81 L4_MEM_OP_MEM_WRITE = 0x11,
82};
83
87L4_INLINE unsigned long
88l4_mem_arm_op_call(unsigned long op,
89 unsigned long va,
90 unsigned long width,
91 unsigned long value);
92
95L4_INLINE unsigned long
96l4_mem_arm_op_call(unsigned long op,
97 unsigned long va,
98 unsigned long width,
99 unsigned long value)
100{
101 register unsigned long _op __asm__ ("r0") = op;
102 register unsigned long _va __asm__ ("r1") = va;
103 register unsigned long _width __asm__ ("r2") = width;
104 register unsigned long _value __asm__ ("r3") = value;
105
106 __asm__ __volatile__
107 ("@ l4_cache_op_arm_call(start) \n\t"
108 "mov r5, %[sc] \n\t"
109 "blx __l4_sys_syscall \n\t"
110 "@ l4_cache_op_arm_call(end) \n\t"
111 :
112 "=r" (_op),
113 "=r" (_va),
114 "=r" (_width),
115 "=r" (_value)
116 :
117 [sc] "i" (L4_SYSCALL_MEM_OP),
118 "0" (_op),
119 "1" (_va),
120 "2" (_width),
121 "3" (_value)
122 :
123 "cc", "memory", "r5", "ip", "lr"
124 );
125
126 return _value;
127}
128
129L4_INLINE unsigned long
130l4_mem_read(unsigned long virtaddress, unsigned width)
131{
132 return l4_mem_arm_op_call(L4_MEM_OP_MEM_READ, virtaddress, width, 0);
133}
134
135L4_INLINE void
136l4_mem_write(unsigned long virtaddress, unsigned width,
137 unsigned long value)
138{
139 l4_mem_arm_op_call(L4_MEM_OP_MEM_WRITE, virtaddress, width, value);
140}
141
143
144#endif /* ! __L4SYS__INCLUDE__ARCH_ARM__MEM_OP_H__ */
L4 compiler related defines.
void l4_mem_write(unsigned long virtaddress, unsigned width, unsigned long value)
Write user task memory from kernel privilege level.
Definition mem_op.h:136
unsigned long l4_mem_read(unsigned long virtaddress, unsigned width)
Read user task memory from kernel privilege level.
Definition mem_op.h:130
L4_mem_op_widths
Memory access width definitions.
Definition mem_op.h:41
@ L4_MEM_WIDTH_4BYTE
Access four bytes (32-bit width)
Definition mem_op.h:44
@ L4_MEM_WIDTH_2BYTE
Access two bytes (16-bit width)
Definition mem_op.h:43
@ L4_MEM_WIDTH_1BYTE
Access one byte (8-bit width)
Definition mem_op.h:42
#define __END_DECLS
End section with C types and functions.
Definition compiler.h:167
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
#define __BEGIN_DECLS
Start section with C types and functions.
Definition compiler.h:164
unsigned long l4_mem_arm_op_call(unsigned long op, unsigned long va, unsigned long width, unsigned long value)
Implementations.
Definition mem_op.h:96
Syscall entry definitions.