blob: 4e82ab11c7f7cdb5c68f70a0d9e2cf253bd02438 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/* SPDX-License-Identifier: copyleft-next-0.3.1 */
/* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */
#ifndef KMI_ARCH_TCB_H
#define KMI_ARCH_TCB_H
/**
* @file lock.h
* Arch-specific tcb stuff.
*/
#if defined(riscv64)
#include "../../arch/riscv64/include/tcb.h"
#elif defined(riscv32)
#include "../../arch/riscv32/include/tcb.h"
#endif
/**
* Force store tcb \p t in arch-specific way.
* cpu_assign() is allowed to assume there's always a valid tcb
* set, so during init we have to force set a tcb before cpu_assign() can be
* used.
*
* @param t tcb to set.
*/
void tcb_assign(struct tcb *t);
/**
* Set up RPC stack in a way that is convenient for the underlying architecture.
*
* @param t Thread whose RPC stack should be set up.
*/
void setup_rpc_stack(struct tcb *t);
/**
* Maximum size of one individual RPC stack instance.
*
* @return Max size of one individual RPC stack instance.
*/
size_t max_rpc_size();
/**
* Current highest address in RPC stack. Allowed to be inaccurate to one base page.
*
* @param t Thread whose position in the RPC stack is to be determined.
* @return Virtual address corresponding to the current RPC stack position.
*/
vm_t rpc_position(struct tcb *t);
/**
* Mark RPC stack up to \p top accessible from userspace.
*
* @param t Thread whose RPC stack is being modified.
* @param top Address up to where stack should be accessible from userspace.
*/
void mark_rpc_valid(struct tcb *t, vm_t top);
/**
* Mark RPC stack down to \p bottom inaccessible from userspace.
*
* @param t Thread whose RPC stack is being modified.
* @param bottom Address down to where stack should be inaccessible from
* userspace.
*/
void mark_rpc_invalid(struct tcb *t, vm_t bottom);
#endif /* KMI_ARCH_TCB_H */
|