interplane.Get Omega
Read in your language

omega-bridge

Omega-first language interoperability: checked conversion backends and native language bindings

Brought by drakestapleton

branch main Branches Tags History

omega-bridge / tests / native / v2 / om3 / fnmap.om

40 lines · 994 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note OM-3 function-mode mapping context run (omega-mv#1008 section 1). CPU memory only:
3note anonymous maps, a PROT_NONE reservation and a memfd. No device, no GPU.
4note Export names match the existing tests/native/v2/dev callers (context.c, cleanup.c).
5om2
6export fn anon to long
7ret mapnew neg int 1 0 4096 3 34
8end
9export fn reserve addr ulong bytes ulong to long
10ret maphold addr bytes
11end
12export fn attach h long fd long to long
13ret mapbind h int fd 0 3
14end
15export fn address h long to ulong
16ret mapaddr h
17end
18export fn drop h long to long
19ret mapdrop h
20end
21export fn publish h long v ulong to long
22p = new uchar 16 7
23w = mapwrite h 16 p 0 16
24cpufence
25w = mapset h 8 8 v
26w = mapset h 0 4 1
27ret w
28end
29export fn fetch h long to long
30p = new uchar 16 0
31n = mapread h 16 p 0 16
32v = mapget h 8 8
33ret add long v long get p 15
34end
35export fn rd h long to ulong
36ret mapget h 0 4
37end
38export fn store h long to long
39ret mapset h 0 4 1
40end