seL4/include/object/notification.h
Michael McInerney 771c9e43ce mcs: handle endpoint and ntfn queues uniformly
- Introduce functions to append and dequeue to/from endpoint and
  notification queues, in order to make verification feasible. Handle
  linked list manipulations with the same functions that were
  previously used for the ready and release queues, together with a new
  function that allows for a new item to be inserted into the queue
  after another item that is already in the queue.

- Remove tcbEPNext and tcbEPPrev pointers from the MCS version, and
  instead use tcbSchedNext and tcbSchedPrev pointers, given that no
  thread can be simultaneously in any two of the endpoint,
  notification, ready, or release queues.

Signed-off-by: Michael McInerney <michael.mcinerney@proofcraft.systems>
2026-05-22 11:42:19 +10:00

45 lines
1.5 KiB
C

/*
* Copyright 2014, General Dynamics C4 Systems
*
* SPDX-License-Identifier: GPL-2.0-only
*/
#pragma once
#include <types.h>
#include <object/structures.h>
void sendSignal(notification_t *ntfnPtr, word_t badge);
void receiveSignal(tcb_t *thread, cap_t cap, bool_t isBlocking);
void cancelAllSignals(notification_t *ntfnPtr);
void cancelSignal(tcb_t *threadPtr, notification_t *ntfnPtr);
void completeSignal(notification_t *ntfnPtr, tcb_t *tcb);
void unbindMaybeNotification(notification_t *ntfnPtr);
void unbindNotification(tcb_t *tcb);
void bindNotification(tcb_t *tcb, notification_t *ntfnPtr);
#ifdef CONFIG_KERNEL_MCS
void tcbNTFNAppend(tcb_t *thread, notification_t *ntfnPtr);
void tcbNTFNDequeue(tcb_t *thread, notification_t *ntfnPtr);
void reorderNTFN(notification_t *notification, tcb_t *thread);
static inline void maybeReturnSchedContext(notification_t *ntfnPtr, tcb_t *tcb)
{
sched_context_t *sc = SC_PTR(notification_ptr_get_ntfnSchedContext(ntfnPtr));
if (sc != NULL && sc == tcb->tcbSchedContext) {
tcb->tcbSchedContext = NULL;
sc->scTcb = NULL;
/* If the current thread returns its sched context then it should not
by default continue running. */
if (tcb == NODE_STATE(ksCurThread)) {
rescheduleRequired();
}
}
}
#endif
static inline void ntfn_set_active(notification_t *ntfnPtr, word_t badge)
{
notification_ptr_set_state(ntfnPtr, NtfnState_Active);
notification_ptr_set_ntfnMsgIdentifier(ntfnPtr, badge);
}