1 /* 2 * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230) 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7 #pragma once 8 #include <autoconf.h> 9 10 /** 11 * @defgroup GeneralSystemCalls System Calls (non-MCS) 12 * @{ 13 */ 14 15 /** 16 * @xmlonly <manual name="Send" label="sel4_send"/> @endxmlonly 17 * @brief Send to a capability 18 * 19 * @xmlonly 20 * <docref>See <autoref label="sec:sys_send"/></docref> 21 * @endxmlonly 22 * 23 * @param[in] dest The capability to be invoked. 24 * @param[in] msgInfo The messageinfo structure for the IPC. 25 */ 26 LIBSEL4_INLINE_FUNC void 27 seL4_Send(seL4_CPtr dest, seL4_MessageInfo_t msgInfo); 28 29 /** 30 * @xmlonly <manual name="Recv" label="sel4_recv"/> @endxmlonly 31 * @brief Block until a message is received on an endpoint 32 * 33 * @xmlonly 34 * <docref>See <autoref label="sec:sys_recv"/></docref> 35 * @endxmlonly 36 * 37 * @param[in] src The capability to be invoked. 38 * @param[out] sender The address to write sender information to. 39 * The sender information is the badge of the 40 * endpoint capability that was invoked by the 41 * sender, or the notification word of the 42 * notification object that was signalled. 43 * This parameter is ignored if `NULL`. 44 * 45 * @return A `seL4_MessageInfo_t` structure 46 * @xmlonly 47 * <docref>as described in <autoref label="sec:messageinfo"/></docref> 48 * @endxmlonly 49 */ 50 LIBSEL4_INLINE_FUNC seL4_MessageInfo_t 51 seL4_Recv(seL4_CPtr src, seL4_Word *sender); 52 53 /** 54 * @xmlonly <manual name="Call" label="sel4_call"/> @endxmlonly 55 * @brief Call a capability 56 * 57 * @xmlonly 58 * <docref>See <autoref label="sec:sys_call"/></docref> 59 * @endxmlonly 60 * 61 * @param[in] dest The capability to be invoked. 62 * @param[in] msgInfo The messageinfo structure for the IPC. 63 * 64 * @return A `seL4_MessageInfo_t` structure 65 * @xmlonly 66 * <docref>as described in <autoref label="sec:messageinfo"/></docref> 67 * @endxmlonly 68 */ 69 LIBSEL4_INLINE_FUNC seL4_MessageInfo_t 70 seL4_Call(seL4_CPtr dest, seL4_MessageInfo_t msgInfo); 71 72 /** 73 * @xmlonly <manual name="Reply" label="sel4_reply"/> @endxmlonly 74 * @brief Perform a send to a one-off reply capability stored when 75 * the thread was last called 76 * 77 * @xmlonly 78 * <docref>See <autoref label="sec:sys_reply"/></docref> 79 * @endxmlonly 80 * 81 * @param[in] msgInfo The messageinfo structure for the IPC. 82 */ 83 LIBSEL4_INLINE_FUNC void 84 seL4_Reply(seL4_MessageInfo_t msgInfo); 85 86 /** 87 * @xmlonly <manual name="Non-Blocking Send" label="sel4_nbsend"/> @endxmlonly 88 * @brief Perform a non-blocking send to a capability 89 * 90 * @xmlonly 91 * <docref>See <autoref label="sec:sys_nbsend"/></docref> 92 * @endxmlonly 93 * 94 * @param[in] dest The capability to be invoked. 95 * @param[in] msgInfo The messageinfo structure for the IPC. 96 */ 97 LIBSEL4_INLINE_FUNC void 98 seL4_NBSend(seL4_CPtr dest, seL4_MessageInfo_t msgInfo); 99 100 /** 101 * @xmlonly <manual name="Reply Recv" label="sel4_replyrecv"/> @endxmlonly 102 * @brief Perform a reply followed by a receive in one system call 103 * 104 * @xmlonly 105 * <docref>See <autoref label="sec:sys_replyrecv"/></docref> 106 * @endxmlonly 107 * 108 * @param[in] dest The capability to be invoked. 109 * @param[in] msgInfo The messageinfo structure for the IPC. 110 * @param[out] sender The address to write sender information to. 111 * The sender information is the badge of the 112 * endpoint capability that was invoked by the 113 * sender, or the notification word of the 114 * notification object that was signalled. 115 * This parameter is ignored if `NULL`. 116 * 117 * @return A `seL4_MessageInfo_t` structure 118 * @xmlonly 119 * <docref>as described in <autoref label="sec:messageinfo"/></docref> 120 * @endxmlonly 121 */ 122 LIBSEL4_INLINE_FUNC seL4_MessageInfo_t 123 seL4_ReplyRecv(seL4_CPtr dest, seL4_MessageInfo_t msgInfo, seL4_Word *sender); 124 125 /** 126 * @xmlonly <manual name="NBRecv" label="sel4_nbrecv"/> @endxmlonly 127 * @brief Receive a message from an endpoint but do not block 128 * in the case that no messages are pending 129 * 130 * @xmlonly 131 * <docref>See <autoref label="sec:sys_nbrecv"/></docref> 132 * @endxmlonly 133 * 134 * @param[in] src The capability to be invoked. 135 * @param[out] sender The address to write sender information to. 136 * The sender information is the badge of the 137 * endpoint capability that was invoked by the 138 * sender, or the notification word of the 139 * notification object that was signalled. 140 * This parameter is ignored if `NULL`. 141 * 142 * @return A `seL4_MessageInfo_t` structure 143 * @xmlonly 144 * <docref>as described in <autoref label="sec:messageinfo"/></docref> 145 * @endxmlonly 146 */ 147 LIBSEL4_INLINE_FUNC seL4_MessageInfo_t 148 seL4_NBRecv(seL4_CPtr src, seL4_Word *sender); 149 150 /** 151 * @xmlonly <manual name="Yield" label="sel4_yield"/> @endxmlonly 152 * @brief Donate the remaining timeslice to a thread of the same priority 153 * 154 * @xmlonly 155 * <docref>See <autoref label="sec:sys_yield"/></docref> 156 * @endxmlonly 157 */ 158 LIBSEL4_INLINE_FUNC void 159 seL4_Yield(void); 160 161 /** 162 * @xmlonly <manual name="Signal" label="sel4_signal"/> @endxmlonly 163 * @brief Signal a notification 164 * 165 * This is not a proper system call known by the kernel. Rather, it is a 166 * convenience wrapper which calls seL4_Send(). 167 * It is useful for signalling a notification. 168 * 169 * @xmlonly 170 * <docref>See the description of <nameref name="seL4_Send"/> in <autoref label="sec:sys_send"/>.</docref> 171 * @endxmlonly 172 * 173 * @param[in] dest The capability to be invoked. 174 */ 175 LIBSEL4_INLINE_FUNC void 176 seL4_Signal(seL4_CPtr dest); 177 178 /** 179 * @xmlonly <manual name="Wait" label="sel4_wait"/> @endxmlonly 180 * @brief Perform a receive on a notification object 181 * 182 * This is not a proper system call known by the kernel. Rather, it is a 183 * convenience wrapper which calls seL4_Recv(). 184 * 185 * @xmlonly 186 * <docref>See the description of <nameref name="seL4_Recv"/> in <autoref label="sec:sys_recv"/>.</docref> 187 * @endxmlonly 188 * 189 * @param[in] src The capability to be invoked. 190 * @param[out] sender The address to write sender information to. 191 * The sender information is the badge of the 192 * endpoint capability that was invoked by the 193 * sender, or the notification word of the 194 * notification object that was signalled. 195 * This parameter is ignored if `NULL`. 196 */ 197 LIBSEL4_INLINE_FUNC void 198 seL4_Wait(seL4_CPtr src, seL4_Word *sender); 199 200 /** 201 * @xmlonly <manual name="Poll" label="sel4_poll"/> @endxmlonly 202 * @brief Perform a non-blocking recv on a notification object 203 * 204 * This is not a proper system call known by the kernel. Rather, it is a 205 * convenience wrapper which calls seL4_NBRecv(). 206 * It is useful for doing a non-blocking wait on a notification. 207 * 208 * @xmlonly 209 * <docref>See the description of <nameref name="seL4_NBRecv"/> in <autoref label="sec:sys_nbrecv"/>.</docref> 210 * @endxmlonly 211 * 212 * @param[in] src The capability to be invoked. 213 * @param[out] sender The address to write sender information to. 214 * The sender information is the badge of the 215 * endpoint capability that was invoked by the 216 * sender, or the notification word of the 217 * notification object that was signalled. 218 * This parameter is ignored if `NULL`. 219 * 220 * @return A `seL4_MessageInfo_t` structure 221 * @xmlonly 222 * <docref>as described in <autoref label="sec:messageinfo"/></docref> 223 * @endxmlonly 224 */ 225 LIBSEL4_INLINE_FUNC seL4_MessageInfo_t 226 seL4_Poll(seL4_CPtr src, seL4_Word *sender); 227 228 /** @} */ 229 230