interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / disk / omega_nvme_transport.om

118 lines · 1954 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note Hosted verification transport ONLY. RPC addresses are QEMU guest addresses,
3note not host CPU pointers. The verifier translates byte access, never NVMe commands.
4global packet uchar 24
5global reply uchar 8
6fn enc off ulong value ulong to void
7for i ulong 8
8put packet add off i uchar and shr value mul i 8 255
9end
10end
11fn sendreq op ulong addr ulong value ulong to ulong
12enc 0 op
13enc 8 addr
14enc 16 value
15n = ulong 0
16while lt n 24 bound 24
17r = write 1 packet n sub 24 n
18if le r 0
19exit 90
20end
21n = add n ulong r
22end
23n = ulong 0
24while lt n 8 bound 8
25r = read 0 reply n sub 8 n
26if le r 0
27exit 90
28end
29n = add n ulong r
30end
31v = ulong 0
32for i ulong 8
33v = or v shl ulong get reply i mul i 8
34end
35ret v
36end
37fn load32 addr ulong to ulong
38ret sendreq 1 addr 0
39end
40fn load64 addr ulong to ulong
41ret sendreq 2 addr 0
42end
43fn store32 addr ulong value ulong to void
44r = sendreq 3 addr value
45if ne r 0
46exit 90
47end
48end
49fn store64 addr ulong value ulong to void
50r = sendreq 4 addr value
51if ne r 0
52exit 90
53end
54end
55fn zero_dma addr ulong size ulong to void
56r = sendreq 5 addr size
57if ne r 0
58exit 90
59end
60end
61fn fetchid addr ulong to void
62r = sendreq 6 addr 4096
63if ne r 0
64exit 90
65end
66n = ulong 0
67while lt n 4096 bound 4096
68rv = read 0 ident n sub 4096 n
69if le rv 0
70exit 90
71end
72n = add n ulong rv
73end
74end
75fn fetchdata addr ulong size ulong to void
76r = sendreq 6 addr size
77if ne r 0
78exit 90
79end
80n = ulong 0
81while lt n size bound 8192
82rv = read 0 bounce n sub size n
83if le rv 0
84exit 90
85end
86n = add n ulong rv
87end
88end
89fn publish size ulong to void
90r = sendreq 7 0 size
91if ne r 0
92exit 90
93end
94n = ulong 0
95while lt n size bound 8192
96rv = write 1 caller n sub size n
97if le rv 0
98exit 90
99end
100n = add n ulong rv
101end
102end
103fn report code int to void
104r = sendreq 8 get st 1 ulong code
105if ne r 0
106exit 90
107end
108end
109fn getmanifest to void
110n = ulong 0
111while lt n 80 bound 80
112r = read 0 manifest n sub 80 n
113if le r 0
114exit 90
115end
116n = add n ulong r
117end
118end