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 / sites / found-mbind-2.om

106 lines · 1996 bytes Raw Blame History
1note sites: found by a one-token change of a tracked program (41 to 120 lines); reaches the omc error site in mbind (code 9)
2note Owned low-address reservations and complete-span file binding. Host only.
3text path "reserve.bin"
4text mark "Z"
5text msg "PASS owned reservations, collision refusal and failed-bind retirement\n"
6global buf uchar 4
7global status uchar 4
8global fds int 2
9fn ck yes bool to void
10if not yes
11exit int 80
12end
13end
14fn bad k int to void
15if eq k 0
16r = maphold 4096 4096
17ret
18end
19if eq k 1
20r = maphold 1099511627776 4096
21ret
22end
23if eq k 2
24r = maphold 68719476737 4096
25ret
26end
27if eq k 3
28r = maphold 68719476736 4097
29ret
30end
31if eq k 4
32r = maphold 18446744073709551615 4096
33ret
34end
35h = maphold 68719542272 4096
36ck gt h 0
37if eq k 5
38r = mapread h 0 buf 0 1
39ret
40end
41if eq k 6
42r = mapwrite h 0 mark 0 1
43ret
44end
45if eq k 7
46r = mapget h 0 4
47ret
48end
49if eq k 8
50r = mapset h 0 4 0
51ret
52end
53if eq k 9
54ck eq mapbind h neg int 1 0 3 neg long 9
55r = mapaddr h
56ret
57end
58ck eq mapbind h get fds 0 0 not 0
59r = mapbind h get fds 0 0 3
60end
61fn main to int
62fd = fopen path 0 len path 524482 384
63ck ge fd 0
64put fds 0 int fd
65ck eq fseek int fd 4095 0 4095
66ck eq write int fd mark 0 1 1
67ro = fopen path 0 len path 524288 0
68ck ge ro 0
69put fds 1 int ro
70for i ulong 16
71h = maphold 68719476736 4096
72ck gt h 0
73ck eq mapaddr h 68719476736
74ck eq maphold 68719476736 4096 neg long 17
75ck eq mapbind h int fd 0 3 0
76ck eq mapread h 4095 buf 0 1 1
77ck eq get buf 0 90
78ck eq mapset h 0 4 add 123 i 0
79ck eq mapget h 0 4 add 123 i
80ck eq mapdrop h 0
81end
82h = maphold 68719476736 4096
83ck gt h 0
84ck eq mapbind h int ro 0 3 neg long 13
85j = maphold 68719476736 4096
86ck gt j 0
87ck ne j h
88ck eq mapbind j int ro 0 1 0
89ck eq mapget j 0 4 138
90ck eq mapdrop j 0
91for k int 11
92p = fork
93ck ge p 0
94if eq p 0
95bad k
96exit int 80
97end
98ck eq waitpid int p status 0 4 0 p
99ck and eq get status 0 0 eq get status 1 103
100end
101ck eq fclose int fd 0
102ck eq fclose int ro 0
103ck eq unlink path 0 len path 0
104ck eq write 1 msg 0 len msg long len msg
105ret 0
106end