omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / gpu / driver / gsp / owned.om
| 1 | note Checked CPU staging and uncertainty connection only; NOT a hardware publisher or RPC endpoint. |
| 2 | note Compose after chan/dma+gmmu and gsp/arena+boot. No device opens, barriers or doorbells here. |
| 3 | note Real publication still requires reviewed coherency/release/acquire and an authorized endpoint. |
| 4 | global arsepoch ulong 1 |
| 5 | global arsboot ulong 1 |
| 6 | note All staged bytes target the same checked owned mapping. Publish the receipt after the last copy. |
| 7 | fn arstdata h long n ulong to bool |
| 8 | if or eq n 0 gt n ARMAX |
| 9 | ret false |
| 10 | end |
| 11 | low = n |
| 12 | if gt low ARLOW |
| 13 | low = ARLOW |
| 14 | end |
| 15 | if ne mapwrite h 0 arbuf 0 low long low |
| 16 | ret false |
| 17 | end |
| 18 | if eq low n |
| 19 | ret true |
| 20 | end |
| 21 | page = new uchar 4096 0 |
| 22 | o = low |
| 23 | while lt o n bound 16384 |
| 24 | size = sub n o |
| 25 | if gt size 4096 |
| 26 | size = ulong 4096 |
| 27 | end |
| 28 | for i ulong size |
| 29 | put page i aroutput add o i |
| 30 | end |
| 31 | if ne mapwrite h o page 0 size long size |
| 32 | ret false |
| 33 | end |
| 34 | o = add o size |
| 35 | end |
| 36 | ret eq o n |
| 37 | end |
| 38 | fn arstage gen ulong to long |
| 39 | if not mmwepoch gen |
| 40 | ret MMEGEN |
| 41 | end |
| 42 | if ne get bstate 0 4 |
| 43 | ret MMESTATE |
| 44 | end |
| 45 | if not or eq get mmwst 0 MMWOWN eq get mmwst 0 MMWDMA |
| 46 | ret MMESTATE |
| 47 | end |
| 48 | if ne get arbase 0 get mmwb 0 |
| 49 | ret MMEINVAL |
| 50 | end |
| 51 | if or eq get arused 0 0 gt get arused 0 get mmws 0 |
| 52 | ret MMEINVAL |
| 53 | end |
| 54 | if gt get arused 0 ARMAX |
| 55 | ret MMEINVAL |
| 56 | end |
| 57 | put arsepoch 0 0 |
| 58 | put arsboot 0 0 |
| 59 | if not arstdata get mmwh 0 get arused 0 |
| 60 | ret MMEIO |
| 61 | end |
| 62 | put arsepoch 0 gen |
| 63 | put arsboot 0 get bgen 0 |
| 64 | ret MMOK |
| 65 | end |
| 66 | note Call only for uncertain completion after an actual publication; never reclaim automatically. |
| 67 | fn arlose gen ulong to long |
| 68 | if ne gen get arsepoch 0 |
| 69 | ret MMEGEN |
| 70 | end |
| 71 | if ne get bgen 0 get arsboot 0 |
| 72 | ret MMEGEN |
| 73 | end |
| 74 | if ne get bstate 0 12 |
| 75 | ret MMESTATE |
| 76 | end |
| 77 | if ne get mmwst 0 MMWPUB |
| 78 | ret MMESTATE |
| 79 | end |
| 80 | ret mmwquar gen |
| 81 | end |