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/gsp/sec2.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 / gsp / sec2.om` 174 lines ยท 3411 bytes Raw Blame History 1 note GB20B SEC2 COTv2 exchange, NVIDIA580.173.02@`20e4e6e` kernel_sec2_gb20b.c. 2 note Requires mmio.om, profile.om, sim.om and sec2sim.om. No launcher/admission supplied. 3 note s2cfg: profile,package,secureBootPollBudget,responsePollBudget,silicon,SEC2present,FMCenabled. 4 note Package2 asserts gb20y + GB20B boot/FMC source; not authentication. Warm/resume/CC unsupported. 5 note Vendor secure-boot deadline is max(scaled4s,default); caller supplies bounded polls with its OS timer. 6 note WolframLanguageEvaluator FromDigits /@ {1B,5E0,840C80,840C84,C0000000,1510DE7E} -> {27,1504,`8653952`,`8653956`,`3221225472`,`353427070`}; 2^25 ->`33554432`. 7 const S2SCR ulong 1504 8 const S2MH ulong `8653952` 9 const S2MT ulong `8653956` 10 const S2AINCR ulong `33554432` 11 const S2IC ulong 128 12 const S2OFFMSK ulong 65532 13 const S2DWMSK ulong 16383 14 global s2cfg ulong 7 15 global s2reply uchar 1024 16 global s2out ulong 4 17 fn s2rd off ulong to ulong 18 if eq get gspmode 0 0 19 ret s2simrd off 20 end 21 ret gsprd off 22 end 23 fn s2wr off ulong v ulong to void 24 if eq get gspmode 0 0 25 s2simwr off v 26 ret 27 end 28 gspwr off v 29 end 30 fn s2wait kind ulong budget ulong to bool 31 for i ulong add budget 1 32 if eq kind 0 33 if eq s2rd S2SCR 255 34 put s2out 0 i 35 ret true 36 end 37 else 38 h = s2rd S2MH 39 t = s2rd S2MT 40 if ne h t 41 put s2out 1 i 42 ret true 43 end 44 end 45 if lt i budget 46 gsppause 47 end 48 end 49 ret false 50 end 51 fn s2get o ulong to ulong 52 v = ulong 0 53 for i ulong 4 54 v = or v shl ulong get s2reply add o i mul i 8 55 end 56 ret v 57 end 58 fn s2save o ulong v ulong to void 59 for j ulong 4 60 c = and shr v mul j 8 255 61 put s2reply add o j uchar c 62 end 63 end 64 fn s2response to long 65 h = s2rd S2MH 66 t = s2rd S2MT 67 n = add and sub t h M32 4 68 if or or lt n 20 gt n CHBYTES ne rem n 4 0 69 ret -12 70 end 71 s0 = or S2AINCR and h S2OFFMSK 72 st = ememdw s0 73 s2wr S2EMC s0 74 for i ulong div n 4 75 v = s2rd S2EMD 76 s2save mul i 4 v 77 end 78 e = ememdw s2rd S2EMC 79 note Vendor acknowledges the packet even when its final offset check fails. 80 s2wr S2MT h 81 s2wr S2MH h 82 if ne and sub e st S2DWMSK div n 4 83 ret -12 84 end 85 note Single-packet response, vendor PCI 10de, SEC2_RESPONSE; payload starts at byte7. 86 if ne and s2get 0 `3221225472` `3221225472` 87 ret -12 88 end 89 if ne and s2get 4 not S2IC `353427070` 90 ret -12 91 end 92 put s2out 2 s2get 8 93 put s2out 3 s2get 16 94 if ne s2get 12 20 95 ret -12 96 end 97 if ne get s2out 3 0 98 ret -13 99 end 100 ret 0 101 end 102 fn s2pkt o ulong to ulong 103 v = ulong 0 104 for i ulong 4 105 v = or v shl ulong get gpkt add o i mul i 8 106 end 107 ret v 108 end 109 fn s2boot boot42 uint to long 110 for i ulong 4 111 put s2out i 0 112 end 113 if or ne gpclass boot42 2 ne get s2cfg 0 2 114 ret gspfail EARG 115 end 116 if ne get s2cfg 1 2 117 ret gspfail EARG 118 end 119 for i ulong 3 120 if ne get s2cfg add i 4 1 121 ret gspfail EARG 122 end 123 end 124 for i ulong 2 125 if gt get s2cfg add i 2 999998 126 ret gspfail EARG 127 end 128 end 129 if ne get gin 0 868 130 ret gspfail EARG 131 end 132 note Check complete profile header before any register effects; COT version2,size860 and no FRTS. 133 if or ne s2pkt 0 `3221225472` ne s2pkt 4 `336649854` 134 ret gspfail EARG 135 end 136 if ne s2pkt 8 `56360962` 137 ret gspfail EARG 138 end 139 for i ulong 6 140 if ne s2pkt add 20 mul i 4 0 141 ret gspfail EARG 142 end 143 end 144 if not gsppm 145 ret gspfail EPM 146 end 147 if not s2wait 0 get s2cfg 2 148 ret gspfail -10 149 end 150 if not pollstep 0 151 ret gspfail EBUSY 152 end 153 s2wr S2EMC AINCW 154 for i ulong 217 155 v = ulong 0 156 for j ulong 4 157 v = or v shl ulong get gpkt add mul i 4 j mul j 8 158 end 159 s2wr S2EMD v 160 end 161 if ne ememdw s2rd S2EMC 217 162 ret gspfail EEMEM 163 end 164 s2wr S2QT 864 165 s2wr S2QH 0 166 if not s2wait 1 get s2cfg 3 167 ret gspfail -11 168 end 169 r = s2response 170 if ne r 0 171 ret gspfail r 172 end 173 ret gspfinish 174 end