aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / evidence / allen-omega-L694 / L748 / independent-review / raw / provider-core-numbered.txt
| 1 | 1 note Host provider stream core. PROVIDER.md is the framing/state contract. |
| 2 | 2 global Ph uchar 40 |
| 3 | 3 global Pb uchar 4096 |
| 4 | 4 global Pv ulong 4 |
| 5 | 5 global Pc ulong 2 |
| 6 | 6 global Pe ulong 2 |
| 7 | 7 global Pout uchar 65536 |
| 8 | 8 global Pn ulong 1 |
| 9 | 9 text Prmagic "ALNPRV01" |
| 10 | 10 fn prshape to bool |
| 11 | 11 op = get Pv 0 |
| 12 | 12 now = get Pv 1 |
| 13 | 13 arg = get Pv 2 |
| 14 | 14 n = get Pv 3 |
| 15 | 15 if eq op 1 |
| 16 | 16 ret and gt arg 0 eq n 0 |
| 17 | 17 end |
| 18 | 18 if eq op 2 |
| 19 | 19 if ne arg 0 |
| 20 | 20 ret false |
| 21 | 21 end |
| 22 | 22 ret and gt n 0 le n 159 |
| 23 | 23 end |
| 24 | 24 if or eq op 3 eq op 4 |
| 25 | 25 ret and le arg 1 eq n 0 |
| 26 | 26 end |
| 27 | 27 if eq op 5 |
| 28 | 28 if ne arg 0 |
| 29 | 29 ret false |
| 30 | 30 end |
| 31 | 31 ret and ge n 65 le n 1200 |
| 32 | 32 end |
| 33 | 33 if ne now 0 |
| 34 | 34 ret false |
| 35 | 35 end |
| 36 | 36 if or eq op 6 eq op 7 |
| 37 | 37 ret and eq arg 0 eq n 0 |
| 38 | 38 end |
| 39 | 39 if eq op 8 |
| 40 | 40 ret and le arg 1 eq n 4096 |
| 41 | 41 end |
| 42 | 42 if eq op 9 |
| 43 | 43 ret and le arg 511 eq n 4096 |
| 44 | 44 end |
| 45 | 45 if eq op 10 |
| 46 | 46 ret and eq arg 0 eq n 0 |
| 47 | 47 end |
| 48 | 48 ret false |
| 49 | 49 end |
| 50 | 50 fn prparse to bool |
| 51 | 51 for i ulong 8 |
| 52 | 52 if ne get Ph i get Prmagic i |
| 53 | 53 ret false |
| 54 | 54 end |
| 55 | 55 end |
| 56 | 56 for k ulong 4 |
| 57 | 57 v = ulong 0 |
| 58 | 58 for i ulong 8 |
| 59 | 59 off = add add 8 mul k 8 i |
| 60 | 60 v = or v shl ulong get Ph off mul i 8 |
| 61 | 61 end |
| 62 | 62 put Pv k v |
| 63 | 63 end |
| 64 | 64 ret prshape |
| 65 | 65 end |
| 66 | 66 fn prbyte c uchar to void |
| 67 | 67 put Pout get Pn 0 c |
| 68 | 68 put Pn 0 add get Pn 0 1 |
| 69 | 69 end |
| 70 | 70 fn prword v ulong to void |
| 71 | 71 for i ulong 8 |
| 72 | 72 prbyte uchar and shr v mul i 8 255 |
| 73 | 73 end |
| 74 | 74 end |
| 75 | 75 fn prhead op ulong status ulong event ulong size ulong to void |
| 76 | 76 for i ulong 8 |
| 77 | 77 prbyte get Prmagic i |
| 78 | 78 end |
| 79 | 79 prword op |
| 80 | 80 prword status |
| 81 | 81 prword event |
| 82 | 82 prword size |
| 83 | 83 end |
| 84 | 84 fn prreply status ulong to void |
| 85 | 85 put Pn 0 0 |
| 86 | 86 kind = get Pe 1 |
| 87 | 87 size = ulong 0 |
| 88 | 88 if eq kind 1 |
| 89 | 89 size = get Outlen 0 |
| 90 | 90 end |
| 91 | 91 if eq kind 2 |
| 92 | 92 size = get R 8 |
| 93 | 93 end |
| 94 | 94 prhead get Pv 0 status get Pe 0 size |
| 95 | 95 for i ulong size |
| 96 | 96 if eq kind 1 |
| 97 | 97 prbyte get Outb i |
| 98 | 98 else |
| 99 | 99 prbyte get Answer i |
| 100 | 100 end |
| 101 | 101 end |
| 102 | 102 if eq kind 2 |
| 103 | 103 if and gt get R 2 1 eq get R 1 0 |
| 104 | 104 if and ne get R 6 0 eq codestat 2 |
| 105 | 105 prhead 11 1 1 get C 2 |
| 106 | 106 for i ulong get C 2 |
| 107 | 107 prbyte get Code i |
| 108 | 108 end |
| 109 | 109 end |
| 110 | 110 end |
| 111 | 111 end |
| 112 | 112 end |
| 113 | 113 fn prevent to void |
| 114 | 114 put Pe 0 get A 2 |
| 115 | 115 if eq get A 2 1 |
| 116 | 116 put Pe 1 2 |
| 117 | 117 end |
| 118 | 118 end |
| 119 | 119 fn prload to ulong |
| 120 | 120 if or ne get A 0 0 not ctxidle |
| 121 | 121 ret 0 |
| 122 | 122 end |
| 123 | 123 constants |
| 124 | 124 for i ulong 3692 |
| 125 | 125 put Mem i 0 |
| 126 | 126 end |
| 127 | 127 loadbeg |
| 128 | 128 b = ctxbegin |
| 129 | 129 put Pc 0 1 |
| 130 | 130 put Pc 1 0 |
| 131 | 131 ret 1 |
| 132 | 132 end |
| 133 | 133 fn prcopy to ulong |
| 134 | 134 if or ne get A 0 0 ne get Pc 0 1 |
| 135 | 135 ret 0 |
| 136 | 136 end |
| 137 | 137 if not ctxidle |
| 138 | 138 ret 0 |
| 139 | 139 end |
| 140 | 140 slot = get Pv 2 |
| 141 | 141 bit = shl ulong 1 slot |
| 142 | 142 if ne and get Pc 1 bit 0 |
| 143 | 143 ret 0 |
| 144 | 144 end |
| 145 | 145 for i ulong 4096 |
| 146 | 146 put Unit i get Pb i |
| 147 | 147 end |
| 148 | 148 status = ulong 2 |
| 149 | 149 if loadcopy slot |
| 150 | 150 status = 1 |
| 151 | 151 end |
| 152 | 152 put Pc 1 or get Pc 1 bit |
| 153 | 153 if eq get Pc 1 3 |
| 154 | 154 if not ctxbegin |
| 155 | 155 ret 0 |
| 156 | 156 end |
| 157 | 157 put Pc 0 2 |
| 158 | 158 if ne get Cx 2 0 |
| 159 | 159 put Pc 0 3 |
| 160 | 160 end |
| 161 | 161 end |
| 162 | 162 ret status |
| 163 | 163 end |
| 164 | 164 fn prnote to ulong |
| 165 | 165 if or ne get A 0 0 ne get Pc 0 2 |
| 166 | 166 ret 0 |
| 167 | 167 end |
| 168 | 168 if not ctxidle |
| 169 | 169 ret 0 |
| 170 | 170 end |
| 171 | 171 for i ulong 4096 |
| 172 | 172 put Unit i get Pb i |
| 173 | 173 end |
| 174 | 174 status = ctxtake get Pv 2 |
| 175 | 175 if ne get Cx 2 0 |
| 176 | 176 put Pc 0 3 |
| 177 | 177 end |
| 178 | 178 ret status |
| 179 | 179 end |
| 180 | 180 fn prapply to ulong |
| 181 | 181 op = get Pv 0 |
| 182 | 182 now = get Pv 1 |
| 183 | 183 arg = get Pv 2 |
| 184 | 184 if eq op 10 |
| 185 | 185 ret prload |
| 186 | 186 end |
| 187 | 187 if eq op 8 |
| 188 | 188 ret prcopy |
| 189 | 189 end |
| 190 | 190 if eq op 9 |
| 191 | 191 ret prnote |
| 192 | 192 end |
| 193 | 193 if eq op 1 |
| 194 | 194 if or eq get Pc 0 1 eq get Pc 0 2 |
| 195 | 195 ret 0 |
| 196 | 196 end |
| 197 | 197 if appinit arg now |
| 198 | 198 ret 1 |
| 199 | 199 end |
| 200 | 200 ret 0 |
| 201 | 201 end |
| 202 | 202 if eq get A 0 0 |
| 203 | 203 ret 0 |
| 204 | 204 end |
| 205 | 205 if eq op 6 |
| 206 | 206 appcancel |
| 207 | 207 ret 1 |
| 208 | 208 end |
| 209 | 209 if eq op 7 |
| 210 | 210 appreset |
| 211 | 211 ret 1 |
| 212 | 212 end |
| 213 | 213 if not appclock now |
| 214 | 214 ret 0 |
| 215 | 215 end |
| 216 | 216 if eq op 3 |
| 217 | 217 offer = apppoll now ne arg 0 |
| 218 | 218 prevent |
| 219 | 219 if offer |
| 220 | 220 put Pe 1 1 |
| 221 | 221 ret 3 |
| 222 | 222 end |
| 223 | 223 ret 1 |
| 224 | 224 end |
| 225 | 225 if eq op 4 |
| 226 | 226 if appsent now ne arg 0 |
| 227 | 227 ret 1 |
| 228 | 228 end |
| 229 | 229 ret 0 |
| 230 | 230 end |
| 231 | 231 for i ulong get Pv 3 |
| 232 | 232 put In i get Pb i |
| 233 | 233 end |
| 234 | 234 put Inlen 0 get Pv 3 |
| 235 | 235 if eq op 2 |
| 236 | 236 if not appask now |
| 237 | 237 ret 0 |
| 238 | 238 end |
| 239 | 239 else |
| 240 | 240 if not appreceive now |
| 241 | 241 ret 0 |
| 242 | 242 end |
| 243 | 243 end |
| 244 | 244 prevent |
| 245 | 245 ret 1 |
| 246 | 246 end |
| 247 | 247 fn prdo to bool |
| 248 | 248 if not prparse |
| 249 | 249 ret false |
| 250 | 250 end |
| 251 | 251 put Pe 0 0 |
| 252 | 252 put Pe 1 0 |
| 253 | 253 status = prapply |
| 254 | 254 prreply status |
| 255 | 255 ret true |
| 256 | 256 end |