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 / context-restore-numbered.txt
| 1 | 1 note Restored note catalog and bounded model-job context. No storage provider. |
| 2 | 2 note Cx declared count,visited count,ready,damaged,loading. Damaged notes stay gone. |
| 3 | 3 global Cx ulong 5 |
| 4 | 4 global Ctxtext uchar 65536 |
| 5 | 5 global Ctxlen ulong 512 |
| 6 | 6 global Ctxgone uchar 512 |
| 7 | 7 global Ctxseen uchar 512 |
| 8 | 8 global Ctxstart ulong 512 |
| 9 | 9 global Meta uchar 4096 |
| 10 | 10 global Mx ulong 2 |
| 11 | 11 global Mdigits uchar 20 |
| 12 | 12 text Mtself "\tself=" |
| 13 | 13 text Mtname "\tname=" |
| 14 | 14 text Mtstart "\tstarts=" |
| 15 | 15 text Mtfact "\tfact " |
| 16 | 16 text Mtis " is " |
| 17 | 17 text Mtare " are " |
| 18 | 18 text Mtnote "\tnote " |
| 19 | 19 fn ctxidle to bool |
| 20 | 20 if ne get R 1 0 |
| 21 | 21 ret false |
| 22 | 22 end |
| 23 | 23 ret and eq get Tx 0 0 eq get Nt 0 0 |
| 24 | 24 end |
| 25 | 25 fn ctxbegin to bool |
| 26 | 26 if not ctxidle |
| 27 | 27 ret false |
| 28 | 28 end |
| 29 | 29 n = mem32 36 |
| 30 | 30 if gt n 512 |
| 31 | 31 ret false |
| 32 | 32 end |
| 33 | 33 for i ulong 512 |
| 34 | 34 put Ctxlen i 0 |
| 35 | 35 put Ctxgone i 1 |
| 36 | 36 put Ctxseen i 0 |
| 37 | 37 put Ctxstart i 0 |
| 38 | 38 end |
| 39 | 39 put Cx 0 n |
| 40 | 40 put Cx 1 0 |
| 41 | 41 put Cx 2 0 |
| 42 | 42 put Cx 3 0 |
| 43 | 43 put Cx 4 1 |
| 44 | 44 if eq n 0 |
| 45 | 45 put Cx 2 1 |
| 46 | 46 put Cx 4 0 |
| 47 | 47 end |
| 48 | 48 ret true |
| 49 | 49 end |
| 50 | 50 note Returns0 refused without visit,1 valid record retained,2 damaged visit retained. |
| 51 | 51 fn ctxtake index ulong to ulong |
| 52 | 52 if not ctxidle |
| 53 | 53 ret 0 |
| 54 | 54 end |
| 55 | 55 if or eq get Cx 4 0 ge index get Cx 0 |
| 56 | 56 ret 0 |
| 57 | 57 end |
| 58 | 58 if ne get Ctxseen index 0 |
| 59 | 59 ret 0 |
| 60 | 60 end |
| 61 | 61 status = ulong 2 |
| 62 | 62 if notedec index |
| 63 | 63 n = get Ns 0 |
| 64 | 64 for i ulong n |
| 65 | 65 put Ctxtext add mul index 128 i get Note i |
| 66 | 66 end |
| 67 | 67 put Ctxlen index n |
| 68 | 68 put Ctxgone index uchar get Ns 3 |
| 69 | 69 put Ctxstart index get Ns 2 |
| 70 | 70 status = 1 |
| 71 | 71 else |
| 72 | 72 put Cx 3 add get Cx 3 1 |
| 73 | 73 end |
| 74 | 74 put Ctxseen index 1 |
| 75 | 75 put Cx 1 add get Cx 1 1 |
| 76 | 76 if eq get Cx 1 get Cx 0 |
| 77 | 77 put Cx 2 1 |
| 78 | 78 put Cx 4 0 |
| 79 | 79 end |
| 80 | 80 ret status |
| 81 | 81 end |
| 82 | 82 fn mtemit c uchar to void |
| 83 | 83 if ne get Mx 1 0 |
| 84 | 84 ret |
| 85 | 85 end |
| 86 | 86 n = get Mx 0 |
| 87 | 87 if ge n 4096 |
| 88 | 88 put Mx 1 1 |
| 89 | 89 ret |
| 90 | 90 end |
| 91 | 91 put Meta n c |
| 92 | 92 put Mx 0 add n 1 |
| 93 | 93 end |
| 94 | 94 fn mtnum v ulong to void |
| 95 | 95 n = ulong 0 |
| 96 | 96 while gt v 9 |
| 97 | 97 put Mdigits n uchar rem v 10 |
| 98 | 98 v = div v 10 |
| 99 | 99 n = add n 1 |
| 100 | 100 end |