1 /*
2  * Copyright 2014, General Dynamics C4 Systems
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #pragma once
8 
9 #include <config.h>
10 #include <types.h>
11 #include <api/failures.h>
12 #include <api/types.h>
13 #include <object/structures.h>
14 #include <object/cnode.h>
15 
16 /* It is assumed that every untyped is within seL4_MinUntypedBits and seL4_MaxUntypedBits
17  * (inclusive). This means that every untyped stored as seL4_MinUntypedBits
18  * subtracted from its size before it is stored in capBlockSize, and
19  * capFreeIndex counts in chunks of size 2^seL4_MinUntypedBits. The seL4_MaxUntypedBits
20  * is the minimal untyped that can be stored when considering both how
21  * many bits of capBlockSize there are, and the largest offset that can
22  * be stored in capFreeIndex */
23 #define MAX_FREE_INDEX(sizeBits) (BIT((sizeBits) - seL4_MinUntypedBits))
24 #define FREE_INDEX_TO_OFFSET(freeIndex) ((freeIndex)<<seL4_MinUntypedBits)
25 #define GET_FREE_REF(base,freeIndex) ((word_t)(((word_t)(base)) + FREE_INDEX_TO_OFFSET(freeIndex)))
26 #define GET_FREE_INDEX(base,free) (((word_t)(free) - (word_t)(base))>>seL4_MinUntypedBits)
27 #define GET_OFFSET_FREE_PTR(base, offset) ((void *)(((word_t)(base)) + (offset)))
28 #define OFFSET_TO_FREE_INDEX(offset) ((offset)>>seL4_MinUntypedBits)
29 
30 exception_t decodeUntypedInvocation(word_t invLabel, word_t length,
31                                     cte_t *slot, cap_t cap,
32                                     bool_t call, word_t *buffer);
33 exception_t invokeUntyped_Retype(cte_t *srcSlot, bool_t reset,
34                                  void *retypeBase, object_t newType, word_t userSize,
35                                  cte_t *destCNode, word_t destOffset, word_t destLength,
36                                  bool_t deviceMemory);
37