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 / om / gpu / dsv41 / decoder / check-core.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note In host-scaffold mode pre-fault the original Zone 1 checkpoint bytes |
| 3 | note into an owned mapping. GPU startup can pass its own RM mapping to dcPopulate. |
| 4 | fn dcOpenArg arg ulong to int |
| 5 | path = new uchar 4096 0 |
| 6 | n = argread arg path 0 4096 |
| 7 | if le n 0 |
| 8 | ret int -1 |
| 9 | end |
| 10 | ret int fopen path 0 ulong n 524288 0 |
| 11 | end |
| 12 | |
| 13 | fn main to int |
| 14 | if and ne argcnt 2 ne argcnt 50 |
| 15 | ret 64 |
| 16 | end |
| 17 | fd = dcOpenArg 1 |
| 18 | if lt fd 0 |
| 19 | ret 66 |
| 20 | end |
| 21 | ok = dcPlan fd |
| 22 | if ne fclose fd 0 |
| 23 | ret 74 |
| 24 | end |
| 25 | if not ok |
| 26 | ret 65 |
| 27 | end |
| 28 | if not dkPlan 2048 |
| 29 | ret 65 |
| 30 | end |
| 31 | if eq argcnt 50 |
| 32 | for i ulong 48 |
| 33 | source = dcOpenArg add i 2 |
| 34 | if lt source 0 |
| 35 | ret 66 |
| 36 | end |
| 37 | if ne fseek source 0 2 long dsFileBytes add i 1 |
| 38 | ret 65 |
| 39 | end |
| 40 | put dcFD i long source |
| 41 | end |
| 42 | arena = mapnew -1 0 get dcTotals 0 3 33 |
| 43 | if le arena 0 |
| 44 | ret 74 |
| 45 | end |
| 46 | if not dcPopulate arena |
| 47 | ret 74 |
| 48 | end |
| 49 | kv = mapnew -1 0 get dkPlanInfo 2 3 33 |
| 50 | if le kv 0 |
| 51 | ret 74 |
| 52 | end |
| 53 | if not dkTouch kv |
| 54 | ret 74 |
| 55 | end |
| 56 | if ne mapdrop kv 0 |
| 57 | ret 74 |
| 58 | end |
| 59 | if ne mapdrop arena 0 |
| 60 | ret 74 |
| 61 | end |
| 62 | for i ulong 48 |
| 63 | if ne fclose int get dcFD i 0 |
| 64 | ret 74 |
| 65 | end |
| 66 | end |
| 67 | end |
| 68 | record = new uchar 32 0 |
| 69 | for i ulong 3 |
| 70 | diPut record mul i 8 8 get dcTotals i |
| 71 | end |
| 72 | diPut record 24 8 get dkPlanInfo 2 |
| 73 | if ne write 1 record 0 32 32 |
| 74 | ret 74 |
| 75 | end |
| 76 | ret 0 |
| 77 | end |