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 / s5 / scrub-ctl.om

61 lines · 960 bytes Raw Blame History
1note S5 scrub negative control: scrub-mem.om with `scrub 4096` replaced by `long 0`; the same search must find
2note the pattern (exit 10), showing the search can see a dead frame.
3om2
4global buf uchar 1048576
5text mem "/proc/self/mem"
6fn fill to ulong
7a = new ulong 64 0
8for i ulong 64
9put a i 9833440827789222417
10end
11s = ulong 0
12for i ulong 64
13s = add s get a i
14end
15ret s
16end
17fn main to int
18s = fill
19k = long 0
20if ne k 0
21ret 30
22end
23fd = int fopen mem 0 len mem 0 0
24if lt fd 0
25ret 20
26end
27hits = ulong 0
28for c ulong 8
29pos = long add 268435456 mul c 1048576
30r = pread fd buf 0 1048576 pos
31if ne r 1048576
32ret 21
33end
34i = ulong 0
35while lt i 1048576
36if eq get buf i 17
37if eq get buf add i 1 34
38if eq get buf add i 2 51
39if eq get buf add i 3 68
40if eq get buf add i 4 85
41if eq get buf add i 5 102
42if eq get buf add i 6 119
43if eq get buf add i 7 136
44hits = add hits 1
45end
46end
47end
48end
49end
50end
51end
52end
53i = add i 8
54end
55end
56r = fclose fd
57if gt hits 0
58ret 10
59end
60ret 0
61end