1 /*
2  * Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #pragma once
8 
9 #include <types.h>
10 #include <api/failures.h>
11 #include <object/structures.h>
12 
13 /* Unlink a reply from its tcb */
reply_unlink(reply_t * reply,tcb_t * tcb)14 static inline void reply_unlink(reply_t *reply, tcb_t *tcb)
15 {
16     /* check the tcb and reply are linked correctly */
17     assert(reply->replyTCB == tcb);
18     assert(thread_state_get_replyObject(tcb->tcbState) == REPLY_REF(reply));
19 
20     thread_state_ptr_set_replyObject(&tcb->tcbState, REPLY_REF(0));
21     reply->replyTCB = NULL;
22     setThreadState(tcb, ThreadState_Inactive);
23 }
24 
25 /* Push a reply object onto the call stack */
26 void reply_push(tcb_t *tcb_caller, tcb_t *tcb_callee, reply_t *reply, bool_t canDonate);
27 /* Pop the head reply from the call stack */
28 void reply_pop(reply_t *reply, tcb_t *tcb);
29 /* Remove a reply from the call stack - replyTCB must be in ThreadState_BlockedOnReply */
30 void reply_remove(reply_t *reply, tcb_t *tcb);
31 /* Remove a specific tcb, and the reply it is blocking on, from the call stack */
32 void reply_remove_tcb(tcb_t *tcb);
33 
34