L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
asm_access.h
1
/* SPDX-License-Identifier: GPL-2.0-only or License-Ref-kk-custom */
2
/*
3
* Copyright (C) 2021 Kernkonzept GmbH.
4
* Author(s): Jakub Jermar <jakub.jermar@kernkonzept.com>
5
*/
6
7
#pragma once
8
9
#include <l4/sys/l4int.h>
10
11
namespace
Asm_access {
12
13
inline
14
l4_uint8_t
15
read(
l4_uint8_t
const
*mem)
16
{
17
l4_uint8_t
val;
18
19
asm
volatile
(
"movb %[mem], %[val]"
: [val]
"=q"
(val) : [mem]
"m"
(*mem));
20
21
return
val;
22
}
23
24
inline
25
l4_uint16_t
26
read(
l4_uint16_t
const
*mem)
27
{
28
l4_uint16_t
val;
29
30
asm
volatile
(
"movw %[mem], %[val]"
: [val]
"=r"
(val) : [mem]
"m"
(*mem));
31
32
return
val;
33
}
34
35
inline
36
l4_uint32_t
37
read(
l4_uint32_t
const
*mem)
38
{
39
l4_uint32_t
val;
40
41
asm
volatile
(
"movl %[mem], %[val]"
: [val]
"=r"
(val) : [mem]
"m"
(*mem));
42
43
return
val;
44
}
45
46
inline
47
void
48
write(
l4_uint8_t
val,
l4_uint8_t
*mem)
49
{
50
asm
volatile
(
"movb %[val], %[mem]"
:[mem]
"=m"
(*mem) : [val]
"qi"
(val));
51
}
52
53
inline
54
void
55
write(
l4_uint16_t
val,
l4_uint16_t
*mem)
56
{
57
asm
volatile
(
"movw %[val], %[mem]"
: [mem]
"=m"
(*mem) : [val]
"ri"
(val));
58
}
59
60
inline
61
void
62
write(
l4_uint32_t
val,
l4_uint32_t
*mem)
63
{
64
asm
volatile
(
"movl %[val], %[mem]"
: [mem]
"=m"
(*mem) : [val]
"ri"
(val));
65
}
66
67
}
l4_uint8_t
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition
l4int.h:36
l4_uint32_t
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition
l4int.h:40
l4_uint16_t
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition
l4int.h:38
pkg
drivers-frst
include
ARCH-x86
asm_access.h
Generated on Sat Aug 24 2024 16:07:21 for L4Re Operating System Framework by
1.9.8