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 <types.h>
10 #include <api/failures.h>
11 #include <api/types.h>
12 #include <object/structures.h>
13 
14 struct lookupCap_ret {
15     exception_t status;
16     cap_t cap;
17 };
18 typedef struct lookupCap_ret lookupCap_ret_t;
19 
20 struct lookupCapAndSlot_ret {
21     exception_t status;
22     cap_t cap;
23     cte_t *slot;
24 };
25 typedef struct lookupCapAndSlot_ret lookupCapAndSlot_ret_t;
26 
27 struct lookupSlot_raw_ret {
28     exception_t status;
29     cte_t *slot;
30 };
31 typedef struct lookupSlot_raw_ret lookupSlot_raw_ret_t;
32 
33 struct lookupSlot_ret {
34     exception_t status;
35     cte_t *slot;
36 };
37 typedef struct lookupSlot_ret lookupSlot_ret_t;
38 
39 struct resolveAddressBits_ret {
40     exception_t status;
41     cte_t *slot;
42     word_t bitsRemaining;
43 };
44 typedef struct resolveAddressBits_ret resolveAddressBits_ret_t;
45 
46 lookupCap_ret_t lookupCap(tcb_t *thread, cptr_t cPtr);
47 lookupCapAndSlot_ret_t lookupCapAndSlot(tcb_t *thread, cptr_t cPtr);
48 lookupSlot_raw_ret_t lookupSlot(tcb_t *thread, cptr_t capptr);
49 lookupSlot_ret_t lookupSlotForCNodeOp(bool_t isSource,
50                                       cap_t root, cptr_t capptr,
51                                       word_t depth);
52 lookupSlot_ret_t lookupSourceSlot(cap_t root, cptr_t capptr,
53                                   word_t depth);
54 lookupSlot_ret_t lookupTargetSlot(cap_t root, cptr_t capptr,
55                                   word_t depth);
56 lookupSlot_ret_t lookupPivotSlot(cap_t root, cptr_t capptr,
57                                  word_t depth);
58 resolveAddressBits_ret_t resolveAddressBits(cap_t nodeCap,
59                                             cptr_t capptr,
60                                             word_t n_bits);
61 
62