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 / omega / allen / tests / provider-process.om

100 lines · 1600 bytes Raw Blame History
1note Native assertions over host-collected process receipts.
2note Four decimal lines: mode, exit, stdout bytes, stderr bytes; then stdout+stderr.
3global Procbuf uchar 65536
4global Procnum ulong 4
5global Procpos ulong 1
6text Procmag "ALNPRV01"
7fn pcheck ok bool to void
8check ok add get Checks 0 1
9end
10fn pnumber n ulong to bool
11v = ulong 0
12digits = ulong 0
13while lt get Procpos 0 n
14c = get Procbuf get Procpos 0
15put Procpos 0 add get Procpos 0 1
16if eq c 10
17if eq digits 0
18ret false
19end
20put Procnum 3 v
21ret true
22end
23if or lt c 48 gt c 57
24ret false
25end
26if ge digits 8
27ret false
28end
29v = add mul v 10 sub ulong c 48
30digits = add digits 1
31end
32ret false
33end
34fn pword off ulong to ulong
35v = ulong 0
36for i ulong 8
37v = or v shl ulong get Procbuf add off i mul i 8
38end
39ret v
40end
41fn pverify n ulong to int
42for i ulong 3
43if not pnumber n
44ret 65
45end
46put Procnum i get Procnum 3
47end
48if not pnumber n
49ret 65
50end
51mode = get Procnum 0
52rc = get Procnum 1
53size = get Procnum 2
54err = get Procnum 3
55p = get Procpos 0
56pcheck eq n add add p size err
57pcheck eq err 0
58if le mode 6
59pcheck ge mode 1
60pcheck eq rc 65
61if eq mode 6
62pcheck eq size 40
63if ge sub n p 40
64for i ulong 8
65pcheck eq get Procbuf add p i get Procmag i
66end
67pcheck eq pword add p 8 1
68pcheck eq pword add p 16 1
69pcheck eq pword add p 24 0
70pcheck eq pword add p 32 0
71end
72else
73pcheck eq size 0
74end
75else
76if eq mode 7
77pcheck eq rc 0
78else
79ret 65
80end
81end
82if ne get Fails 0 0
83ret 1
84end
85ret 0
86end
87fn main to int
88n = ulong 0
89while lt n len Procbuf
90r = read 0 Procbuf n sub len Procbuf n
91if lt r 0
92ret 74
93end
94if eq r 0
95ret pverify n
96end
97n = add n ulong r
98end
99ret 65
100end