interplane.Get Omega
Read in your language

omega-mcp

aien-dev/omega-mcp

Brought by drakestapleton

branch main Branches Tags History

omega-mcp / data / examples / mapping.om

37 lines · 851 bytes Raw Blame History
1note owned mappings and checked device calls; device calls use fd -1 here, so no device is opened
2global hdr uchar 48
3global prm uchar 32
4global data uchar 64
5global ends uchar 8
6global cnt uchar 4
7global buf uchar 8
8text name "m"
9fn ck yes bool to void
10if not yes
11exit 80
12end
13end
14fn main to int
15h = mapnew neg int 1 0 4096 3 34
16ck gt h 0
17ck gt mapaddr h 4096
18ck eq mapset h 8 8 77 0
19ck eq mapget h 8 8 77
20put buf 0 5
21ck eq mapwrite h 0 buf 0 1 1
22ck eq mapread h 0 buf 1 1 1
23ck eq get buf 1 5
24ck eq mapdrop h 0
25ck eq pipefds ends 0 8 0 0
26rd = int get ends 0
27ck eq devctl rd uint 21531 cnt 0 4 0
28ck eq devcall neg int 1 uint 3223340587 hdr 0 32 prm 0 0 neg long 9
29ck eq uvmctl neg int 1 uint 75 data 8 8 neg long 9
30m = int memfd name 0 len name 0
31ck ge m 0
32ck eq ftrunc m 4096 0
33r = maphold 68719476736 4096
34ck gt r 0
35ck eq mapbind r m 0 3 0
36ret 0
37end