The RISC-V calling convention specifies that when a C function takes an argument by value, the binary function should take the argument by reference, if the value is larger than 2 pointer words. For binary verification, we avoid implementing this aspect of the RISC-V calling convention, by eliminating all such function arguments for functions which are not inlined. In this commit, we remove `extra_caps_t` function arguments. This primarily concerns invocation decode functions. Since `loookupExtraCaps` already stores extra caps in a global `current_extra_caps`, this essentially amounts to eliminating many redundant structure copy operations. On some execution paths involving IPC, the extra caps lookup may happen twice: first in the invocation decode, and then for cap transfer in the performance phase of the IPC operation. Because the two phases are entirely distinct, there is no interference in the use of a common global variable. Even though we are primarily concerned with RISC-V, we remove `extra_caps_t` arguments across all architectures. Signed-off-by: Matthew Brecknell <Matthew.Brecknell@data61.csiro.au>
72 lines
2.3 KiB
C
72 lines
2.3 KiB
C
/*
|
|
* Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-only
|
|
*/
|
|
#pragma once
|
|
|
|
#include <types.h>
|
|
#include <api/failures.h>
|
|
#include <object/structures.h>
|
|
|
|
exception_t decodeSchedContextInvocation(word_t label, cap_t cap, word_t *buffer);
|
|
|
|
/* Bind a tcb and a scheduling context. This allows a tcb to enter the scheduler.
|
|
* If the tcb is runnable, insert into scheduler
|
|
*
|
|
* @param sc the scheduling context to bind
|
|
* @param tcb the tcb to bind
|
|
*
|
|
* @pre the scheduling context must not already be bound to a tcb,
|
|
* tcb->tcbSchedContext == NULL && sc->scTcb == NULL
|
|
* @post tcb->tcbSchedContext == sc && sc->scTcb == tcb
|
|
*/
|
|
void schedContext_bindTCB(sched_context_t *sc, tcb_t *tcb);
|
|
|
|
/* Unbind a specific tcb from a scheduling context. If the tcb is runnable,
|
|
* remove from the scheduler.
|
|
*
|
|
* @param sc scheduling context to unbind
|
|
* @param tcb the tcb to unbind
|
|
*
|
|
* @pre the tcb is bound to the sc,
|
|
* (sc->scTcb == tcb && tcb->tcbSchedContext == sc);
|
|
* @post (tcb->tcbSchedContext == NULL && sc->scTcb == NULL)
|
|
*/
|
|
void schedContext_unbindTCB(sched_context_t *sc, tcb_t *tcb);
|
|
|
|
/*
|
|
* Unbind any tcb from a scheduling context. If the tcb bound to the scheduling
|
|
* context is runnable, remove from the scheduler.
|
|
*
|
|
* @param sc the scheduling context to unbind
|
|
* @post (sc->scTcb == NULL)
|
|
*/
|
|
void schedContext_unbindAllTCBs(sched_context_t *sc);
|
|
|
|
/*
|
|
* Resume a scheduling context. This will check if a the tcb bound to the scheduling context
|
|
* is runnable, if so, it will then check if the budget is due to be recharged and do so.
|
|
* If the scheduling context has insufficient budget the bound tcb is placed in the release queue.
|
|
*
|
|
* @pre (sc != NULL)
|
|
*/
|
|
void schedContext_resume(sched_context_t *sc);
|
|
|
|
/*
|
|
* Donate sc to tcb.
|
|
*
|
|
* @pre (sc != NULL && tcb != NULL)
|
|
* @post (sc->scTcb == tcb && tcb->tcbSchedContext == sc)
|
|
*/
|
|
void schedContext_donate(sched_context_t *sc, tcb_t *to);
|
|
|
|
/* Bind scheduling context to a notification */
|
|
void schedContext_bindNtfn(sched_context_t *sc, notification_t *ntfn);
|
|
/* unbind scheduling context from a notification */
|
|
void schedContext_unbindNtfn(sched_context_t *sc);
|
|
|
|
time_t schedContext_updateConsumed(sched_context_t *sc);
|
|
void schedContext_completeYieldTo(tcb_t *yielder);
|
|
void schedContext_cancelYieldTo(tcb_t *yielder);
|
|
|