interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / driver / uvm / fault.om

124 lines · 2938 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note uvm/fault.om: NVC369 32-byte fault packet and the replay policy.
3note Word 2 holds page-number bits 19:0 at 31:12. Word 3 holds bits 51:20.
4note Word 4 is timestamp 31:0, word 5 is timestamp 63:32. Word 7 is
5note type 4:0, replayable 7:7, client 14:8, access 19:16, enable 30:30, valid 31:31.
6note Policy: invalid packet is ignored. A non-replayable packet, a disabled engine,
7note or a type other than PDE (0), PTE (1) or LIMIT (2) is fatal. A valid replayable
8note fault outside a reservation, or inside one with no backing, is cancelled.
9note A write or atomic on a read-only reservation is fatal. Otherwise the missing
10note page is mapped from the reservation backing and the fault is replayed.
11global uvpkt uchar 32
12global uvfva ulong 1
13global uvfts ulong 1
14global uvftyp ulong 1
15global uvfrep ulong 1
16global uvfacc ulong 1
17global uvfcli ulong 1
18global uvfen ulong 1
19global uvfval ulong 1
20fn uvpktw n ulong v ulong to void
21b = mul n 4
22put uvpkt b uchar and v 255
23put uvpkt add b 1 uchar and shr v 8 255
24put uvpkt add b 2 uchar and shr v 16 255
25put uvpkt add b 3 uchar and shr v 24 255
26end
27fn uvpktlw n ulong to ulong
28b = mul n 4
29v = ulong get uvpkt b
30v = or v shl ulong get uvpkt add b 1 8
31v = or v shl ulong get uvpkt add b 2 16
32ret or v shl ulong get uvpkt add b 3 24
33end
34fn uvpktenc va ulong ts ulong typ ulong rep ulong acc ulong cli ulong to void
35for i ulong 32
36put uvpkt i 0
37end
38uvpktw 2 shl and shr va 12 1048575 12
39uvpktw 3 shr va 32
40uvpktw 4 and ts 4294967295
41uvpktw 5 shr ts 32
42w = and typ 31
43w = or w shl and rep 1 7
44w = or w shl and cli 127 8
45w = or w shl and acc 15 16
46w = or w shl and get uvfen 0 1 30
47w = or w shl and get uvfval 0 1 31
48uvpktw 7 w
49end
50fn uvdecva to void
51w2 = uvpktlw 2
52w3 = uvpktlw 3
53put uvfva 0 shl or shr w2 12 shl w3 20 12
54end
55fn uvdects to void
56put uvfts 0 or uvpktlw 4 shl uvpktlw 5 32
57end
58fn uvdecw7 to void
59w = uvpktlw 7
60put uvftyp 0 and w 31
61put uvfrep 0 and shr w 7 1
62put uvfcli 0 and shr w 8 127
63put uvfacc 0 and shr w 16 15
64put uvfen 0 and shr w 30 1
65put uvfval 0 and shr w 31 1
66end
67fn uvpktdec to void
68uvdecva
69uvdects
70uvdecw7
71end
72fn uvpolicy to ulong
73if eq get uvfval 0 0
74ret UVIGN
75end
76if eq get uvfen 0 0
77ret UVFATAL
78end
79if eq get uvfrep 0 0
80ret UVFATAL
81end
82if ge get uvftyp 0 3
83ret UVFATAL
84end
85i = uvfind get uvfva 0
86if ge i 32
87ret UVCANCEL
88end
89if eq get uvrpa i 0
90ret UVCANCEL
91end
92if and ne get uvrro i 0 or eq get uvfacc 0 1 eq get uvfacc 0 2
93ret UVFATAL
94end
95ret UVREPLAY
96end
97fn uvserve to ulong
98uvpktdec
99act = uvpolicy
100if ne act UVREPLAY
101ret act
102end
103ret uvfix
104end
105fn uvfix to ulong
106i = uvfind get uvfva 0
107page = get uvrpg i
108base = get uvrva i
109off = and sub get uvfva 0 base not sub page 1
110pa = add get uvrpa i off
111r = uvread add base off page
112if eq r UVMAPPED
113ret UVREPLAY
114end
115pcf = ulong 0
116if ne get uvrro i 0
117pcf = 4
118end
119r2 = uvmap add base off pa page page UVAPSYS pcf
120if ne r2 UVOK
121ret UVFATAL
122end
123ret UVREPLAY
124end