aien-train
AIEN training programme: language-model history, GB10 constraints and the route to training on the project engine. Plans and runnable checks are distinguished.
Brought by drakestapleton
aien-train / native / btwave / gate.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note BTWAVE-P0: Pure Seeded OM-2 Gate & Mutant Harness (native/btwave/gate.om). |
| 3 | note Concatenated after native/btwave/trit.om (reusing FIPS 180-4 SHA-256 primitives) |
| 4 | note and compiled with pinned omc: |
| 5 | note T=$(mktemp -d) |
| 6 | note cat native/btwave/trit.om native/btwave/gate.om | "$OMC" > "$T/gate" |
| 7 | note chmod +x "$T/gate" |
| 8 | note cp -r evidence/BTWAVE-P0 "$T/ev" |
| 9 | note "$T/gate" "$OMC" "$T/ev"; rc=$? |
| 10 | note rm -rf "$T" |
| 11 | note (exit "$rc") |
| 12 | note Zero shell, Python, C, C++, or Rust implementation code. |
| 13 | |
| 14 | global Gomc uchar 512 |
| 15 | global Gomclen ulong 1 |
| 16 | global Gout uchar 512 |
| 17 | global Goutlen ulong 1 |
| 18 | |
| 19 | global Gsrc uchar 131072 |
| 20 | global Gsrclen ulong 1 |
| 21 | global Gmut uchar 131072 |
| 22 | global Gmutlen ulong 1 |
| 23 | global Gexp uchar 65536 |
| 24 | global Gexplen ulong 1 |
| 25 | global Gfile uchar 2097152 |
| 26 | global Gfilelen ulong 1 |
| 27 | global Gtsv uchar 131072 |
| 28 | global Gtsvlen ulong 1 |
| 29 | |
| 30 | global Gtin uchar 128 |
| 31 | global Gtinlen ulong 1 |
| 32 | global Gtbin uchar 128 |
| 33 | global Gtbinlen ulong 1 |
| 34 | global Gtout uchar 128 |
| 35 | global Gtoutlen ulong 1 |
| 36 | |
| 37 | global Gpkt uchar 4096 |
| 38 | global Gpath uchar 1024 |
| 39 | |
| 40 | global Gbsha1 uchar 64 |
| 41 | global Gbsha2 uchar 64 |
| 42 | global Gssha uchar 64 |
| 43 | global Gmsha uchar 64 |
| 44 | global Gosha uchar 64 |
| 45 | |
| 46 | text Sdevnull "/dev/null" |
| 47 | text Sf1 "native/btwave/trit.om" |
| 48 | text Sf2 "native/btwave/ledger.om" |
| 49 | text Sf3 "native/btwave/wave_ipc.om" |
| 50 | text Sf4 "native/btwave/main.om" |
| 51 | text Sexpf "/expected-trace.out" |
| 52 | text Sipcf "/ipc.stdout" |
| 53 | text Srecf "/receipt.tsv" |
| 54 | text Stmpin "/tmp/btwave_g_in_" |
| 55 | text Stmpbin "/tmp/btwave_g_bin_" |
| 56 | text Stmpout "/tmp/btwave_g_out_" |
| 57 | |
| 58 | text PinOmc "f4fa7951816bbd09c5eaaae6692852a70c3c305164b365027c5b683dec7d63e9" |
| 59 | text PinTrace "b0c6399a7ae894148e8e1678a272add68385bdf67d6221044ded82216fb73575" |
| 60 | text PinEmpty "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" |
| 61 | text SipcPref "IPC PASS coreA=16 coreB=17 rounds=8 contrib=240 extract=180 odraft_refused=-10 elapsed_ns=" |
| 62 | |
| 63 | text Hc1 "case" |
| 64 | text Hc2 "build" |
| 65 | text Hc3 "source_sha256" |
| 66 | text Hc4 "compile_rc" |
| 67 | text Hc5 "binary_sha256" |
| 68 | text Hc6 "run_exit" |
| 69 | text Hc7 "stdout_sha256" |
| 70 | text Hc8 "verdict" |
| 71 | |
| 72 | text Tdash "-" |
| 73 | text Torig "original" |
| 74 | text Tself "selftest" |
| 75 | text Ttrace "trace" |
| 76 | text Tipc "ipc" |
| 77 | text Tusage "usage" |
| 78 | text Tcomp "compile" |
| 79 | text Tovfb "overflow-backstop" |
| 80 | text Tovfp "ovf-probe" |
| 81 | text Ttrapt "trap-trit" |
| 82 | text Ttrapd "trap-dup" |
| 83 | text Ttrapr "trap-req" |
| 84 | text Tbadarg "unknown" |
| 85 | text Textra "extra" |
| 86 | |
| 87 | text Tpass "PASS" |
| 88 | text Tscaught "SELFTEST_CAUGHT" |
| 89 | text Tsmiss "SELFTEST_MISSED" |
| 90 | text Tokilled "ORACLE_KILLED" |
| 91 | text Ttrap1 "TRAP1" |
| 92 | text Ttrap9 "TRAP9" |
| 93 | text Ttrap10 "TRAP10" |
| 94 | text Tcref7 "COMPILE_REFUSED_7" |
| 95 | |
| 96 | text Tccor "comparator-corrupt-trace" |
| 97 | text Tcanone "cli-arg-none" |
| 98 | text Tcabad "cli-arg-bad" |
| 99 | text Tcatwo "cli-arg-two" |
| 100 | text Tptrit "probe-trap-trit" |
| 101 | text Tpdup "probe-trap-dup" |
| 102 | text Tpreq "probe-trap-req" |
| 103 | text Tpovf "probe-ovf-guarded" |
| 104 | |
| 105 | text MsgUsage "BTWAVE FAIL usage: btwave-gate <omc_path> <outdir>\n" |
| 106 | text MsgNotRun "BTWAVE NOT_RUN omc sha256 does not match pinned seed/out/omc\n" |
| 107 | text MsgFail "BTWAVE FAIL gate check failed at step " |
| 108 | text MsgPass "BTWAVE PASS mutants_killed=23/23 type_swaps_refused=4/4 trace_sha256=b0c6399a7ae894148e8e1678a272add68385bdf67d6221044ded82216fb73575\n" |
| 109 | |
| 110 | text M01id "m01-guard-opcode" |
| 111 | text M01t "if and ne op 1 ne op 2" |
| 112 | text M01r "if false" |
| 113 | |
| 114 | text M02id "m02-guard-epoch" |
| 115 | text M02t "if ne ulong reqe add get Lstate 0 1" |
| 116 | text M02r "if false" |
| 117 | |
| 118 | text M03id "m03-guard-give-work" |
| 119 | text M03t "if or or eq worku 0 gt worku WMAX ne takeu 0" |
| 120 | text M03r "if false" |
| 121 | |
| 122 | text M04id "m04-guard-h16-tie" |
| 123 | text M04t "decs = h16dec build_rx sym mode" |
| 124 | text M04r "decs = long sym" |
| 125 | |
| 126 | text M05id "m05-guard-active-power" |
| 127 | text M05t "if ne t32pow jw 32" |
| 128 | text M05r "if false" |
| 129 | |
| 130 | text M06id "m06-guard-scale-zero" |
| 131 | text M06t "if or eq sc 0 or lt sc neg VMAX gt sc VMAX" |
| 132 | text M06r "if false" |
| 133 | |
| 134 | text M07id "m07-guard-sha256-rcpt" |
| 135 | text M07t "if not rcpt_eq expr rxr" |
| 136 | text M07r "if false" |
| 137 | |
| 138 | text M08id "m08-guard-take-bounds" |
| 139 | text M08t "if or or eq takeu 0 gt takeu WMAX ne worku 0" |
| 140 | text M08r "if false" |
| 141 | |
| 142 | text M09id "m09-guard-give-first" |
| 143 | text M09t "if not cred_pos curc" |
| 144 | text M09r "if false" |
| 145 | |
| 146 | text M10id "m10-guard-reciprocity" |
| 147 | text M10t "ret le add open g open req open c" |
| 148 | text M10r "ret true" |
| 149 | |
| 150 | text M11id "m11-guard-chain-anchor" |
| 151 | text M11t "anc = xor anc 1" |
| 152 | text M11r "anc = anc" |
| 153 | |
| 154 | text M12id "m12-trit-neg-ident" |
| 155 | text M12t "ret rotr a 32" |
| 156 | text M12r "ret a" |
| 157 | |
| 158 | text M13id "m13-trit-dot-sum" |
| 159 | text M13t "ret sub pp nn" |
| 160 | text M13r "ret add pp nn" |
| 161 | |
| 162 | text M14id "m14-bt6-dark-bias" |
| 163 | text M14t "z = ulong add u 364" |
| 164 | text M14r "z = ulong add u 365" |
| 165 | |
| 166 | text M15id "m15-hc3-14of16-drop" |
| 167 | text M15t "if or lt u -7 gt u 8" |
| 168 | text M15r "if or lt u -6 gt u 7" |
| 169 | |
| 170 | text M16id "m16-h16-allow-4flip-tie" |
| 171 | text M16t "if and le bestd 3 eq ties 1" |
| 172 | text M16r "if le bestd 4" |
| 173 | |
| 174 | text M17id "m17-mutate-before-verdict" |
| 175 | text M17t "curg = GrantJmk get Lstate 2" |
| 176 | text M17r "put Lstate 2 add get Lstate 2 takeu|curg = GrantJmk sub get Lstate 2 takeu" |
| 177 | |
| 178 | text M18id "m18-trap-trit-overlap" |
| 179 | text M18t "n = or shr as 32 and as M32" |
| 180 | text M18r "n = or p shr as 32" |
| 181 | |
| 182 | text M19id "m19-trap-wavedup-holds" |
| 183 | text M19t "ret WaveDupmk or shl u 32 u" |
| 184 | text M19r "ret WaveDupmk or shl u 32 xor u 1" |
| 185 | |
| 186 | text M20id "m20-trap-bt6-requires" |
| 187 | text M20t "u = sub long idx 364" |
| 188 | text M20r "u = sub long idx 363" |
| 189 | |
| 190 | text M21id "m21-vmax-ceiling-blowup" |
| 191 | text M21t "const VMAX long 65536" |
| 192 | text M21r "const VMAX long 9000000000000000000" |
| 193 | |
| 194 | text M22id "m22-coordinated-selftest-blind" |
| 195 | text M22t "rm = rem add mul mulk i addk 3" |
| 196 | text M22r "rm = rem add mul mulk i add addk 1 3" |
| 197 | |
| 198 | text M23id "m23-ipc-peer-wrong-job" |
| 199 | text M23t "decs = h16dec rxw" |
| 200 | text M23r "decs = xor h16dec rxw 1" |
| 201 | text Tipcref "IPC_REFUSED_65" |
| 202 | |
| 203 | text X1id "x1-swap-credit-for-grant" |
| 204 | text X1t "if not recip_ok curc curg reqg" |
| 205 | text X1r "if not recip_ok curc curc reqg" |
| 206 | |
| 207 | text X2id "x2-swap-grant-for-credit" |
| 208 | text X2t "if not recip_ok curc curg reqg" |
| 209 | text X2r "if not recip_ok curg curg reqg" |
| 210 | |
| 211 | text X3id "x3-raw-ulong-as-trit32" |
| 212 | text X3t "decs = h16dec build_rx sym mode" |
| 213 | text X3r "decs = h16dec sym" |
| 214 | |
| 215 | text X4id "x4-swap-grant-as-wavedup" |
| 216 | text X4t "if not wdup_chk wd uint and reqep 0xffff" |
| 217 | text X4r "if not wdup_chk curg uint and reqep 0xffff" |
| 218 | |
| 219 | fn hex_nibble v uint to uchar |
| 220 | if lt v 10 |
| 221 | ret uchar add 48 v |
| 222 | end |
| 223 | ret uchar add 87 v |
| 224 | end |
| 225 | |
| 226 | fn read_src_byte kind ulong idx ulong to uchar |
| 227 | if eq kind 0 |
| 228 | ret get Gfile idx |
| 229 | end |
| 230 | if eq kind 1 |
| 231 | ret get Gexp idx |
| 232 | end |
| 233 | if eq kind 2 |
| 234 | ret get Gsrc idx |
| 235 | end |
| 236 | ret get Gmut idx |
| 237 | end |
| 238 | |
| 239 | fn sha256_gosha_kind kind ulong n ulong to void |
| 240 | s = new uint 8 0 |
| 241 | w = new uint 64 0 |
| 242 | kt = new uint 64 0 |
| 243 | blk = new uchar 64 0 |
| 244 | pad = new uchar 128 0 |
| 245 | dg = new uchar 32 0 |
| 246 | wsiv s |
| 247 | wskinit kt |
| 248 | nb = shr n 6 |
| 249 | for b ulong nb |
| 250 | base = shl b 6 |
| 251 | for j ulong 64 unroll |
| 252 | put blk j read_src_byte kind add base j |
| 253 | end |
| 254 | wscomp s w kt view blk 0 |
| 255 | end |
| 256 | remb = and n 63 |
| 257 | rbase = shl nb 6 |
| 258 | for i ulong remb |
| 259 | put pad i read_src_byte kind add rbase i |
| 260 | end |
| 261 | wsfin s w kt pad n |
| 262 | wsout dg s |
| 263 | for i ulong 32 unroll |
| 264 | bv = uint get dg i |
| 265 | put Gosha mul i 2 hex_nibble and shr bv 4 15 |
| 266 | put Gosha add mul i 2 1 hex_nibble and bv 15 |
| 267 | end |
| 268 | end |
| 269 | |
| 270 | fn save_bsha1 to void |
| 271 | for i ulong 64 unroll |
| 272 | put Gbsha1 i get Gbsha2 i |
| 273 | end |
| 274 | end |
| 275 | |
| 276 | fn save_bsha2 to void |
| 277 | for i ulong 64 unroll |
| 278 | put Gbsha2 i get Gosha i |
| 279 | end |
| 280 | end |
| 281 | |
| 282 | fn save_ssha to void |
| 283 | for i ulong 64 unroll |
| 284 | put Gssha i get Gosha i |
| 285 | end |
| 286 | end |
| 287 | |
| 288 | fn save_msha to void |
| 289 | for i ulong 64 unroll |
| 290 | put Gmsha i get Gosha i |
| 291 | end |
| 292 | end |
| 293 | |
| 294 | fn bsha_eq_1_2 to bool |
| 295 | for i ulong 64 |
| 296 | if ne get Gbsha1 i get Gbsha2 i |
| 297 | ret false |
| 298 | end |
| 299 | end |
| 300 | ret true |
| 301 | end |
| 302 | |
| 303 | fn msha_eq_ssha to bool |
| 304 | for i ulong 64 |
| 305 | if ne get Gmsha i get Gssha i |
| 306 | ret false |
| 307 | end |
| 308 | end |
| 309 | ret true |
| 310 | end |
| 311 | |
| 312 | fn gosha_eq_pin pin view uchar * to bool |
| 313 | if ne len pin 64 |
| 314 | ret false |
| 315 | end |
| 316 | for i ulong 64 |
| 317 | if ne get Gosha i get pin i |
| 318 | ret false |
| 319 | end |
| 320 | end |
| 321 | ret true |
| 322 | end |
| 323 | |
| 324 | fn gfile_eq_gexp to bool |
| 325 | n = get Gfilelen 0 |
| 326 | if ne n get Gexplen 0 |
| 327 | ret false |
| 328 | end |
| 329 | for i ulong n |
| 330 | if ne get Gfile i get Gexp i |
| 331 | ret false |
| 332 | end |
| 333 | end |
| 334 | ret true |
| 335 | end |
| 336 | |
| 337 | fn gfile_has_pref pref view uchar * to bool |
| 338 | n = get Gfilelen 0 |
| 339 | np = len pref |
| 340 | if lt n np |
| 341 | ret false |
| 342 | end |
| 343 | for i ulong np |
| 344 | if ne get Gfile i get pref i |
| 345 | ret false |
| 346 | end |
| 347 | end |
| 348 | ret true |
| 349 | end |
| 350 | |
| 351 | fn tsv_putc c uchar to void |
| 352 | p = get Gtsvlen 0 |
| 353 | put Gtsv p c |
| 354 | put Gtsvlen 0 add p 1 |
| 355 | end |
| 356 | |
| 357 | fn tsv_txt s view uchar * to void |
| 358 | for i ulong len s |
| 359 | tsv_putc get s i |
| 360 | end |
| 361 | end |
| 362 | |
| 363 | fn tsv_tab to void |
| 364 | tsv_putc 9 |
| 365 | end |
| 366 | |
| 367 | fn tsv_nl to void |
| 368 | tsv_putc 10 |
| 369 | end |
| 370 | |
| 371 | fn tsv_u64 v ulong to void |
| 372 | dg = new uchar 24 0 |
| 373 | if eq v 0 |
| 374 | tsv_putc 48 |
| 375 | ret |
| 376 | end |
| 377 | k = ulong 0 |
| 378 | x = v |
| 379 | while gt x 0 bound 24 |
| 380 | put dg k uchar add 48 and rem x 10 0xff |
| 381 | x = div x 10 |
| 382 | k = add k 1 |
| 383 | end |
| 384 | for i ulong k |
| 385 | tsv_putc get dg sub sub k 1 i |
| 386 | end |
| 387 | end |
| 388 | |
| 389 | fn tsv_hdr to void |
| 390 | tsv_txt Hc1 |
| 391 | tsv_tab |
| 392 | tsv_txt Hc2 |
| 393 | tsv_tab |
| 394 | tsv_txt Hc3 |
| 395 | tsv_tab |
| 396 | tsv_txt Hc4 |
| 397 | tsv_tab |
| 398 | tsv_txt Hc5 |
| 399 | tsv_tab |
| 400 | tsv_txt Hc6 |
| 401 | tsv_tab |
| 402 | tsv_txt Hc7 |
| 403 | tsv_tab |
| 404 | tsv_txt Hc8 |
| 405 | tsv_nl |
| 406 | end |
| 407 | |
| 408 | note ssel: 0=Gssha, 1=Gmsha, 2=Gosha |
| 409 | fn tsv_head cid view uchar * bld view uchar * ssel ulong crc long to void |
| 410 | tsv_txt cid |
| 411 | tsv_tab |
| 412 | tsv_txt bld |
| 413 | tsv_tab |
| 414 | for i ulong 64 |
| 415 | if eq ssel 0 |
| 416 | tsv_putc get Gssha i |
| 417 | else |
| 418 | if eq ssel 1 |
| 419 | tsv_putc get Gmsha i |
| 420 | else |
| 421 | tsv_putc get Gosha i |
| 422 | end |
| 423 | end |
| 424 | end |
| 425 | tsv_tab |
| 426 | tsv_u64 ulong crc |
| 427 | tsv_tab |
| 428 | end |
| 429 | |
| 430 | note bsel: 0=dash, 1=Gbsha1, 2=Gbsha2; osel: 0=dash, 1=Gosha |
| 431 | fn tsv_tail bsel ulong rexit long osel ulong verd view uchar * to void |
| 432 | if eq bsel 0 |
| 433 | tsv_txt Tdash |
| 434 | else |
| 435 | for i ulong 64 |
| 436 | if eq bsel 1 |
| 437 | tsv_putc get Gbsha1 i |
| 438 | else |
| 439 | tsv_putc get Gbsha2 i |
| 440 | end |
| 441 | end |
| 442 | end |
| 443 | tsv_tab |
| 444 | if lt rexit 0 |
| 445 | tsv_txt Tdash |
| 446 | else |
| 447 | tsv_u64 ulong rexit |
| 448 | end |
| 449 | tsv_tab |
| 450 | if eq osel 0 |
| 451 | tsv_txt Tdash |
| 452 | else |
| 453 | for i ulong 64 |
| 454 | tsv_putc get Gosha i |
| 455 | end |
| 456 | end |
| 457 | tsv_tab |
| 458 | tsv_txt verd |
| 459 | tsv_nl |
| 460 | end |
| 461 | |
| 462 | fn write_txt fd int s view uchar * to long |
| 463 | off = ulong 0 |
| 464 | n = len s |
| 465 | while lt off n bound 65536 |
| 466 | nw = write fd s off sub n off |
| 467 | if le nw 0 |
| 468 | ret -1 |
| 469 | end |
| 470 | off = add off ulong nw |
| 471 | end |
| 472 | ret 0 |
| 473 | end |
| 474 | |
| 475 | fn write_tin use_mut bool to long |
| 476 | fd = int fopen Gtin 0 get Gtinlen 0 577 420 |
| 477 | if lt fd 0 |
| 478 | ret -1 |
| 479 | end |
| 480 | off = ulong 0 |
| 481 | n = get Gsrclen 0 |
| 482 | if use_mut |
| 483 | n = get Gmutlen 0 |
| 484 | end |
| 485 | while lt off n bound 65536 |
| 486 | nw = long 0 |
| 487 | if use_mut |
| 488 | nw = write fd Gmut off sub n off |
| 489 | else |
| 490 | nw = write fd Gsrc off sub n off |
| 491 | end |
| 492 | if le nw 0 |
| 493 | x0 = fclose fd |
| 494 | ret -2 |
| 495 | end |
| 496 | off = add off ulong nw |
| 497 | end |
| 498 | x1 = fclose fd |
| 499 | ret 0 |
| 500 | end |
| 501 | |
| 502 | fn write_gpath_from_gfile plen ulong to long |
| 503 | fd = int fopen Gpath 0 plen 577 420 |
| 504 | if lt fd 0 |
| 505 | ret -1 |
| 506 | end |
| 507 | off = ulong 0 |
| 508 | n = get Gfilelen 0 |
| 509 | while lt off n bound 65536 |
| 510 | nw = write fd Gfile off sub n off |
| 511 | if le nw 0 |
| 512 | x0 = fclose fd |
| 513 | ret -2 |
| 514 | end |
| 515 | off = add off ulong nw |
| 516 | end |
| 517 | x1 = fclose fd |
| 518 | ret 0 |
| 519 | end |
| 520 | |
| 521 | fn write_gpath_from_gtsv plen ulong to long |
| 522 | fd = int fopen Gpath 0 plen 577 420 |
| 523 | if lt fd 0 |
| 524 | ret -1 |
| 525 | end |
| 526 | off = ulong 0 |
| 527 | n = get Gtsvlen 0 |
| 528 | while lt off n bound 65536 |
| 529 | nw = write fd Gtsv off sub n off |
| 530 | if le nw 0 |
| 531 | x0 = fclose fd |
| 532 | ret -2 |
| 533 | end |
| 534 | off = add off ulong nw |
| 535 | end |
| 536 | x1 = fclose fd |
| 537 | ret 0 |
| 538 | end |
| 539 | |
| 540 | fn read_fd_to_gfile fd int to long |
| 541 | off = ulong 0 |
| 542 | go = true |
| 543 | while go bound 65536 |
| 544 | if ge off 2097152 |
| 545 | x0 = fclose fd |
| 546 | ret -2 |
| 547 | end |
| 548 | nr = read fd Gfile off sub 2097152 off |
| 549 | if lt nr 0 |
| 550 | x1 = fclose fd |
| 551 | ret -3 |
| 552 | end |
| 553 | if eq nr 0 |
| 554 | go = false |
| 555 | else |
| 556 | off = add off ulong nr |
| 557 | end |
| 558 | end |
| 559 | x2 = fclose fd |
| 560 | put Gfilelen 0 off |
| 561 | ret long off |
| 562 | end |
| 563 | |
| 564 | note pkind: 0=Gomc, 1=Gtbin, 2=Gtout, 3=Gpath(plen) |
| 565 | fn read_kind_to_gfile pkind ulong plen ulong to long |
| 566 | fd = int -1 |
| 567 | if eq pkind 0 |
| 568 | fd = int fopen Gomc 0 get Gomclen 0 0 0 |
| 569 | end |
| 570 | if eq pkind 1 |
| 571 | fd = int fopen Gtbin 0 get Gtbinlen 0 0 0 |
| 572 | end |
| 573 | if eq pkind 2 |
| 574 | fd = int fopen Gtout 0 get Gtoutlen 0 0 0 |
| 575 | end |
| 576 | if eq pkind 3 |
| 577 | fd = int fopen Gpath 0 plen 0 0 |
| 578 | end |
| 579 | if lt fd 0 |
| 580 | ret -1 |
| 581 | end |
| 582 | ret read_fd_to_gfile fd |
| 583 | end |
| 584 | |
| 585 | fn append_src_file path view uchar * to long |
| 586 | fd = int fopen path 0 len path 0 0 |
| 587 | if lt fd 0 |
| 588 | ret -1 |
| 589 | end |
| 590 | nr = read_fd_to_gfile fd |
| 591 | if lt nr 0 |
| 592 | ret -2 |
| 593 | end |
| 594 | cur = get Gsrclen 0 |
| 595 | n = ulong nr |
| 596 | if gt add cur n 131072 |
| 597 | ret -3 |
| 598 | end |
| 599 | for i ulong n |
| 600 | put Gsrc add cur i get Gfile i |
| 601 | end |
| 602 | put Gsrclen 0 add cur n |
| 603 | ret 0 |
| 604 | end |
| 605 | |
| 606 | fn build_out_path sfx view uchar * to ulong |
| 607 | ol = get Goutlen 0 |
| 608 | sl = len sfx |
| 609 | for i ulong ol |
| 610 | put Gpath i get Gout i |
| 611 | end |
| 612 | for i ulong sl |
| 613 | put Gpath add ol i get sfx i |
| 614 | end |
| 615 | ret add ol sl |
| 616 | end |
| 617 | |
| 618 | fn append_dec dst edit uchar 128 pos ulong v ulong to ulong |
| 619 | dg = new uchar 24 0 |
| 620 | if eq v 0 |
| 621 | put dst pos 48 |
| 622 | ret add pos 1 |
| 623 | end |
| 624 | k = ulong 0 |
| 625 | x = v |
| 626 | while gt x 0 bound 24 |
| 627 | put dg k uchar add 48 and rem x 10 0xff |
| 628 | x = div x 10 |
| 629 | k = add k 1 |
| 630 | end |
| 631 | p = pos |
| 632 | for i ulong k |
| 633 | put dst p get dg sub sub k 1 i |
| 634 | p = add p 1 |
| 635 | end |
| 636 | ret p |
| 637 | end |
| 638 | |
| 639 | fn init_tmp_paths to void |
| 640 | tmp = new uchar 128 0 |
| 641 | pid = ulong getpid |
| 642 | for i ulong len Stmpin |
| 643 | put tmp i get Stmpin i |
| 644 | end |
| 645 | l1 = append_dec tmp len Stmpin pid |
| 646 | for i ulong l1 |
| 647 | put Gtin i get tmp i |
| 648 | end |
| 649 | put Gtinlen 0 l1 |
| 650 | for i ulong len Stmpbin |
| 651 | put tmp i get Stmpbin i |
| 652 | end |
| 653 | l2 = append_dec tmp len Stmpbin pid |
| 654 | for i ulong l2 |
| 655 | put Gtbin i get tmp i |
| 656 | end |
| 657 | put Gtbinlen 0 l2 |
| 658 | for i ulong len Stmpout |
| 659 | put tmp i get Stmpout i |
| 660 | end |
| 661 | l3 = append_dec tmp len Stmpout pid |
| 662 | for i ulong l3 |
| 663 | put Gtout i get tmp i |
| 664 | end |
| 665 | put Gtoutlen 0 l3 |
| 666 | end |
| 667 | |
| 668 | fn cleanup_tmp to void |
| 669 | x1 = unlink Gtin 0 get Gtinlen 0 |
| 670 | x2 = unlink Gtbin 0 get Gtbinlen 0 |
| 671 | x3 = unlink Gtout 0 get Gtoutlen 0 |
| 672 | end |
| 673 | |
| 674 | fn pkt_put_u16 pos ulong v ulong to ulong |
| 675 | put Gpkt pos uchar and v 0xff |
| 676 | put Gpkt add pos 1 uchar and shr v 8 0xff |
| 677 | ret add pos 2 |
| 678 | end |
| 679 | |
| 680 | fn pkt_add_gomc pos ulong to ulong |
| 681 | n = get Gomclen 0 |
| 682 | p = pkt_put_u16 pos n |
| 683 | for i ulong n |
| 684 | put Gpkt add p i get Gomc i |
| 685 | end |
| 686 | ret add p n |
| 687 | end |
| 688 | |
| 689 | fn pkt_add_gtbin pos ulong to ulong |
| 690 | n = get Gtbinlen 0 |
| 691 | p = pkt_put_u16 pos n |
| 692 | for i ulong n |
| 693 | put Gpkt add p i get Gtbin i |
| 694 | end |
| 695 | ret add p n |
| 696 | end |
| 697 | |
| 698 | fn pkt_add_txt pos ulong s view uchar * to ulong |
| 699 | n = len s |
| 700 | p = pkt_put_u16 pos n |
| 701 | for i ulong n |
| 702 | put Gpkt add p i get s i |
| 703 | end |
| 704 | ret add p n |
| 705 | end |
| 706 | |
| 707 | fn child_exec inkind ulong outkind ulong pktlen ulong to void |
| 708 | fdi = int -1 |
| 709 | if eq inkind 1 |
| 710 | fdi = int fopen Gtin 0 get Gtinlen 0 0 0 |
| 711 | else |
| 712 | fdi = int fopen Sdevnull 0 len Sdevnull 0 0 |
| 713 | end |
| 714 | if lt fdi 0 |
| 715 | exit 125 |
| 716 | end |
| 717 | fdo = int -1 |
| 718 | if eq outkind 0 |
| 719 | fdo = int fopen Gtbin 0 get Gtbinlen 0 577 493 |
| 720 | else |
| 721 | fdo = int fopen Gtout 0 get Gtoutlen 0 577 420 |
| 722 | end |
| 723 | if lt fdo 0 |
| 724 | exit 126 |
| 725 | end |
| 726 | fde = int fopen Sdevnull 0 len Sdevnull 1 0 |
| 727 | if lt fde 0 |
| 728 | exit 127 |
| 729 | end |
| 730 | if ne fdi 0 |
| 731 | d0 = dupfd fdi 0 0 |
| 732 | end |
| 733 | if ne fdo 1 |
| 734 | d1 = dupfd fdo 1 0 |
| 735 | end |
| 736 | if ne fde 2 |
| 737 | d2 = dupfd fde 2 0 |
| 738 | end |
| 739 | r = execprog Gpkt 0 pktlen |
| 740 | exit 124 |
| 741 | end |
| 742 | |
| 743 | fn spawn_pkt inkind ulong outkind ulong pktlen ulong to long |
| 744 | wst = new uchar 4 0 |
| 745 | pid = fork |
| 746 | if lt pid 0 |
| 747 | ret -1 |
| 748 | end |
| 749 | if eq pid 0 |
| 750 | child_exec inkind outkind pktlen |
| 751 | end |
| 752 | wp = waitpid int pid wst 0 4 0 |
| 753 | if lt wp 0 |
| 754 | ret -2 |
| 755 | end |
| 756 | st = rd32le view wst 0 |
| 757 | if eq and st 0x7f 0 |
| 758 | ret long and shr st 8 0xff |
| 759 | end |
| 760 | ret long add 128 and st 0x7f |
| 761 | end |
| 762 | |
| 763 | fn compile_cur use_mut bool to long |
| 764 | if lt write_tin use_mut 0 |
| 765 | ret -1 |
| 766 | end |
| 767 | x0 = unlink Gtbin 0 get Gtbinlen 0 |
| 768 | p = pkt_put_u16 0 1 |
| 769 | plen = pkt_add_gomc p |
| 770 | rc = spawn_pkt 1 0 plen |
| 771 | if eq rc 0 |
| 772 | fd = int fopen Gtbin 0 get Gtbinlen 0 0 0 |
| 773 | if lt fd 0 |
| 774 | ret -2 |
| 775 | end |
| 776 | x1 = fchmod fd 493 |
| 777 | x2 = fclose fd |
| 778 | nr = read_kind_to_gfile 1 0 |
| 779 | if le nr 0 |
| 780 | ret -3 |
| 781 | end |
| 782 | sha256_gosha_kind 0 ulong nr |
| 783 | save_bsha2 |
| 784 | end |
| 785 | ret rc |
| 786 | end |
| 787 | |
| 788 | fn run_bin0 to long |
| 789 | p = pkt_put_u16 0 1 |
| 790 | plen = pkt_add_gtbin p |
| 791 | rc = spawn_pkt 0 1 plen |
| 792 | nr = read_kind_to_gfile 2 0 |
| 793 | if lt nr 0 |
| 794 | ret -1 |
| 795 | end |
| 796 | sha256_gosha_kind 0 ulong nr |
| 797 | ret rc |
| 798 | end |
| 799 | |
| 800 | fn run_bin1 arg1 view uchar * to long |
| 801 | p = pkt_put_u16 0 2 |
| 802 | p = pkt_add_gtbin p |
| 803 | plen = pkt_add_txt p arg1 |
| 804 | rc = spawn_pkt 0 1 plen |
| 805 | nr = read_kind_to_gfile 2 0 |
| 806 | if lt nr 0 |
| 807 | ret -1 |
| 808 | end |
| 809 | sha256_gosha_kind 0 ulong nr |
| 810 | ret rc |
| 811 | end |
| 812 | |
| 813 | fn run_bin2 arg1 view uchar * arg2 view uchar * to long |
| 814 | p = pkt_put_u16 0 3 |
| 815 | p = pkt_add_gtbin p |
| 816 | p = pkt_add_txt p arg1 |
| 817 | plen = pkt_add_txt p arg2 |
| 818 | rc = spawn_pkt 0 1 plen |
| 819 | nr = read_kind_to_gfile 2 0 |
| 820 | if lt nr 0 |
| 821 | ret -1 |
| 822 | end |
| 823 | sha256_gosha_kind 0 ulong nr |
| 824 | ret rc |
| 825 | end |
| 826 | |
| 827 | fn match_at pos ulong slen ulong tgt view uchar * tlen ulong to bool |
| 828 | if gt add pos tlen slen |
| 829 | ret false |
| 830 | end |
| 831 | for j ulong tlen |
| 832 | if ne get Gsrc add pos j get tgt j |
| 833 | ret false |
| 834 | end |
| 835 | end |
| 836 | ret true |
| 837 | end |
| 838 | |
| 839 | fn emit_rep pos ulong rep view uchar * to ulong |
| 840 | o = pos |
| 841 | for k ulong len rep |
| 842 | ch = get rep k |
| 843 | if eq ch 124 |
| 844 | put Gmut o 10 |
| 845 | else |
| 846 | put Gmut o ch |
| 847 | end |
| 848 | o = add o 1 |
| 849 | end |
| 850 | ret o |
| 851 | end |
| 852 | |
| 853 | fn patch_src tgt view uchar * rep view uchar * to long |
| 854 | slen = get Gsrclen 0 |
| 855 | tlen = len tgt |
| 856 | i = ulong 0 |
| 857 | o = ulong 0 |
| 858 | hits = long 0 |
| 859 | while lt i slen bound 131072 |
| 860 | if and eq hits 0 match_at i slen tgt tlen |
| 861 | o = emit_rep o rep |
| 862 | i = add i tlen |
| 863 | hits = add hits 1 |
| 864 | else |
| 865 | put Gmut o get Gsrc i |
| 866 | o = add o 1 |
| 867 | i = add i 1 |
| 868 | end |
| 869 | end |
| 870 | put Gmutlen 0 o |
| 871 | ret hits |
| 872 | end |
| 873 | |
| 874 | fn print_err_step step ulong to int |
| 875 | dg = new uchar 24 0 |
| 876 | x0 = write_txt 2 MsgFail |
| 877 | k = ulong 0 |
| 878 | v = step |
| 879 | while gt v 0 bound 24 |
| 880 | put dg k uchar add 48 and rem v 10 0xff |
| 881 | v = div v 10 |
| 882 | k = add k 1 |
| 883 | end |
| 884 | for i ulong k |
| 885 | put Gpath i get dg sub sub k 1 i |
| 886 | end |
| 887 | put Gpath k 10 |
| 888 | x1 = write 2 Gpath 0 add k 1 |
| 889 | cleanup_tmp |
| 890 | ret 1 |
| 891 | end |
| 892 | |
| 893 | fn check_orig_3x to int |
| 894 | for r ulong 3 |
| 895 | crc = compile_cur false |
| 896 | if ne crc 0 |
| 897 | ret 10 |
| 898 | end |
| 899 | if eq r 0 |
| 900 | save_bsha1 |
| 901 | else |
| 902 | if not bsha_eq_1_2 |
| 903 | ret 11 |
| 904 | end |
| 905 | end |
| 906 | rc1 = run_bin1 Tself |
| 907 | if or ne rc1 0 not gosha_eq_pin PinEmpty |
| 908 | ret 12 |
| 909 | end |
| 910 | tsv_head Torig Tself 0 0 |
| 911 | tsv_tail 1 0 1 Tpass |
| 912 | rc2 = run_bin1 Ttrace |
| 913 | if or ne rc2 0 not gosha_eq_pin PinTrace |
| 914 | ret 13 |
| 915 | end |
| 916 | if not gfile_eq_gexp |
| 917 | ret 14 |
| 918 | end |
| 919 | tsv_head Torig Ttrace 0 0 |
| 920 | tsv_tail 1 0 1 Tpass |
| 921 | end |
| 922 | ret 0 |
| 923 | end |
| 924 | |
| 925 | fn check_ipc_and_controls to int |
| 926 | rci = run_bin1 Tipc |
| 927 | if or ne rci 0 not gfile_has_pref SipcPref |
| 928 | ret 20 |
| 929 | end |
| 930 | ipcl = build_out_path Sipcf |
| 931 | if lt write_gpath_from_gfile ipcl 0 |
| 932 | ret 21 |
| 933 | end |
| 934 | tsv_head Torig Tipc 0 0 |
| 935 | tsv_tail 1 0 0 Tpass |
| 936 | ep = build_out_path Sexpf |
| 937 | nr = read_kind_to_gfile 3 ep |
| 938 | if le nr 0 |
| 939 | ret 22 |
| 940 | end |
| 941 | put Gfile 0 uchar xor uint get Gfile 0 1 |
| 942 | sha256_gosha_kind 0 ulong nr |
| 943 | if or gfile_eq_gexp gosha_eq_pin PinTrace |
| 944 | ret 23 |
| 945 | end |
| 946 | tsv_head Tccor Ttrace 2 0 |
| 947 | tsv_tail 0 -1 1 Tpass |
| 948 | rcn = run_bin0 |
| 949 | if or ne rcn 2 not gosha_eq_pin PinEmpty |
| 950 | ret 24 |
| 951 | end |
| 952 | tsv_head Tcanone Tusage 0 0 |
| 953 | tsv_tail 1 rcn 1 Tpass |
| 954 | rcb = run_bin1 Tbadarg |
| 955 | if or ne rcb 2 not gosha_eq_pin PinEmpty |
| 956 | ret 25 |
| 957 | end |
| 958 | tsv_head Tcabad Tusage 0 0 |
| 959 | tsv_tail 1 rcb 1 Tpass |
| 960 | rct = run_bin2 Ttrace Textra |
| 961 | if or ne rct 2 not gosha_eq_pin PinEmpty |
| 962 | ret 26 |
| 963 | end |
| 964 | tsv_head Tcatwo Tusage 0 0 |
| 965 | tsv_tail 1 rct 1 Tpass |
| 966 | ret 0 |
| 967 | end |
| 968 | |
| 969 | fn check_trap_probes to int |
| 970 | r1 = run_bin1 Ttrapt |
| 971 | if ne r1 110 |
| 972 | ret 30 |
| 973 | end |
| 974 | tsv_head Tptrit Ttrapt 0 0 |
| 975 | tsv_tail 1 r1 1 Ttrap10 |
| 976 | r2 = run_bin1 Ttrapd |
| 977 | if ne r2 110 |
| 978 | ret 31 |
| 979 | end |
| 980 | tsv_head Tpdup Ttrapd 0 0 |
| 981 | tsv_tail 1 r2 1 Ttrap10 |
| 982 | r3 = run_bin1 Ttrapr |
| 983 | if ne r3 109 |
| 984 | ret 32 |
| 985 | end |
| 986 | tsv_head Tpreq Ttrapr 0 0 |
| 987 | tsv_tail 1 r3 1 Ttrap9 |
| 988 | r4 = run_bin1 Tovfp |
| 989 | if ne r4 0 |
| 990 | ret 33 |
| 991 | end |
| 992 | tsv_head Tpovf Tovfp 0 0 |
| 993 | tsv_tail 1 r4 1 Tpass |
| 994 | ret 0 |
| 995 | end |
| 996 | |
| 997 | fn prep_mutant tgt view uchar * rep view uchar * to int |
| 998 | if ne patch_src tgt rep 1 |
| 999 | ret 1 |
| 1000 | end |
| 1001 | sha256_gosha_kind 3 get Gmutlen 0 |
| 1002 | save_msha |
| 1003 | if msha_eq_ssha |
| 1004 | ret 2 |
| 1005 | end |
| 1006 | ret 0 |
| 1007 | end |
| 1008 | |
| 1009 | fn exec_mutant mid view uchar * mode ulong ovfchk bool to int |
| 1010 | crc = compile_cur true |
| 1011 | if ne crc 0 |
| 1012 | ret 3 |
| 1013 | end |
| 1014 | rcs = run_bin1 Tself |
| 1015 | if eq mode 0 |
| 1016 | if eq rcs 0 |
| 1017 | ret 4 |
| 1018 | end |
| 1019 | tsv_head mid Tself 1 0 |
| 1020 | tsv_tail 2 rcs 1 Tscaught |
| 1021 | end |
| 1022 | if eq mode 1 |
| 1023 | if ne rcs 110 |
| 1024 | ret 5 |
| 1025 | end |
| 1026 | tsv_head mid Tself 1 0 |
| 1027 | tsv_tail 2 rcs 1 Ttrap10 |
| 1028 | end |
| 1029 | if eq mode 2 |
| 1030 | if ne rcs 109 |
| 1031 | ret 6 |
| 1032 | end |
| 1033 | tsv_head mid Tself 1 0 |
| 1034 | tsv_tail 2 rcs 1 Ttrap9 |
| 1035 | end |
| 1036 | if eq mode 3 |
| 1037 | if ne rcs 0 |
| 1038 | ret 7 |
| 1039 | end |
| 1040 | tsv_head mid Tself 1 0 |
| 1041 | tsv_tail 2 rcs 1 Tsmiss |
| 1042 | end |
| 1043 | rct = run_bin1 Ttrace |
| 1044 | if and eq rct 0 gosha_eq_pin PinTrace |
| 1045 | ret 8 |
| 1046 | end |
| 1047 | tsv_head mid Ttrace 1 0 |
| 1048 | if eq rct 110 |
| 1049 | tsv_tail 2 rct 1 Ttrap10 |
| 1050 | else |
| 1051 | if eq rct 109 |
| 1052 | tsv_tail 2 rct 1 Ttrap9 |
| 1053 | else |
| 1054 | tsv_tail 2 rct 1 Tokilled |
| 1055 | end |
| 1056 | end |
| 1057 | if ovfchk |
| 1058 | rco = run_bin1 Tovfp |
| 1059 | if ne rco 101 |
| 1060 | ret 9 |
| 1061 | end |
| 1062 | tsv_head mid Tovfb 1 0 |
| 1063 | tsv_tail 2 rco 1 Ttrap1 |
| 1064 | end |
| 1065 | ret 0 |
| 1066 | end |
| 1067 | |
| 1068 | fn exec_type_swap xid view uchar * to int |
| 1069 | crc = compile_cur true |
| 1070 | if ne crc 7 |
| 1071 | ret 2 |
| 1072 | end |
| 1073 | tsv_head xid Tcomp 1 crc |
| 1074 | tsv_tail 0 -1 0 Tcref7 |
| 1075 | ret 0 |
| 1076 | end |
| 1077 | |
| 1078 | note IPC mutant: node B decodes and returns a different job wave with a self-consistent |
| 1079 | note receipt. Killed only when the host refuses it (btwave ipc exit 65, no stdout). |
| 1080 | fn exec_ipc_mutant mid view uchar * to int |
| 1081 | crc = compile_cur true |
| 1082 | if ne crc 0 |
| 1083 | ret 3 |
| 1084 | end |
| 1085 | rci = run_bin1 Tipc |
| 1086 | if or ne rci 65 not gosha_eq_pin PinEmpty |
| 1087 | ret 10 |
| 1088 | end |
| 1089 | tsv_head mid Tipc 1 0 |
| 1090 | tsv_tail 2 rci 1 Tipcref |
| 1091 | ret 0 |
| 1092 | end |
| 1093 | |
| 1094 | fn run_all_mutants_a to int |
| 1095 | if or ne prep_mutant M01t M01r 0 ne exec_mutant M01id 0 false 0 |
| 1096 | ret 101 |
| 1097 | end |
| 1098 | if or ne prep_mutant M02t M02r 0 ne exec_mutant M02id 0 false 0 |
| 1099 | ret 102 |
| 1100 | end |
| 1101 | if or ne prep_mutant M03t M03r 0 ne exec_mutant M03id 0 false 0 |
| 1102 | ret 103 |
| 1103 | end |
| 1104 | if or ne prep_mutant M04t M04r 0 ne exec_mutant M04id 0 false 0 |
| 1105 | ret 104 |
| 1106 | end |
| 1107 | if or ne prep_mutant M05t M05r 0 ne exec_mutant M05id 0 false 0 |
| 1108 | ret 105 |
| 1109 | end |
| 1110 | if or ne prep_mutant M06t M06r 0 ne exec_mutant M06id 0 false 0 |
| 1111 | ret 106 |
| 1112 | end |
| 1113 | if or ne prep_mutant M07t M07r 0 ne exec_mutant M07id 0 false 0 |
| 1114 | ret 107 |
| 1115 | end |
| 1116 | if or ne prep_mutant M08t M08r 0 ne exec_mutant M08id 0 false 0 |
| 1117 | ret 108 |
| 1118 | end |
| 1119 | if or ne prep_mutant M09t M09r 0 ne exec_mutant M09id 0 false 0 |
| 1120 | ret 109 |
| 1121 | end |
| 1122 | if or ne prep_mutant M10t M10r 0 ne exec_mutant M10id 0 false 0 |
| 1123 | ret 110 |
| 1124 | end |
| 1125 | if or ne prep_mutant M11t M11r 0 ne exec_mutant M11id 0 false 0 |
| 1126 | ret 111 |
| 1127 | end |
| 1128 | ret 0 |
| 1129 | end |
| 1130 | |
| 1131 | fn run_all_mutants_b to int |
| 1132 | if or ne prep_mutant M12t M12r 0 ne exec_mutant M12id 0 false 0 |
| 1133 | ret 112 |
| 1134 | end |
| 1135 | if or ne prep_mutant M13t M13r 0 ne exec_mutant M13id 0 false 0 |
| 1136 | ret 113 |
| 1137 | end |
| 1138 | if or ne prep_mutant M14t M14r 0 ne exec_mutant M14id 0 false 0 |
| 1139 | ret 114 |
| 1140 | end |
| 1141 | if or ne prep_mutant M15t M15r 0 ne exec_mutant M15id 0 false 0 |
| 1142 | ret 115 |
| 1143 | end |
| 1144 | if or ne prep_mutant M16t M16r 0 ne exec_mutant M16id 0 false 0 |
| 1145 | ret 116 |
| 1146 | end |
| 1147 | if or ne prep_mutant M17t M17r 0 ne exec_mutant M17id 0 false 0 |
| 1148 | ret 117 |
| 1149 | end |
| 1150 | if or ne prep_mutant M18t M18r 0 ne exec_mutant M18id 1 false 0 |
| 1151 | ret 118 |
| 1152 | end |
| 1153 | if or ne prep_mutant M19t M19r 0 ne exec_mutant M19id 1 false 0 |
| 1154 | ret 119 |
| 1155 | end |
| 1156 | if or ne prep_mutant M20t M20r 0 ne exec_mutant M20id 2 false 0 |
| 1157 | ret 120 |
| 1158 | end |
| 1159 | if or ne prep_mutant M21t M21r 0 ne exec_mutant M21id 0 true 0 |
| 1160 | ret 121 |
| 1161 | end |
| 1162 | if or ne prep_mutant M22t M22r 0 ne exec_mutant M22id 3 false 0 |
| 1163 | ret 122 |
| 1164 | end |
| 1165 | if or ne prep_mutant M23t M23r 0 ne exec_ipc_mutant M23id 0 |
| 1166 | ret 123 |
| 1167 | end |
| 1168 | ret 0 |
| 1169 | end |
| 1170 | |
| 1171 | fn run_all_swaps to int |
| 1172 | if or ne prep_mutant X1t X1r 0 ne exec_type_swap X1id 0 |
| 1173 | ret 201 |
| 1174 | end |
| 1175 | if or ne prep_mutant X2t X2r 0 ne exec_type_swap X2id 0 |
| 1176 | ret 202 |
| 1177 | end |
| 1178 | if or ne prep_mutant X3t X3r 0 ne exec_type_swap X3id 0 |
| 1179 | ret 203 |
| 1180 | end |
| 1181 | if or ne prep_mutant X4t X4r 0 ne exec_type_swap X4id 0 |
| 1182 | ret 204 |
| 1183 | end |
| 1184 | ret 0 |
| 1185 | end |
| 1186 | |
| 1187 | fn load_inputs to int |
| 1188 | nr = read_kind_to_gfile 0 0 |
| 1189 | if le nr 0 |
| 1190 | ret 77 |
| 1191 | end |
| 1192 | sha256_gosha_kind 0 ulong nr |
| 1193 | if not gosha_eq_pin PinOmc |
| 1194 | ret 77 |
| 1195 | end |
| 1196 | ep = build_out_path Sexpf |
| 1197 | en = read_kind_to_gfile 3 ep |
| 1198 | if or le en 0 gt en 65536 |
| 1199 | ret 3 |
| 1200 | end |
| 1201 | for i ulong ulong en |
| 1202 | put Gexp i get Gfile i |
| 1203 | end |
| 1204 | put Gexplen 0 ulong en |
| 1205 | sha256_gosha_kind 1 get Gexplen 0 |
| 1206 | if not gosha_eq_pin PinTrace |
| 1207 | ret 4 |
| 1208 | end |
| 1209 | put Gsrclen 0 0 |
| 1210 | if lt append_src_file Sf1 0 |
| 1211 | ret 5 |
| 1212 | end |
| 1213 | if lt append_src_file Sf2 0 |
| 1214 | ret 6 |
| 1215 | end |
| 1216 | if lt append_src_file Sf3 0 |
| 1217 | ret 7 |
| 1218 | end |
| 1219 | if lt append_src_file Sf4 0 |
| 1220 | ret 8 |
| 1221 | end |
| 1222 | sha256_gosha_kind 2 get Gsrclen 0 |
| 1223 | save_ssha |
| 1224 | ret 0 |
| 1225 | end |
| 1226 | |
| 1227 | fn main to int |
| 1228 | if ne argcnt 3 |
| 1229 | x0 = write_txt 2 MsgUsage |
| 1230 | ret 2 |
| 1231 | end |
| 1232 | l1 = argread 1 Gomc 0 512 |
| 1233 | l2 = argread 2 Gout 0 512 |
| 1234 | if or le l1 0 le l2 0 |
| 1235 | x1 = write_txt 2 MsgUsage |
| 1236 | ret 2 |
| 1237 | end |
| 1238 | put Gomclen 0 ulong l1 |
| 1239 | put Goutlen 0 ulong l2 |
| 1240 | init_tmp_paths |
| 1241 | lrc = load_inputs |
| 1242 | if eq lrc 77 |
| 1243 | x2 = write_txt 2 MsgNotRun |
| 1244 | cleanup_tmp |
| 1245 | ret 77 |
| 1246 | end |
| 1247 | if ne lrc 0 |
| 1248 | ret print_err_step ulong lrc |
| 1249 | end |
| 1250 | put Gtsvlen 0 0 |
| 1251 | tsv_hdr |
| 1252 | rc = check_orig_3x |
| 1253 | if ne rc 0 |
| 1254 | ret print_err_step ulong rc |
| 1255 | end |
| 1256 | rc = check_ipc_and_controls |
| 1257 | if ne rc 0 |
| 1258 | ret print_err_step ulong rc |
| 1259 | end |
| 1260 | rc = check_trap_probes |
| 1261 | if ne rc 0 |
| 1262 | ret print_err_step ulong rc |
| 1263 | end |
| 1264 | rc = run_all_mutants_a |
| 1265 | if ne rc 0 |
| 1266 | ret print_err_step ulong rc |
| 1267 | end |
| 1268 | rc = run_all_mutants_b |
| 1269 | if ne rc 0 |
| 1270 | ret print_err_step ulong rc |
| 1271 | end |
| 1272 | rc = run_all_swaps |
| 1273 | if ne rc 0 |
| 1274 | ret print_err_step ulong rc |
| 1275 | end |
| 1276 | cleanup_tmp |
| 1277 | rp = build_out_path Srecf |
| 1278 | if lt write_gpath_from_gtsv rp 0 |
| 1279 | ret print_err_step 250 |
| 1280 | end |
| 1281 | x3 = write_txt 1 MsgPass |
| 1282 | ret 0 |
| 1283 | end |