-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkrnl.rs
116 lines (97 loc) · 2.77 KB
/
krnl.rs
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#![no_std]
#![no_main]
#![feature(strict_provenance)]
#![feature(fn_align)]
#![warn(fuzzy_provenance_casts)]
#![feature(naked_functions)]
#![feature(exposed_provenance)]
#![feature(offset_of)]
mod abi;
#[macro_use]
mod con;
mod riscv64;
mod rwlock;
use riscv64 as arch;
// TODO: need some waya of sending capabilities across task boundaries
// should you be able to send them over endpoint capabilities?
enum Calls {
// locks mut
//
// Split a memory rejoin into two seperate capabilities at a line
// MemSplit(MemCap, line: usize) -> (MemCap, MemCap)
MemSplit,
// locks mut
//
// Create a task from a memory capability.
// MemCreateTask(MemCap<2 pages>) -> TaskCap
MemCreateTask,
// locks mut
//
// Create a thread from a memory capability.
// MemCreateThread(MemCap<64k? maybe make all 0 or 64k>, Task (initial task), usize (initial pc)) -> ThreadCap
MemCreateThread,
// Write to console
// ConWrite(ConCap, usize, usize, usize, ...)
ConWrite,
// locks mut
//
// TaskMapMem(TaskCap, MemCap, addr: usize)
// well also include map level bullshite
TaskMapMem,
// locks mut
//
// TaskUnmapMem(TaskCap, addr: usize) -> MemCap
// well also include map level bullshite
TaskUnmapMem,
// locks mut
//
// TaskMapShared(TaskCap, SharedCap, addr: usize)
// will increase the ref count
// well also include map level bullshite
TaskMapShared,
// locks mut
//
// TaskUnmapShared(TaskCap, addr: usize)
// will decrease the ref count
// well also include map level bullshite
TaskUnmapShared,
// locks mut
//
// TaskMapCap(TaskCap, MemCap, addr: usize)
// well also include map level bullshite
TaskMapCap,
// locks mut
//
// TaskUnmapCap(TaskCap, addr: usize) -> MemCap
// well also include map level bullshite
TaskUnmapCap,
// locks mut
//
// TaskCreateEndpoint(TaskCap, pc: usize) -> Endpoint
TaskCreateEndpoint,
// locks mut
//
// TaskCreateMem(TaskCap) -> MemCap<2 pages>
// reclaim the memory from a task cap that's not needed anymore.
// will fault if there are still references
TaskCreateMem,
// locks mut
//
// ThreadCreateMem(ThreadCap) -> MemCap
ThreadCreateMem,
// EndpointInvoke()
EndpointInvoke,
// forget about a capability drop the reference but don't destroy it in anyway
CapDrop,
// locks mut
//
// creates a reference counted shared memory capability
MemCreateShared,
// locks mut
//
// turns a shared cap into a mem cap provided there are no references left.
SharedCreateMem,
}
#[link_section = ".data._init"]
#[no_mangle]
static mut _init: [u8; include_bytes!("init.bin").len()] = *include_bytes!("init.bin");