L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
arm_smccc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018, 2022 Kernkonzept GmbH.
3 * Author(s): Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
4 *
5 * This file is distributed under the terms of the GNU General Public
6 * License, version 2. Please see the COPYING-GPL-2 file for details.
7 */
12#pragma once
13
14#include <l4/sys/types.h>
15#include <l4/sys/utcb.h>
16
20 l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0,
21 l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3,
22 l4_umword_t client_id) L4_NOTHROW;
23
25l4_arm_smccc_call_u(l4_cap_idx_t pfc, l4_umword_t func, l4_umword_t in0,
27 l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0,
28 l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3,
29 l4_umword_t client_id, l4_utcb_t *utcb) L4_NOTHROW;
30
31/* IMPLEMENTATION -----------------------------------------------------------*/
32
33#include <l4/sys/ipc.h>
34
44 l4_umword_t in0, l4_umword_t in1,
45 l4_umword_t in2, l4_umword_t in3,
46 l4_umword_t in4, l4_umword_t in5,
47 l4_umword_t *out0, l4_umword_t *out1,
48 l4_umword_t *out2, l4_umword_t *out3,
49 l4_umword_t client_id) L4_NOTHROW
50{
51 return l4_arm_smccc_call_u(pfc, func, in0, in1, in2, in3, in4, in5,
52 out0, out1, out2, out3, client_id, l4_utcb());
53}
54
55
57l4_arm_smccc_call_u(l4_cap_idx_t pfc, l4_umword_t func, l4_umword_t in0,
59 l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0,
60 l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3,
61 l4_umword_t client_id, l4_utcb_t *utcb) L4_NOTHROW
62{
63 l4_msgtag_t ret;
64 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
65 v->mr[0] = func;
66 v->mr[1] = in0;
67 v->mr[2] = in1;
68 v->mr[3] = in2;
69 v->mr[4] = in3;
70 v->mr[5] = in4;
71 v->mr[6] = in5;
72 v->mr[7] = client_id;
73
74 ret = l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_SMCCC, 8, 0, 0),
76
77 if (l4_error(ret) >= 0)
78 {
79 *out0 = v->mr[0];
80 *out1 = v->mr[1];
81 *out2 = v->mr[2];
82 *out3 = v->mr[3];
83 }
84
85 return ret;
86}
l4_msgtag_t l4_arm_smccc_call(l4_cap_idx_t pfc, l4_umword_t func, l4_umword_t in0, l4_umword_t in1, l4_umword_t in2, l4_umword_t in3, l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0, l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3, l4_umword_t client_id) L4_NOTHROW
C interface for calling the ARM secure monitor, see L4::Arm_smccc::call() for the C++ interface.
Definition arm_smccc.h:43
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:51
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:358
l4_msgtag_t l4_ipc_call(l4_cap_idx_t object, l4_utcb_t *utcb, l4_msgtag_t tag, l4_timeout_t timeout) L4_NOTHROW
Object call (usual invocation).
Definition ipc.h:550
long l4_error(l4_msgtag_t tag) L4_NOTHROW
Get IPC error code if any or message tag label otherwise for an IPC call.
Definition ipc.h:636
l4_msgtag_t l4_msgtag(long label, unsigned words, unsigned items, unsigned flags) L4_NOTHROW
Create a message tag from the specified values.
Definition types.h:427
@ L4_PROTO_SMCCC
Protocol ID for ARM SMCCC calls.
Definition types.h:76
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:82
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:67
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:340
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:188
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:62
Common L4 ABI Data Types.
Message tag data structure.
Definition types.h:163
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:79
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:80