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 / dev / hdev.om

93 lines · 2291 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Fake-device only: no NVIDIA device is opened. Linux ABI constants are checked against libc in dcall.c.
3om2
4export fn nread fd long to long
5b = new uchar 4 0
6r = devctl int fd uint 21531 b 0 4
7if lt r 0
8ret r
9end
10ret long or or or uint get b 0 shl uint get b 1 8 shl uint get b 2 16 shl uint get b 3 24
11end
12export fn ctl fd long to long
13b = new uchar 48 0
14ret devctl int fd uint 3224389163 b 0 48
15end
16export fn call fd long to long
17h = new uchar 32 0
18p = new uchar 16 0
19ret devcall int fd uint 3223340587 h 0 32 p 0 16
20end
21export fn uvm fd long to long
22b = new uchar 8 0
23ret uvmctl int fd uint 75 b 0 8
24end
25export fn mapping fd long to long
26ret mapnew int fd 0 4096 3 1
27end
28export fn anon to long
29ret mapnew neg int 1 0 4096 3 34
30end
31export fn address h long to ulong
32ret mapaddr h
33end
34export fn drop h long to long
35ret mapdrop h
36end
37export fn publish h long v ulong to long
38p = new uchar 16 7
39w = mapwrite h 16 p 0 16
40cpufence
41w = mapset h 8 8 v
42w = mapset h 0 4 1
43ret w
44end
45export fn fetch h long to long
46p = new uchar 16 0
47n = mapread h 16 p 0 16
48v = mapget h 8 8
49ret add long v long get p 15
50end
51export fn rd h long to ulong
52ret mapget h 0 4
53end
54export fn mono to long
55ret monons
56end
57export fn wall to long
58ret realns
59end
60export fn pause n long to long
61ret sleepns n
62end
63export fn reserve addr ulong bytes ulong to long
64ret maphold addr bytes
65end
66export fn attach h long fd long to long
67ret mapbind h int fd 0 3
68end
69export fn store h long to long
70ret mapset h 0 4 1
71end
72note Exact ABI1 requests from the Wolfram-checked compiler aien-ioctl matrix.
73note The oversized backing view leaves the exact-length guard, not bounds, as the short/long oracle.
74export fn aiinfo fd long count ulong to long
75b = new uchar 4096 0
76ret devctl int fd uint 2154840336 b 0 count
77end
78export fn aialloc fd long count ulong to long
79b = new uchar 4096 0
80ret devctl int fd uint 3224387873 b 0 count
81end
82export fn aifree fd long count ulong to long
83b = new uchar 4096 0
84ret devctl int fd uint 3222815010 b 0 count
85end
86export fn aicreate fd long count ulong to long
87b = new uchar 4096 0
88ret devctl int fd uint 3225960739 b 0 count
89end
90export fn aidrop fd long count ulong to long
91b = new uchar 4096 0
92ret devctl int fd uint 3222815012 b 0 count
93end