interplane.Get Omega
Read in your language

omega-gpu-driver

aien-dev/omega-gpu-driver

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-driver / rm / ioctl.om

111 lines · 1627 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note NVIDIA580.173.02 nvos.h, nv-ioctl.h, nv_escape.h; measured by rme_offsets.c.
3note No globals: caller owns the byte image and the 64-slot object namespace.
4fn rmget b view uchar 16384 off ulong n ulong to ulong
5v = ulong 0
6for j ulong n
7v = or v shl ulong get b add off j mul j 8
8end
9ret v
10end
11fn rmput b edit uchar 16384 off ulong n ulong v ulong to void
12for j ulong n
13put b add off j uchar and shr v mul j 8 255
14end
15end
16fn rmsize nr ulong to ulong
17if or eq nr 43 eq nr 42
18ret 32
19end
20if or eq nr 41 or eq nr 206 eq nr 207
21ret 16
22end
23if eq nr 78
24ret 56
25end
26if eq nr 79
27ret 32
28end
29if eq nr 87
30ret 64
31end
32if eq nr 88
33ret 48
34end
35if eq nr 201
36ret 4
37end
38if eq nr 200
39ret 4608
40end
41if eq nr 210
42ret 72
43end
44if eq nr 74
45ret 184
46end
47ret 0
48end
49fn rmdecode cmd ulong to ulong
50nr = and cmd 255
51n = rmsize nr
52if eq n 0
53ret 0
54end
55if ne cmd or or ulong 3221225472 shl n 16 or ulong 17920 nr
56ret 0
57end
58ret n
59end
60fn rmstoff nr ulong to ulong
61if or eq nr 43 eq nr 42
62ret 28
63end
64if or eq nr 41 or eq nr 206 eq nr 207
65ret 12
66end
67if eq nr 78
68ret 40
69end
70if eq nr 79
71ret 24
72end
73if eq nr 87
74ret 56
75end
76if eq nr 88
77ret 40
78end
79if eq nr 74
80ret 20
81end
82ret 0
83end
84note Local categories: invalid argument, stale object, wrong parent, duplicate, capacity, unsupported.
85fn rmstatus code ulong to ulong
86if eq code 0
87ret 0
88end
89if eq code 1
90ret 31
91end
92if eq code 2
93ret 51
94end
95if eq code 3
96ret 54
97end
98if eq code 4
99ret 52
100end
101if eq code 5
102ret 81
103end
104ret 86
105end
106fn rmptr addr ulong n ulong to bool
107if or eq addr 0 ge addr ulong 281474976710656
108ret false
109end
110ret le n sub ulong 281474976710656 addr
111end