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 / gpu / nvidia / om / platform-linux / plat_map_fixture.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Anonymous mapwrite plus cpufence. Never opens /dev/nvidia. Exit 0 on the expected prefix bytes. |
| 3 | global b uchar 8 |
| 4 | global out uchar 8 |
| 5 | fn main to int |
| 6 | h = mapnew neg int 1 0 4096 3 34 |
| 7 | if lt h 0 |
| 8 | ret 2 |
| 9 | end |
| 10 | put b 0 1 |
| 11 | put b 1 0 |
| 12 | put b 2 0 |
| 13 | put b 3 0 |
| 14 | put b 4 2 |
| 15 | put b 5 0 |
| 16 | put b 6 0 |
| 17 | put b 7 0 |
| 18 | n = mapwrite h 0 b 0 8 |
| 19 | if ne n 8 |
| 20 | ret 3 |
| 21 | end |
| 22 | cpufence |
| 23 | got = mapread h 0 out 0 8 |
| 24 | if ne got 8 |
| 25 | ret 3 |
| 26 | end |
| 27 | if ne get out 0 1 |
| 28 | ret 4 |
| 29 | end |
| 30 | if ne get out 4 2 |
| 31 | ret 4 |
| 32 | end |
| 33 | drop = mapdrop h |
| 34 | if ne drop 0 |
| 35 | ret 5 |
| 36 | end |
| 37 | ret 0 |
| 38 | end |