Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/gpu/driver/rm/dispatch.om # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / driver / rm / dispatch.om` 263 lines ยท 4201 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Explicit replay/model only. Existing params/rpc units own record and frame codecs. 3 fn rmpsize cls ulong to long 4 if or eq cls 62 eq cls 64 5 ret 128 6 end 7 if eq cls 112 8 ret 24 9 end 10 if or eq cls 50017 eq cls 50785 11 ret 0 12 end 13 if eq cls 65 14 ret 0 15 end 16 if eq cls 128 17 ret long PASZDEV 18 end 19 if eq cls 8320 20 ret long PASZSUB 21 end 22 if eq cls 37105 23 ret long PASZVAS 24 end 25 if eq cls 41068 26 ret long PASZTSG 27 end 28 if eq cls 36967 29 ret long PASZCTX 30 end 31 if eq cls 51567 32 ret long PASZCHAN 33 end 34 if eq cls 52928 35 ret 0 36 end 37 ret -1 38 end 39 fn rmcsize cmd ulong to long 40 if eq cmd 517 41 ret 32 42 end 43 if eq cmd `8389121` 44 ret 16 45 end 46 if eq cmd `545264129` 47 ret 32 48 end 49 if eq cmd `545259850` 50 ret 268 51 end 52 if eq cmd PACMSCH 53 ret long PASZSCH 54 end 55 note ctrlc36f.h NVC36F_CTRL_CMD_GPFIFO_GET_WORK_SUBMIT_TOKEN. 56 if eq cmd `3278831880` 57 ret 4 58 end 59 ret -1 60 end 61 fn rmroute t edit ulong 4096 a view ulong 8 f ulong to ulong 62 note rqpeer links host memory only; never MMIO, DMA, VFIO or firmware. 63 rqinit 64 rqpeer 65 n = get palen 0 66 head = ulong 32 67 if eq f 76 68 head = 40 69 end 70 if eq f 10 71 head = 16 72 n = 0 73 end 74 rqclear add head n 75 rqput32 4 0 get a 0 76 if eq f 103 77 rqput32 4 4 get a 1 78 rqput32 4 8 get a 2 79 rqput32 4 12 get a 3 80 rqput32 4 20 n 81 else 82 rqput32 4 4 get a 1 83 rqput32 4 8 get a 2 84 if eq f 76 85 rqput32 4 16 n 86 end 87 end 88 if eq f 10 89 rqput32 4 4 0 90 end 91 for j ulong n 92 put rqpay add head j get pabuf j 93 end 94 logical = add head n 95 if eq f 103 96 logical = 32 97 end 98 r = rqsend f logical add head n true 99 if ne r 0 100 ret 6 101 end 102 put t 411 f 103 put t 412 add get t 412 1 104 note This result belongs to the explicit host model, not a fabricated GSP reply. 105 ret get t 410 106 end 107 fn rmarefs t view ulong 4096 b view uchar 16384 cls ulong cli ulong to bool 108 if eq cls 36967 109 p = rmfind t cli rmget b 76 4 110 if eq p 64 111 ret false 112 end 113 ret rmref t cli rmget b 104 4 37105 get t add mul p 5 3 114 end 115 if eq cls 51567 116 if or ne rmget b 104 4 0 ne rmget b 108 4 0 117 ret false 118 end 119 if ne rmget b 136 4 0 120 ret false 121 end 122 ret rmref t cli rmget b 128 4 36967 rmget b 76 4 123 end 124 ret true 125 end 126 fn rmpay b view uchar 16384 n ulong to void 127 paclr n 128 for j ulong n 129 put pabuf j get b add 104 j 130 end 131 end 132 fn rmacode b view uchar 16384 a view ulong 8 to void 133 if eq get a 3 65 134 r = paroot get a 0 0 135 else 136 rmpay b ulong rmpsize get a 3 137 end 138 end 139 fn rmallocx t edit ulong 4096 b edit uchar 16384 a edit ulong 8 to ulong 140 n = rmpsize get a 3 141 if lt n 0 142 ret 6 143 end 144 if ne rmget b 96 4 ulong n 145 ret 1 146 end 147 if not rmarefs t b get a 3 get a 0 148 ret 3 149 end 150 r = rmaokay t a 151 if ne r 0 152 ret r 153 end 154 if eq get a 3 65 155 put a 0 add get t 400 1 156 put a 2 get a 0 157 end 158 rmacode b a 159 r = rmroute t a 103 160 if ne r 0 161 ret r 162 end 163 r = rmmalloc t b a 164 if ne r 0 165 ret r 166 end 167 if eq get a 3 65 168 put t 400 get a 0 169 put a 1 get a 0 170 end 171 r = rminsert t get a 0 get a 1 get a 2 get a 3 172 rmput b 80 4 get a 2 173 ret 0 174 end 175 fn rmfreex t edit ulong 4096 a edit ulong 8 to ulong 176 slot = rmfslot t get a 0 get a 1 get a 2 177 if lt slot 64 178 ret slot 179 end 180 r = rmroute t a 10 181 if ne r 0 182 ret r 183 end 184 rmkill t get a 0 sub slot 64 185 rmmreap t 186 ret 0 187 end 188 fn rmctrlx t edit ulong 4096 b edit uchar 16384 a view ulong 8 to ulong 189 idx = rmfind t get a 0 get a 1 190 if eq idx 64 191 ret 2 192 end 193 n = rmcsize get a 2 194 if lt n 0 195 ret 6 196 end 197 if or ne rmget b 96 4 ulong n ne get a 3 0 198 ret 1 199 end 200 cmd = get a 2 201 if or eq cmd 517 or eq cmd `8389121` or eq cmd `545264129` eq cmd `545259850` 202 ret rmhostct t b a 203 end 204 cls = get t add mul idx 5 4 205 if eq get a 2 PACMSCH 206 if ne cls 41068 207 ret 3 208 end 209 end 210 if eq get a 2 `3278831880` 211 if ne cls 51567 212 ret 3 213 end 214 end 215 rmpay b ulong n 216 if eq get a 2 PACMSCH 217 r = pasched rmget b 104 1 rmget b 105 1 rmget b 106 1 218 if lt r 0 219 ret 1 220 end 221 end 222 r = rmroute t a 76 223 if ne r 0 224 ret r 225 end 226 if eq get a 2 `3278831880` 227 rmput b 104 4 get a 1 228 end 229 ret 0 230 end 231 fn rmaction t edit ulong 4096 b edit uchar 16384 nr ulong to ulong 232 a = new ulong 8 0 233 for j ulong 4 234 put a j rmget b add 72 mul j 4 4 235 end 236 if eq nr 43 237 ret rmallocx t b a 238 end 239 if eq nr 41 240 ret rmfreex t a 241 end 242 if eq nr 42 243 ret rmctrlx t b a 244 end 245 if or eq nr 78 or eq nr 79 or eq nr 87 eq nr 88 246 ret rmmapping t b nr 247 end 248 if eq nr 74 249 ret rmmheap t b 250 end 251 ret 6 252 end 253 fn rmdispat t edit ulong 4096 b edit uchar 16384 nr ulong to long 254 if or eq nr 200 eq nr 210 255 ret rmhostio t b nr 256 end 257 if eq nr 201 258 ret -95 259 end 260 r = rmaction t b nr 261 rmput b add 72 rmstoff nr 4 rmstatus r 262 ret 0 263 end