1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/libipc/lib/src/direct.c Wed Aug 25 01:28:08 2021 +0200
1.3 @@ -0,0 +1,66 @@
1.4 +/*
1.5 + * Interprocess communication abstractions.
1.6 + *
1.7 + * Copyright (C) 2018, 2019 Paul Boddie <paul@boddie.org.uk>
1.8 + *
1.9 + * This program is free software; you can redistribute it and/or
1.10 + * modify it under the terms of the GNU General Public License as
1.11 + * published by the Free Software Foundation; either version 2 of
1.12 + * the License, or (at your option) any later version.
1.13 + *
1.14 + * This program is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + * GNU General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU General Public License
1.20 + * along with this program; if not, write to the Free Software
1.21 + * Foundation, Inc., 51 Franklin Street, Fifth Floor,
1.22 + * Boston, MA 02110-1301, USA
1.23 + */
1.24 +
1.25 +#include <l4/sys/utcb.h>
1.26 +
1.27 +#include "direct.h"
1.28 +#include "util_ipc.h"
1.29 +
1.30 +
1.31 +
1.32 +/* Direct operations. */
1.33 +
1.34 +/* Reserve the given number of slots from zero for incoming capabilities. */
1.35 +
1.36 +long ipc_expect_capabilities(int number)
1.37 +{
1.38 + return _expect_capabilities(l4_utcb_br(), number);
1.39 +}
1.40 +
1.41 +/* Reserve a slot for an incoming capability. */
1.42 +
1.43 +long ipc_expect_capability(int item)
1.44 +{
1.45 + return _expect_capability(l4_utcb_br(), item);
1.46 +}
1.47 +
1.48 +/* Export a capability at the given position in the message. */
1.49 +
1.50 +void ipc_export_capability(l4_msgtag_t tag, int item, l4_cap_idx_t ref)
1.51 +{
1.52 + _export_capability(tag, l4_utcb_mr(), item, ref);
1.53 +}
1.54 +
1.55 +/* Import the capability at the given item position, updating the buffer
1.56 + registers for future capabilities. */
1.57 +
1.58 +long ipc_import_capability(l4_msgtag_t tag, int item, l4_cap_idx_t *ref)
1.59 +{
1.60 + return _import_capability(tag, l4_utcb_br(), l4_utcb_mr(), item, ref);
1.61 +}
1.62 +
1.63 +/* Import a dataspace, mapping it to an address, updating the buffer registers
1.64 + for future capabilities. */
1.65 +
1.66 +long ipc_import_dataspace(l4_msgtag_t tag, int item, l4re_ds_t *mem, l4_addr_t *addr)
1.67 +{
1.68 + return _import_dataspace(tag, l4_utcb_br(), l4_utcb_mr(), item, mem, addr);
1.69 +}