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_effects.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Platform publication barrier and ring-byte store. No device is opened. |
| 3 | note cpufence is AArch64 DSB SY / x86-64 MFENCE (omega-mv retire compiler, MAPPING.md). |
| 4 | note Bound 1048576 is 2^20 (WolframLanguageEvaluator: 2^20 -> 1048576). |
| 5 | om2 |
| 6 | export fn plat_fence to long |
| 7 | cpufence |
| 8 | ret long 1 |
| 9 | end |
| 10 | export fn plat_ring_store dst edit uchar * bytes view uchar * n ulong to long |
| 11 | if eq n 0 |
| 12 | ret long 0 |
| 13 | end |
| 14 | if lt 1048576 n |
| 15 | ret long 0 |
| 16 | end |
| 17 | for i ulong n |
| 18 | put dst i get bytes i |
| 19 | end |
| 20 | cpufence |
| 21 | ret long n |
| 22 | end |
| 23 | export fn plat_map_store handle long off ulong bytes view uchar * n ulong to long |
| 24 | if eq n 0 |
| 25 | ret neg long 22 |
| 26 | end |
| 27 | if lt 1048576 n |
| 28 | ret neg long 22 |
| 29 | end |
| 30 | wrote = mapwrite handle off bytes 0 n |
| 31 | if ne wrote long n |
| 32 | ret wrote |
| 33 | end |
| 34 | cpufence |
| 35 | ret wrote |
| 36 | end |