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 / seed / omc / om2 / fnhost / dev.om
| 1 | note dev.om: an OM-2 function unit (no fn main) using every function-mode clock and device word: |
| 2 | note monons realns sleepns, devctl devcall uvmctl, mapnew mapaddr mapset mapget mapwrite mapread mapdrop, |
| 3 | note with cpufence between the payload and the doorbell. The mapping words find their table through |
| 4 | note runtime-table entry 31 (seed/host/MAPPING.md, function mode); the exact code is pinned by sha256. |
| 5 | om2 |
| 6 | fn clk to long |
| 7 | a = monons |
| 8 | s = sleepns long 1000 |
| 9 | b = monons |
| 10 | r = realns |
| 11 | if lt s 0 |
| 12 | ret s |
| 13 | end |
| 14 | if lt r 0 |
| 15 | ret r |
| 16 | end |
| 17 | ret sub b a |
| 18 | end |
| 19 | fn dev fd int to long |
| 20 | b = new uchar 48 0 |
| 21 | r = devctl fd uint 21531 b 0 4 |
| 22 | if lt r 0 |
| 23 | ret r |
| 24 | end |
| 25 | r = devctl fd uint 3224389163 b 0 48 |
| 26 | hd = new uchar 32 0 |
| 27 | pa = new uchar 16 0 |
| 28 | k = devcall fd uint 3223340587 hd 0 32 pa 0 16 |
| 29 | u = uvmctl fd uint 75 b 0 8 |
| 30 | ret add add r k u |
| 31 | end |
| 32 | fn ring v ulong to long |
| 33 | h = mapnew neg int 1 0 4096 3 34 |
| 34 | if lt h 0 |
| 35 | ret h |
| 36 | end |
| 37 | p = new uchar 16 7 |
| 38 | a = mapaddr h |
| 39 | w = mapwrite h 16 p 0 16 |
| 40 | cpufence |
| 41 | d = mapset h 8 8 v |
| 42 | d = mapset h 0 4 1 |
| 43 | x = long mapget h 8 8 |
| 44 | q = new uchar 16 0 |
| 45 | n = mapread h 16 q 0 16 |
| 46 | z = mapdrop h |
| 47 | if eq a 0 |
| 48 | ret -1 |
| 49 | end |
| 50 | ret add x long get q 15 |
| 51 | end |