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 / gsp / sysinfo.om

709 lines · 21270 bytes Raw Blame History
1note gsp/sysinfo.om: the GspSystemInfo payload of GSP_SET_SYSTEM_INFO (RPC 72, 936 bytes) in seeded Omega.
2note Port of aien-dev/aienux PR #441 native/kernel/tools/ck_gsp_sysinfo_encode.c (encode, the fields
3note table, the slurped-text rules). The 72 field offsets and sizes are that tool's table, which its
4note nvhdr gate checks against NVIDIA's GspSystemInfo (open-gpu-kernel-modules 580.173.02,
5note src/nvidia/generated/g_rpc-structures.h via gsp_static_config.h). Little endian, every byte not set is 0.
6note Library unit: no main. Name prefix si / SI only.
7note
8note API (all state is in globals; a global can never be an argument):
9note sireset load the table, clear values, seen marks, set order and siout. Call first.
10note siseti k v set field k (0..71, the order below) to v; long code
11note sisetn v set the field named sinam[0..sinl) to v; long code
12note sitext n parse sitxt[0..n) as the C tool's "field value" lines; long code; the set
13note order (siord[0..sinord)) lets a caller echo each accepted line
14note siencode build siout[0..936) from every accepted field
15note sinmk k copy field k's name into sinam/sinl
16note siwhy e put the refusal text of code e into siwb[0..siwl) (the C tool's why string;
17note for siseti/sisetn refusals the "line N: " prefix is left out)
18note codes: 0 SIEOK; -1 SIEIDX index past 71 (API only); -2 SIEREP field repeated; -3 SIEFIT value
19note does not fit the field; -4 SIEUNK unknown field; -5 SIENUM not a number; -6 SIEWANT line is not
20note "field value"; -7 SIELONG line of 512 bytes or more; -8 SIEBIG text over 65536 bytes (.om only, the
21note C slurps any size); -9 SIENIT sireset not called (.om only).
22note A refused set leaves the field unset; a refused sitext ends at the refused line (lines before it
23note stay set, as the C tool's partial echo shows), and the caller must not send siout then.
24note
25note Field sources for ogd on GB10 (VFIO userspace; nvidia.ko fill sites in open-gpu-kernel-modules
26note 580.173.02; every NVIDIA path below is under src/nvidia/ unless it starts with kernel-open/). All
27note fields are written by rpcGspSetSystemInfo_v17_00, src/kernel/vgpu/rpc.c:10493-10658. Window-1
28note values (hex) and their DOCUMENTED/OBSERVED/INFERRED/ASSUMED tags are in aienux
29note evidence/own-gpu-driver/rung2/system_info.txt. Source classes:
30note CFG = the GPU's own PCI config space, read through the VFIO config region (index 7)
31note RP = the upstream root port's config space (outside the VFIO group: sysfs config, read-only)
32note CONST = fixed for GB10B / this host build, documented in the NVIDIA source
33note OS = host kernel constant
34note DRV = ogd's own allocation
35note LIVE = only a live read on the running GPU gives it
36note field src nvidia.ko fill site GB10 value
37note gpuPhysAddr CFG rpc.c:10525 <- gpu_mgr.c:1967 <- osinit.c:738 0x24000000
38note (nv->regs->cpu_address, BAR0 start, nv-pci.c:1500-1502);
39note ogd: BAR0/BAR1 dwords 0x10/0x14 of the config region or the
40note sysfs resource file. LIVE per boot (PCI assignment).
41note gpuPhysFbAddr CONST rpc.c:10526 <- osinit.c:739 (nv->fb, no FB BAR) 0
42note gpuPhysInstAddr CFG rpc.c:10527 <- gpu_mgr.c:1994 (BAR0 + 0x700000) 0x24700000
43note gpuPhysIoAddr CONST rpc.c:10528 0
44note nvDomainBusDeviceFunc CFG rpc.c:10529 <- osinit.c:764, osinit.c:144-147, 0xf00000100
45note g_gpu_nvoc.h:502-507; ogd: the BDF it opened (000f:01:00.0)
46note simAccessBufPhysAddr CONST rpc.c:10562-10569 (0 outside simulation) 0
47note notifyOpSharedSurfacePhysAddr DRV rpc.c:10571-10578, kernel_gsp.c:3489-3526; ogd's IOVA of its
48note notify-op page (IOMMU_MAP_DMA). LIVE per boot.
49note pcieAtomicsOpMask RP rpc.c:10579 <- kernel_bif_gh100.c:620-642 (root port 0x7
50note DevCap2 AtomicOp completer bits). INFERRED, needs RP read.
51note consoleMemSize CONST rpc.c:10583 (no console reservation on GB10, UNKNOWN) 0
52note maxUserVa OS rpc.c:10584 <- os.c:720 <- os-interface.c:1128-1131 0x1000000000000
53note (TASK_SIZE; 48-bit VA arm64 kernel)
54note pciConfigMirrorBase CONST rpc.c:10540 <- kernel_bif_gh100.c:593-604, bound to 0x92000
55note GB10B at g_kernel_bif_nvoc.c:965-968
56note pciConfigMirrorSize CONST same 0x1000
57note PCIDeviceID CFG rpc.c:10533 <- kern_gpu_gb100.c:967 (config 0x00) 0x2e1210de
58note PCISubDeviceID CFG rpc.c:10534 <- kern_gpu_gb100.c:959 (config 0x2c) 0x10de
59note PCIRevisionID CFG rpc.c:10535 <- kern_gpu_gb100.c:950 (config 0x08) 0xa1
60note pcieAtomicsCplDeviceCapMask CFG rpc.c:10581 <- kernel_bif_gb10b.c:30-60 (GPU DevCap2) 0
61note oorArch CONST rpc.c:10530 <- gpu_mgr.c:1539 (OOR_ARCH_AARCH64) 3
62note clPdbProperties RP rpc.c:10590 clSyncWithGsp, chipset.c:765 0x1088020c1
63note (properties set while probing the root port). INFERRED.
64note Chipset RP chipset.c:812 (nvcst.h:300, 0x22d1 -> CS_NVIDIA_T254) 0x106d
65note bGpuBehindBridge RP rpc.c:10600-10604 0
66note bFlrSupported CFG rpc.c:10555 <- kbifCacheFlrSupport_GH100 1
67note kernel_bif_gh100.c:1099 (config 0x64 DevCap bit 28)
68note b64bBar0Supported CFG rpc.c:10556 <- kbifCache64bBar0Support_GH100 1
69note kernel_bif_gh100.c:1131 (BAR0 type bits)
70note bMnocAvailable CONST rpc.c:10549 0
71note chipsetL1ssEnable RP rpc.c:10552 (root port L1 PM substates) 0
72note bUpstreamL0sUnsupported RP rpc.c:10600-10604 0
73note bUpstreamL1Unsupported RP rpc.c:10600-10604 0
74note bUpstreamL1PorSupported RP rpc.c:10600-10604 0
75note bUpstreamL1PorMobileOnly RP rpc.c:10600-10604 0
76note bSystemHasMux CONST rpc.c:10597 0
77note upstreamAddressValid RP rpc.c:10605 1
78note FHBBusInfo.deviceID .. revisionID RP chipset.c:813 (bus info chipset.c:335-338) 0x22d1, 0x10de
79note chipsetIDInfo.deviceID .. rev RP chipset.c:814 0x22d1, 0x10de
80note acpiMethodData.bValid CONST rpc.c:10596 <- acpi_common.c:1131 1
81note acpiMethodData.dodMethodData.* CONST acpi_common.c:1134-1136 (_DOD absent: status 0xffff, 0xffff, 64
82note acpiIdListLen = sizeof list)
83note acpiMethodData.jt/capsMethodData CONST acpi_common.c (status of absent methods) 0x56, 0x56
84note hypervisorType CONST rpc.c:10607 <- hypervisor.c:51,58 (OS_HYPERVISOR_UNKNOWN) 4
85note virtualConfigBits, bIsPassthru CONST rpc.c:10608-10609 0
86note sysTimerOffsetNs LIVE rpc.c:10622 <- timer_gb10b.c:52-77 (OS ns - PTIMER ns) 0 (UNKNOWN)
87note needs a PTIMER read in the window, just before the send
88note gspVFInfo.* CFG rpc.c:10612-10619 (no SR-IOV capability) 0
89note bIsPrimary CONST rpc.c:10624 (UNKNOWN; console owner) 0
90note bIsUnixHdmiFrlComplianceEnabled CONST rpc.c:10625 <- g_gpu_nvoc.c:350 1
91note isGridBuild, gridBuildCsp CONST rpc.c:10629, :10631 0
92note pcieConfigReg.linkCap CFG rpc.c:10559 (config 0x6c, PCIe Link Capabilities) 0x457901
93note bPreserveVideoMemoryAllocations CONST rpc.c:10632 0
94note bTdrEventSupported CONST rpc.c:10635 0
95note bFeatureStretchVblankCapable CONST rpc.c:10640 0
96note bEnableDynamicGranularityPageArrays CONST rpc.c:10585 0
97note bClockBoostSupported CONST rpc.c:10647 0
98note hostPageSize OS rpc.c:10593 <- os.c:4421 (os_page_size) 4096
99note bIsCmcBasedHws CONST never assigned in 580.173.02 (stays 0) 0
100note bGspNocatEnabled CONST rpc.c:10649-10652 (Windows only) 0
101note bS0ixSupport CONST rpc.c:10627 0
102note bWindowChannelAlwaysMapped CONST rpc.c:10641 <- g_kern_disp_nvoc.c:305 1
103note Values only a live read gives: gpuPhysAddr/gpuPhysInstAddr (BAR assignment), the CFG ids, linkCap,
104note FLR and BAR0-64-bit bits (config region), the RP fields (root-port config), sysTimerOffsetNs (PTIMER
105note at send time) and notifyOpSharedSurfacePhysAddr (ogd's own DMA mapping). Nothing here reads them:
106note the caller supplies every value. Nothing here has run on the chip.
107const SINF ulong 72
108const SISIZE ulong 936
109note a line of 512 bytes or more is refused (the C tool's char buf[512])
110const SILINE ulong 512
111note the text buffer: 65536 bytes (the C tool slurps any size; .om refuses more, SIEBIG)
112const SITXMAX ulong 65536
113const SIMAX64 ulong 18446744073709551615
114const SIEOK long 0
115const SIEIDX long -1
116const SIEREP long -2
117const SIEFIT long -3
118const SIEUNK long -4
119const SIENUM long -5
120const SIEWANT long -6
121const SIELONG long -7
122const SIEBIG long -8
123const SIENIT long -9
124note the 72 field names in table order, each followed by one space
125text sinames "gpuPhysAddr gpuPhysFbAddr gpuPhysInstAddr gpuPhysIoAddr nvDomainBusDeviceFunc simAccessBufPhysAddr notifyOpSharedSurfacePhysAddr pcieAtomicsOpMask consoleMemSize maxUserVa pciConfigMirrorBase pciConfigMirrorSize PCIDeviceID PCISubDeviceID PCIRevisionID pcieAtomicsCplDeviceCapMask oorArch clPdbProperties Chipset bGpuBehindBridge bFlrSupported b64bBar0Supported bMnocAvailable chipsetL1ssEnable bUpstreamL0sUnsupported bUpstreamL1Unsupported bUpstreamL1PorSupported bUpstreamL1PorMobileOnly bSystemHasMux upstreamAddressValid FHBBusInfo.deviceID FHBBusInfo.vendorID FHBBusInfo.subdeviceID FHBBusInfo.subvendorID FHBBusInfo.revisionID chipsetIDInfo.deviceID chipsetIDInfo.vendorID chipsetIDInfo.subdeviceID chipsetIDInfo.subvendorID chipsetIDInfo.revisionID acpiMethodData.bValid acpiMethodData.dodMethodData.status acpiMethodData.dodMethodData.acpiIdListLen acpiMethodData.jtMethodData.status acpiMethodData.capsMethodData.status hypervisorType virtualConfigBits bIsPassthru sysTimerOffsetNs gspVFInfo.totalVFs gspVFInfo.firstVFOffset gspVFInfo.FirstVFBar0Address gspVFInfo.FirstVFBar1Address gspVFInfo.FirstVFBar2Address gspVFInfo.b64bitBar0 gspVFInfo.b64bitBar1 gspVFInfo.b64bitBar2 bIsPrimary bIsUnixHdmiFrlComplianceEnabled isGridBuild pcieConfigReg.linkCap gridBuildCsp bPreserveVideoMemoryAllocations bTdrEventSupported bFeatureStretchVblankCapable bEnableDynamicGranularityPageArrays bClockBoostSupported hostPageSize bIsCmcBasedHws bGspNocatEnabled bS0ixSupport bWindowChannelAlwaysMapped "
126note refusal fragments, each ended by | (124): 0 "line " 1 " too long" 2 ": " 3 want 4 unknown field
127note 5 "field " 6 " repeated" 7 " is not a number" 8 " does not fit " 9 " (" 10 " bytes)" 11 index
128note 12 too big 13 not reset
129text siwt "line | too long|: |want \"field value\"|unknown field |field | repeated| is not a number| does not fit | (| bytes)|field index out of range|text over 65536 bytes|sireset not called|"
130global sioff ulong 72
131global sisz ulong 72
132global sival ulong 72
133global siseen uchar 72
134global siord ulong 72
135global sinord ulong 1
136global siout uchar 936
137global sitxt uchar 65536
138note name and value tokens of the current line (or of the last siseti/sisetn call)
139global sinam uchar 128
140global sinl ulong 1
141global sivb uchar 128
142global sivl ulong 1
143note line number of the last refusal (0 = an API call), field index of the current line, parser cursor
144global siline ulong 1
145global sifld ulong 1
146global sipos ulong 1
147global sinv ulong 1
148global siwb uchar 256
149global siwl ulong 1
150fn sireset to void
151put sioff 0 0
152put sisz 0 8
153put sioff 1 8
154put sisz 1 8
155put sioff 2 16
156put sisz 2 8
157put sioff 3 24
158put sisz 3 8
159put sioff 4 32
160put sisz 4 8
161put sioff 5 40
162put sisz 5 8
163put sioff 6 48
164put sisz 6 8
165put sioff 7 56
166put sisz 7 8
167put sioff 8 64
168put sisz 8 8
169put sioff 9 72
170put sisz 9 8
171put sioff 10 80
172put sisz 10 4
173put sioff 11 84
174put sisz 11 4
175put sioff 12 88
176put sisz 12 4
177put sioff 13 92
178put sisz 13 4
179put sioff 14 96
180put sisz 14 4
181put sioff 15 100
182put sisz 15 4
183put sioff 16 104
184put sisz 16 1
185put sioff 17 112
186put sisz 17 8
187put sioff 18 120
188put sisz 18 4
189put sioff 19 124
190put sisz 19 1
191put sioff 20 125
192put sisz 20 1
193put sioff 21 126
194put sisz 21 1
195put sioff 22 127
196put sisz 22 1
197put sioff 23 128
198put sisz 23 4
199put sioff 24 132
200put sisz 24 1
201put sioff 25 133
202put sisz 25 1
203put sioff 26 134
204put sisz 26 1
205put sioff 27 135
206put sisz 27 1
207put sioff 28 136
208put sisz 28 1
209put sioff 29 137
210put sisz 29 1
211put sioff 30 138
212put sisz 30 2
213put sioff 31 140
214put sisz 31 2
215put sioff 32 142
216put sisz 32 2
217put sioff 33 144
218put sisz 33 2
219put sioff 34 146
220put sisz 34 1
221put sioff 35 148
222put sisz 35 2
223put sioff 36 150
224put sisz 36 2
225put sioff 37 152
226put sisz 37 2
227put sioff 38 154
228put sisz 38 2
229put sioff 39 156
230put sisz 39 1
231put sioff 40 160
232put sisz 40 1
233put sioff 41 164
234put sisz 41 4
235put sioff 42 168
236put sisz 42 4
237put sioff 43 236
238put sisz 43 4
239put sioff 44 828
240put sisz 44 4
241put sioff 45 836
242put sisz 45 4
243put sioff 46 840
244put sisz 46 2
245put sioff 47 842
246put sisz 47 1
247put sioff 48 848
248put sisz 48 8
249put sioff 49 856
250put sisz 49 4
251put sioff 50 860
252put sisz 50 4
253put sioff 51 864
254put sisz 51 8
255put sioff 52 872
256put sisz 52 8
257put sioff 53 880
258put sisz 53 8
259put sioff 54 888
260put sisz 54 1
261put sioff 55 889
262put sisz 55 1
263put sioff 56 890
264put sisz 56 1
265put sioff 57 896
266put sisz 57 1
267put sioff 58 897
268put sisz 58 1
269put sioff 59 898
270put sisz 59 1
271put sioff 60 900
272put sisz 60 4
273put sioff 61 904
274put sisz 61 4
275put sioff 62 908
276put sisz 62 1
277put sioff 63 909
278put sisz 63 1
279put sioff 64 910
280put sisz 64 1
281put sioff 65 911
282put sisz 65 1
283put sioff 66 912
284put sisz 66 1
285put sioff 67 920
286put sisz 67 8
287put sioff 68 928
288put sisz 68 1
289put sioff 69 929
290put sisz 69 1
291put sioff 70 930
292put sisz 70 1
293put sioff 71 931
294put sisz 71 1
295for k ulong SINF
296put sival k 0
297put siseen k 0
298put siord k 0
299end
300for i ulong SISIZE
301put siout i 0
302end
303put sinord 0 0
304put siline 0 0
305put sinl 0 0
306put sivl 0 0
307put siwl 0 0
308end
309note the field's value fits its size (8-byte fields take any value)
310fn sifits k ulong v ulong to bool
311sz = get sisz k
312if lt sz 8
313ret eq shr v mul sz 8 0
314end
315ret true
316end
317fn sistore k ulong v ulong to long
318if ge k SINF
319ret SIEIDX
320end
321if ne get siseen k 0
322ret SIEREP
323end
324if not sifits k v
325ret SIEFIT
326end
327put siseen k 1
328put sival k v
329n = get sinord 0
330put siord n k
331put sinord 0 add n 1
332ret SIEOK
333end
334note name k into sinam/sinl
335fn sinmk k ulong to void
336w = ulong 0
337o = ulong 0
338for i ulong len sinames
339c = get sinames i
340if eq c 32
341w = add w 1
342else
343if eq w k
344put sinam o c
345o = add o 1
346end
347end
348end
349put sinl 0 o
350end
351fn sieqat s ulong n ulong to bool
352for j ulong n
353if ne get sinames add s j get sinam j
354ret false
355end
356end
357ret true
358end
359note index of the field named sinam[0..sinl), SINF when none
360fn silook to ulong
361k = ulong 0
362s = ulong 0
363n = get sinl 0
364for i ulong len sinames
365if eq get sinames i 32
366if eq sub i s n
367if sieqat s n
368ret k
369end
370end
371k = add k 1
372s = add i 1
373end
374end
375ret SINF
376end
377note sivb[0..sivl) as "%#llx" of v (API path only)
378fn sihexv v ulong to void
379put sivb 0 48
380if eq v 0
381put sivl 0 1
382ret
383end
384put sivb 1 120
385nd = ulong 0
386t = v
387while ne t 0 bound 17
388nd = add nd 1
389t = shr t 4
390end
391for i ulong nd
392d = and shr v mul sub sub nd i 1 4 15
393if lt d 10
394put sivb add i 2 uchar add d 48
395else
396put sivb add i 2 uchar add d 87
397end
398end
399put sivl 0 add nd 2
400end
401fn siseti k ulong v ulong to long
402put siline 0 0
403if eq get sisz 0 0
404ret SIENIT
405end
406if lt k SINF
407sinmk k
408put sifld 0 k
409end
410sihexv v
411r = sistore k v
412ret r
413end
414fn sisetn v ulong to long
415put siline 0 0
416if eq get sisz 0 0
417ret SIENIT
418end
419k = silook
420if eq k SINF
421sihexv v
422ret SIEUNK
423end
424r = siseti k v
425ret r
426end
427fn siencode to void
428for i ulong SISIZE
429put siout i 0
430end
431for k ulong SINF
432if ne get siseen k 0
433v = get sival k
434o = get sioff k
435for b ulong get sisz k
436put siout add o b uchar and shr v mul b 8 255
437end
438end
439end
440end
441note C isspace: \t \n \v \f \r (9..13) and space (32)
442fn siws c uchar to bool
443ret or eq c 32 and ge c 9 le c 13
444end
445fn siskip b ulong to void
446p = get sipos 0
447while lt p b bound 600
448if not siws get sitxt p
449break
450end
451p = add p 1
452end
453put sipos 0 p
454end
455note one sscanf %127s token from sipos (which 0 = sinam, 1 = sivb, 2 = dropped); returns its length
456fn sitk which ulong b ulong to ulong
457p = get sipos 0
458n = ulong 0
459while and lt p b lt n 127 bound 600
460c = get sitxt p
461if siws c
462break
463end
464if eq which 0
465put sinam n c
466end
467if eq which 1
468put sivb n c
469end
470n = add n 1
471p = add p 1
472end
473put sipos 0 p
474ret n
475end
476note strtoull digit value, 99 for a non-digit
477fn sidig c uchar to ulong
478if and ge c 48 le c 57
479ret sub ulong c 48
480end
481if and ge c 97 le c 102
482ret sub ulong c 87
483end
484if and ge c 65 le c 70
485ret sub ulong c 55
486end
487ret 99
488end
489note sivb[0..sivl) as strtoull(val, &end, 0) with errno == 0, *end == 0 and val[0] != '-' -> sinv
490fn sinum to bool
491n = get sivl 0
492if eq get sivb 0 45
493ret false
494end
495i = ulong 0
496if eq get sivb 0 43
497i = 1
498end
499base = ulong 10
500if lt i n
501if eq get sivb i 48
502base = 8
503if lt add i 2 n
504x = get sivb add i 1
505if or eq x 120 eq x 88
506if lt sidig get sivb add i 2 16
507base = 16
508i = add i 2
509end
510end
511end
512end
513end
514v = ulong 0
515nd = ulong 0
516ovf = false
517while lt i n bound 200
518d = sidig get sivb i
519if ge d base
520break
521end
522if gt v div sub SIMAX64 d base
523ovf = true
524else
525v = add mul v base d
526end
527nd = add nd 1
528i = add i 1
529end
530put sinv 0 v
531ret and and gt nd 0 eq i n not ovf
532end
533note one line sitxt[a..b) after the # cut: 1 blank, else a code
534fn sidoln a ulong b ulong to long
535put sipos 0 a
536siskip b
537if eq get sipos 0 b
538ret 1
539end
540put sinl 0 sitk 0 b
541siskip b
542if eq get sipos 0 b
543ret SIEWANT
544end
545put sivl 0 sitk 1 b
546siskip b
547if ne get sipos 0 b
548ret SIEWANT
549end
550k = silook
551put sifld 0 k
552if eq k SINF
553ret SIEUNK
554end
555if ne get siseen k 0
556ret SIEREP
557end
558if not sinum
559ret SIENUM
560end
561r = sistore k get sinv 0
562ret r
563end
564fn sieol p ulong m ulong to ulong
565e = p
566while lt e m bound 70000
567if eq get sitxt e 10
568break
569end
570e = add e 1
571end
572ret e
573end
574fn sihash p ulong e ulong to ulong
575h = p
576while lt h e bound 600
577if eq get sitxt h 35
578break
579end
580h = add h 1
581end
582ret h
583end
584fn sitext n ulong to long
585put siline 0 0
586if eq get sisz 0 0
587ret SIENIT
588end
589if gt n SITXMAX
590ret SIEBIG
591end
592note the C tool reads a NUL-terminated string: the text ends at the first NUL byte
593m = n
594for i ulong n
595if eq get sitxt i 0
596m = i
597break
598end
599end
600p = ulong 0
601ln = ulong 0
602while lt p m bound 70000
603ln = add ln 1
604put siline 0 ln
605e = sieol p m
606if ge sub e p SILINE
607ret SIELONG
608end
609r = sidoln p sihash p e
610if lt r 0
611ret r
612end
613p = add e 1
614end
615put siline 0 0
616ret SIEOK
617end
618fn siwc c uchar to void
619n = get siwl 0
620if lt n 256
621put siwb n c
622put siwl 0 add n 1
623end
624end
625note fragment k of siwt
626fn siwfr k ulong to void
627w = ulong 0
628for i ulong len siwt
629c = get siwt i
630if eq c 124
631w = add w 1
632else
633if eq w k
634siwc c
635end
636end
637end
638end
639fn siwdec v ulong to void
640d = ulong 1
641while le d div v 10 bound 20
642d = mul d 10
643end
644while ne d 0 bound 20
645siwc uchar add rem div v d 10 48
646d = div d 10
647end
648end
649fn siwnam mx ulong to void
650for i ulong get sinl 0
651if lt i mx
652siwc get sinam i
653end
654end
655end
656fn siwval mx ulong to void
657for i ulong get sivl 0
658if lt i mx
659siwc get sivb i
660end
661end
662end
663note the refusal text of e (the C tool's why string) into siwb[0..siwl)
664fn siwhy e long to void
665put siwl 0 0
666ln = get siline 0
667if ne ln 0
668siwfr 0
669siwdec ln
670if eq e SIELONG
671siwfr 1
672ret
673end
674siwfr 2
675end
676if eq e SIEWANT
677siwfr 3
678end
679if eq e SIEUNK
680siwfr 4
681siwnam 128
682end
683if eq e SIEREP
684siwfr 5
685siwnam 128
686siwfr 6
687end
688if eq e SIENUM
689siwval 128
690siwfr 7
691end
692if eq e SIEFIT
693siwval 40
694siwfr 8
695siwnam 60
696siwfr 9
697siwdec get sisz get sifld 0
698siwfr 10
699end
700if eq e SIEIDX
701siwfr 11
702end
703if eq e SIEBIG
704siwfr 12
705end
706if eq e SIENIT
707siwfr 13
708end
709end