3 * \brief Memory access functions (ARM specific)
6 * \author Adam Lackorzynski <adam@os.inf.tu-dresden.de>
11 * economic rights: Technische Universität Dresden (Germany)
13 * This file is part of TUD:OS and distributed under the terms of the
14 * GNU General Public License 2.
15 * Please see the COPYING-GPL-2 file for details.
17 * As a special exception, you may use this file as part of a free software
18 * library without restriction. Specifically, if other files instantiate
19 * templates or use macros or inline functions from this file, or you compile
20 * this file and link it with other files to produce an executable, this
21 * file does not by itself cause the resulting executable to be covered by
22 * the GNU General Public License. This exception does not however
23 * invalidate any other reasons why the executable file might be covered by
24 * the GNU General Public License.
26 #ifndef __L4SYS__INCLUDE__ARCH_ARM__MEM_OP_H__
27 #define __L4SYS__INCLUDE__ARCH_ARM__MEM_OP_H__
29 #include <l4/sys/compiler.h>
30 #include <l4/sys/syscall_defs.h>
33 * \brief Read memory from kernel privilege level.
34 * \param virtaddress Virtual address in the calling task.
35 * \param width Width of access in bytes in log2
36 * (i.e. allowed values: 0, 1, 2)
39 * Upon an given invalid address or invalid width value the function does
42 L4_INLINE unsigned long
43 l4_mem_read(unsigned long virtaddress, unsigned width);
46 * \brief Write memory from kernel privilege level.
47 * \param virtaddress Virtual address in the calling task.
48 * \param width Width of access in bytes in log2
49 * (i.e. allowed values: 0, 1, 2)
50 * \param value Value to write.
52 * Upon an given invalid address or invalid width value the function does
56 l4_mem_write(unsigned long virtaddress, unsigned width,
61 L4_MEM_OP_MEM_READ = 0x10,
62 L4_MEM_OP_MEM_WRITE = 0x11,
68 L4_INLINE unsigned long
69 l4_mem_arm_op_call(unsigned long op,
74 /** Implementations */
76 L4_INLINE unsigned long
77 l4_mem_arm_op_call(unsigned long op,
82 register unsigned long _op asm ("r0") = op;
83 register unsigned long _va asm ("r1") = va;
84 register unsigned long _width asm ("r2") = width;
85 register unsigned long _value asm ("r3") = value;
88 ("@ l4_cache_op_arm_call(start) \n\t"
91 "@ l4_cache_op_arm_call(end) \n\t"
98 [sc] "i" (L4_SYSCALL_MEM_OP),
110 L4_INLINE unsigned long
111 l4_mem_read(unsigned long virtaddress, unsigned width)
113 return l4_mem_arm_op_call(L4_MEM_OP_MEM_READ, virtaddress, width, 0);
117 l4_mem_write(unsigned long virtaddress, unsigned width,
120 l4_mem_arm_op_call(L4_MEM_OP_MEM_WRITE, virtaddress, width, value);
123 #endif /* ! __L4SYS__INCLUDE__ARCH_ARM__MEM_OP_H__ */