L4Re Operating System Framework
Interface and Usage Documentation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
arm_smccc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018, 2022, 2024 Kernkonzept GmbH.
3 * Author(s): Sarah Hoffmann <sarah.hoffmann@kernkonzept.com>
4 *
5 * License: see LICENSE.spdx (in this directory or the directories above)
6 */
11#pragma once
12
13#include <l4/sys/types.h>
14#include <l4/sys/utcb.h>
15
19 l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0,
20 l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3,
21 l4_umword_t client_id) L4_NOTHROW;
22
24l4_arm_smccc_call_u(l4_cap_idx_t pfc, l4_umword_t func, l4_umword_t in0,
26 l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0,
27 l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3,
28 l4_umword_t client_id, l4_utcb_t *utcb) L4_NOTHROW;
29
30/* IMPLEMENTATION -----------------------------------------------------------*/
31
32#include <l4/sys/ipc.h>
33
43 l4_umword_t in0, l4_umword_t in1,
44 l4_umword_t in2, l4_umword_t in3,
45 l4_umword_t in4, l4_umword_t in5,
46 l4_umword_t *out0, l4_umword_t *out1,
47 l4_umword_t *out2, l4_umword_t *out3,
48 l4_umword_t client_id) L4_NOTHROW
49{
50 return l4_arm_smccc_call_u(pfc, func, in0, in1, in2, in3, in4, in5,
51 out0, out1, out2, out3, client_id, l4_utcb());
52}
53
54
56l4_arm_smccc_call_u(l4_cap_idx_t pfc, l4_umword_t func, l4_umword_t in0,
58 l4_umword_t in4, l4_umword_t in5, l4_umword_t *out0,
59 l4_umword_t *out1, l4_umword_t *out2, l4_umword_t *out3,
60 l4_umword_t client_id, l4_utcb_t *utcb) L4_NOTHROW
61{
62 l4_msgtag_t ret;
63 l4_msg_regs_t *v = l4_utcb_mr_u(utcb);
64 v->mr[0] = func;
65 v->mr[1] = in0;
66 v->mr[2] = in1;
67 v->mr[3] = in2;
68 v->mr[4] = in3;
69 v->mr[5] = in4;
70 v->mr[6] = in5;
71 v->mr[7] = client_id;
72
73 ret = l4_ipc_call(pfc, utcb, l4_msgtag(L4_PROTO_SMCCC, 8, 0, 0),
75
76 if (l4_error(ret) >= 0)
77 {
78 *out0 = v->mr[0];
79 *out1 = v->mr[1];
80 *out2 = v->mr[2];
81 *out3 = v->mr[3];
82 }
83
84 return ret;
85}
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:42
unsigned long l4_umword_t
Unsigned machine word.
Definition l4int.h:40
unsigned long l4_cap_idx_t
Capability selector type.
Definition types.h:335
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:565
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:646
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:404
@ L4_PROTO_SMCCC
Protocol ID for ARM SMCCC calls.
Definition types.h:65
#define L4_IPC_NEVER
never timeout
Definition __timeout.h:76
struct l4_utcb_t l4_utcb_t
Opaque type for the UTCB.
Definition utcb.h:56
l4_utcb_t * l4_utcb(void) L4_NOTHROW L4_PURE
Get the UTCB address.
Definition utcb.h:346
#define L4_NOTHROW
Mark a function declaration and definition as never throwing an exception.
Definition compiler.h:159
#define L4_INLINE
L4 Inline function attribute.
Definition compiler.h:51
Common L4 ABI Data Types.
Message tag data structure.
Definition types.h:153
Encapsulation of the message-register block in the UTCB.
Definition utcb.h:68
l4_umword_t mr[L4_UTCB_GENERIC_DATA_SIZE]
Message registers.
Definition utcb.h:69