paul@181 | 1 | /* |
paul@181 | 2 | * Interprocess communication abstractions. |
paul@181 | 3 | * |
paul@181 | 4 | * Copyright (C) 2018, 2019 Paul Boddie <paul@boddie.org.uk> |
paul@181 | 5 | * |
paul@181 | 6 | * This program is free software; you can redistribute it and/or |
paul@181 | 7 | * modify it under the terms of the GNU General Public License as |
paul@181 | 8 | * published by the Free Software Foundation; either version 2 of |
paul@181 | 9 | * the License, or (at your option) any later version. |
paul@181 | 10 | * |
paul@181 | 11 | * This program is distributed in the hope that it will be useful, |
paul@181 | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
paul@181 | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
paul@181 | 14 | * GNU General Public License for more details. |
paul@181 | 15 | * |
paul@181 | 16 | * You should have received a copy of the GNU General Public License |
paul@181 | 17 | * along with this program; if not, write to the Free Software |
paul@181 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, |
paul@181 | 19 | * Boston, MA 02110-1301, USA |
paul@181 | 20 | */ |
paul@181 | 21 | |
paul@181 | 22 | #include <l4/sys/utcb.h> |
paul@181 | 23 | |
paul@181 | 24 | #include "direct.h" |
paul@181 | 25 | #include "util_ipc.h" |
paul@181 | 26 | |
paul@181 | 27 | |
paul@181 | 28 | |
paul@181 | 29 | /* Direct operations. */ |
paul@181 | 30 | |
paul@181 | 31 | /* Reserve the given number of slots from zero for incoming capabilities. */ |
paul@181 | 32 | |
paul@181 | 33 | long ipc_expect_capabilities(int number) |
paul@181 | 34 | { |
paul@181 | 35 | return _expect_capabilities(l4_utcb_br(), number); |
paul@181 | 36 | } |
paul@181 | 37 | |
paul@181 | 38 | /* Reserve a slot for an incoming capability. */ |
paul@181 | 39 | |
paul@181 | 40 | long ipc_expect_capability(int item) |
paul@181 | 41 | { |
paul@181 | 42 | return _expect_capability(l4_utcb_br(), item); |
paul@181 | 43 | } |
paul@181 | 44 | |
paul@181 | 45 | /* Export a capability at the given position in the message. */ |
paul@181 | 46 | |
paul@181 | 47 | void ipc_export_capability(l4_msgtag_t tag, int item, l4_cap_idx_t ref) |
paul@181 | 48 | { |
paul@181 | 49 | _export_capability(tag, l4_utcb_mr(), item, ref); |
paul@181 | 50 | } |
paul@181 | 51 | |
paul@181 | 52 | /* Import the capability at the given item position, updating the buffer |
paul@181 | 53 | registers for future capabilities. */ |
paul@181 | 54 | |
paul@181 | 55 | long ipc_import_capability(l4_msgtag_t tag, int item, l4_cap_idx_t *ref) |
paul@181 | 56 | { |
paul@181 | 57 | return _import_capability(tag, l4_utcb_br(), l4_utcb_mr(), item, ref); |
paul@181 | 58 | } |
paul@181 | 59 | |
paul@181 | 60 | /* Import a dataspace, mapping it to an address, updating the buffer registers |
paul@181 | 61 | for future capabilities. */ |
paul@181 | 62 | |
paul@181 | 63 | long ipc_import_dataspace(l4_msgtag_t tag, int item, l4re_ds_t *mem, l4_addr_t *addr) |
paul@181 | 64 | { |
paul@181 | 65 | return _import_dataspace(tag, l4_utcb_br(), l4_utcb_mr(), item, mem, addr); |
paul@181 | 66 | } |