interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / omc / om2 / fnhost / x86-dev.om

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