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/aienux/blob/main/evidence/allen-omega-L694/L725/red2.om # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / evidence / allen-omega-L694 / L725 / red2.om` 979 lines ยท 15017 bytes Raw Blame History 1 note L694 fixed-buffer utilities. No platform effects in product functions. 2 global In uchar 8192 3 global Inlen ulong 1 4 global Outb uchar 8192 5 global Outlen ulong 1 6 global Err ulong 1 7 text Digits "`0123456789abcdef`" 8 fn emitb c uchar to void 9 n = get Outlen 0 10 if ge n len Outb 11 put Err 0 1 12 else 13 put Outb n c 14 put Outlen 0 add n 1 15 end 16 end 17 fn emitn v ulong to void 18 d = new uchar 20 0 19 n = ulong 0 20 x = v 21 put d n uchar add rem x 10 48 22 n = add n 1 23 x = div x 10 24 while gt x 0 25 put d n uchar add rem x 10 48 26 n = add n 1 27 x = div x 10 28 end 29 while gt n 0 30 n = sub n 1 31 emitb get d n 32 end 33 end 34 fn outreset to void 35 put Outlen 0 0 36 put Err 0 0 37 end 38 fn ineq at ulong c uchar to bool 39 if ge at get Inlen 0 40 ret false 41 end 42 ret eq get In at c 43 end 44 fn isdigit c uchar to bool 45 ret and ge c 48 le c 57 46 end 47 note Parser cursor P0, number P1, error P2. Never wraps a u32. 48 global P ulong 3 49 fn number to void 50 v = ulong 0 51 n = ulong 0 52 p = get P 0 53 while lt p get Inlen 0 54 c = get In p 55 if not isdigit c 56 put P 0 p 57 put P 1 v 58 if eq n 0 59 put P 2 1 60 end 61 ret 62 end 63 if or ge n 10 gt v `429496729` 64 put P 2 1 65 ret 66 end 67 v = add mul v 10 sub ulong c 48 68 if gt v `4294967295` 69 put P 2 1 70 ret 71 end 72 n = add n 1 73 p = add p 1 74 end 75 put P 0 p 76 put P 1 v 77 if eq n 0 78 put P 2 1 79 end 80 end 81 fn expect c uchar to void 82 p = get P 0 83 if not ineq p c 84 put P 2 1 85 else 86 put P 0 add p 1 87 end 88 end 89 fn crc off ulong count ulong to uint 90 c = uint `4294967295` 91 for i ulong count 92 c = xor c uint get In add off i 93 for k ulong 8 94 if ne and c 1 0 95 c = xor shr c 1 `3988292384` 96 else 97 c = shr c 1 98 end 99 end 100 end 101 ret not c 102 end 103 note R: seq, active, kind (1 chat 2 code 3 more), asked, heard, slow, 104 note code-visible, prompt length, answer length, history count, session. 105 global R ulong 16 106 global Prompt uchar 160 107 global Answer uchar 160 108 global Hist uchar 5120 109 global Hlen ulong 32 110 text Ack "I need to code that. Let me send it off to the Spark." 111 text Ackmore "Let me take that change to the Spark." 112 fn textok to bool 113 n = get Inlen 0 114 if or eq n 0 gt n 159 115 ret false 116 end 117 for i ulong n 118 c = get In i 119 if or lt c 32 gt c 126 120 ret false 121 end 122 end 123 ret true 124 end 125 fn histadd which ulong to void 126 n = get R 9 127 if eq n 32 128 for i ulong 4960 129 put Hist i get Hist add i 160 130 end 131 for i ulong 31 132 put Hlen i get Hlen add i 1 133 end 134 n = 31 135 end 136 size = get R add which 7 137 for i ulong size 138 if eq which 0 139 put Hist add mul n 160 i get Prompt i 140 else 141 put Hist add mul n 160 i get Answer i 142 end 143 end 144 put Hlen n size 145 put R 9 add n 1 146 end 147 fn start kind ulong now ulong to bool 148 if or ne get R 1 0 ge get R 0 `4294967295` 149 ret false 150 end 151 if or lt kind 1 gt kind 3 152 ret false 153 end 154 if and eq kind 3 eq get R 6 0 155 ret false 156 end 157 if not textok 158 ret false 159 end 160 for i ulong get Inlen 0 161 put Prompt i get In i 162 end 163 put R 7 get Inlen 0 164 put R 0 add get R 0 1 165 put R 1 1 166 put R 2 kind 167 put R 3 now 168 put R 4 now 169 put R 5 0 170 put R 8 0 171 put R 11 0 172 put R 13 0 173 if eq kind 2 174 for i ulong len Ack 175 put Answer i get Ack i 176 end 177 put R 8 len Ack 178 end 179 if eq kind 3 180 for i ulong len Ackmore 181 put Answer i get Ackmore i 182 end 183 put R 8 len Ackmore 184 end 185 histadd 0 186 ret true 187 end 188 fn answer seq ulong now ulong to bool 189 if or eq get R 1 0 ne seq get R 0 190 ret false 191 end 192 if or lt now get R 4 not textok 193 ret false 194 end 195 for i ulong get Inlen 0 196 put Answer i get In i 197 end 198 put R 8 get Inlen 0 199 put R 4 now 200 put R 1 0 201 histadd 1 202 ret true 203 end 204 fn cancel to void 205 put R 1 0 206 end 207 fn heard seq ulong now ulong to bool 208 if or eq get R 1 0 ne seq get R 0 209 ret false 210 end 211 if lt now get R 4 212 ret false 213 end 214 put R 4 now 215 ret true 216 end 217 fn tick now ulong to ulong 218 if or eq get R 1 0 lt now get R 4 219 ret 0 220 end 221 if ge sub now get R 4 30000 222 cancel 223 ret 2 224 end 225 if and eq get R 5 0 ge sub now get R 3 20000 226 put R 5 1 227 ret 1 228 end 229 ret 0 230 end 231 fn reset to void 232 for i ulong 9 233 put R add i 1 0 234 end 235 end 236 note Restore one externally decoded transcript line. No live job or ID reuse. 237 fn restore to bool 238 if or ne get R 1 0 not textok 239 ret false 240 end 241 for i ulong get Inlen 0 242 put Answer i get In i 243 end 244 put R 8 get Inlen 0 245 histadd 1 246 ret true 247 end 248 note CODE protocol: C seq, parts, bytes, crc, got. D parsed header. 249 global C ulong 8 250 global D ulong 8 251 global Code uchar 32769 252 global Have uchar 256 253 global Piece uchar 128 254 global Lang uchar 16 255 global Newlang uchar 16 256 fn codebeg seq ulong to void 257 for i ulong 8 258 put C i 0 259 end 260 put C 0 seq 261 for i ulong 256 262 put Have i 0 263 end 264 put Code 0 0 265 end 266 fn decfield slot ulong sep uchar to void 267 number 268 put D slot get P 1 269 expect sep 270 end 271 fn hexread to void 272 v = ulong 0 273 for i ulong 8 274 p = get P 0 275 if ge p get Inlen 0 276 put P 2 1 277 ret 278 end 279 c = get In p 280 d = ulong 16 281 if isdigit c 282 d = sub ulong c 48 283 else 284 if and ge c 97 le c 102 285 d = sub ulong c 87 286 end 287 end 288 if ge d 16 289 put P 2 1 290 ret 291 end 292 v = add mul v 16 d 293 put P 0 add p 1 294 end 295 put D 4 v 296 expect 32 297 end 298 fn codehead to bool 299 put P 0 0 300 put P 2 0 301 expect 67 302 expect 79 303 expect 68 304 expect 69 305 expect 32 306 decfield 0 32 307 decfield 1 47 308 decfield 2 32 309 decfield 3 32 310 hexread 311 if ne get P 2 0 312 ret false 313 end 314 if or ne get D 0 get C 0 eq get D 3 0 315 ret false 316 end 317 if gt get D 3 32768 318 ret false 319 end 320 if ne get D 2 div add get D 3 127 128 321 ret false 322 end 323 if or lt get D 1 1 gt get D 1 get D 2 324 ret false 325 end 326 if ne get C 1 0 327 if or ne get C 1 get D 2 ne get C 2 get D 3 328 ret false 329 end 330 if ne get C 3 get D 4 331 ret false 332 end 333 end 334 ret true 335 end 336 fn langread to bool 337 for i ulong 16 338 put Newlang i 0 339 end 340 n = ulong 0 341 p = get P 0 342 while lt p get Inlen 0 343 c = get In p 344 if eq c 32 345 if eq n 0 346 ret false 347 end 348 put P 0 add p 1 349 put D 5 n 350 ret true 351 end 352 ok = or and ge c 97 le c 122 isdigit c 353 ok = or ok or eq c 43 eq c 35 354 ok = or ok or eq c 46 or eq c 95 eq c 45 355 if or not ok ge n 15 356 ret false 357 end 358 put Newlang n c 359 p = add p 1 360 n = add n 1 361 end 362 ret false 363 end 364 fn pieceread to ulong 365 p = get P 0 366 n = ulong 0 367 while lt p get Inlen 0 368 c = get In p 369 p = add p 1 370 if eq c 92 371 if ge p get Inlen 0 372 ret 129 373 end 374 c = get In p 375 p = add p 1 376 if eq c 110 377 c = 10 378 else 379 if ne c 92 380 ret 129 381 end 382 end 383 else 384 if or lt c 32 gt c 126 385 ret 129 386 end 387 end 388 if ge n 128 389 ret 129 390 end 391 put Piece n c 392 n = add n 1 393 end 394 ret n 395 end 396 fn codetake to bool 397 if gt get Inlen 0 320 398 ret false 399 end 400 if not codehead 401 ret false 402 end 403 if not langread 404 ret false 405 end 406 n = pieceread 407 want = ulong 128 408 if eq get D 1 get D 2 409 want = sub get D 3 mul sub get D 2 1 128 410 end 411 if ne n want 412 ret false 413 end 414 slot = sub get D 1 1 415 off = mul slot 128 416 if ne get C 1 0 417 for i ulong 16 418 if ne get Lang i get Newlang i 419 ret false 420 end 421 end 422 end 423 if ne get Have slot 0 424 for i ulong n 425 if ne get Code add off i get Piece i 426 ret false 427 end 428 end 429 ret true 430 end 431 put C 1 get D 2 432 put C 2 get D 3 433 put C 3 get D 4 434 for i ulong 16 435 put Lang i get Newlang i 436 end 437 for i ulong n 438 put Code add off i get Piece i 439 end 440 put Have slot 1 441 put C 4 add get C 4 1 442 ret true 443 end 444 fn codecrc to uint 445 c = uint `4294967295` 446 for i ulong get C 2 447 c = xor c uint get Code i 448 for k ulong 8 449 if ne and c 1 0 450 c = xor shr c 1 `3988292384` 451 else 452 c = shr c 1 453 end 454 end 455 end 456 ret not c 457 end 458 fn codestat to ulong 459 if eq get C 1 0 460 ret 0 461 end 462 if lt get C 4 get C 1 463 ret 1 464 end 465 if ne ulong codecrc get C 3 466 ret 3 467 end 468 lines = ulong 0 469 for i ulong get C 2 470 c = get Code i 471 if eq c 0 472 ret 3 473 end 474 if eq c 10 475 lines = add lines 1 476 end 477 end 478 if ne get Code sub get C 2 1 10 479 lines = add lines 1 480 end 481 if gt lines 800 482 ret 3 483 end 484 put Code get C 2 0 485 ret 2 486 end 487 fn missing to ulong 488 if eq get C 1 0 489 ret 1 490 end 491 for i ulong get C 1 492 if eq get Have i 0 493 ret add i 1 494 end 495 end 496 ret 0 497 end 498 note Display admission is distinct from a model's closing sentence. 499 fn codeshow seq ulong to bool 500 if eq get R 1 0 501 ret false 502 end 503 if or ne seq get R 0 ne seq get C 0 504 ret false 505 end 506 if ne codestat 2 507 ret false 508 end 509 put R 6 1 510 ret true 511 end 512 note Pure courier datagrams. Q session, current seq, last LINE, head, count. 513 global Q ulong 8 514 global N ulong 8 515 global Queue uchar 2560 516 global Qlens ulong 8 517 global Jbuf uchar 4096 518 global Jhave uchar 5 519 global J ulong 3 520 text Keys "ALLEN-COURIER v=1 run= kind= seq= part= bytes=" 521 text Kinds "JOBLINEGOTACKHELLOHI" 522 fn keyread off ulong count ulong to void 523 for i ulong count 524 expect get Keys add off i 525 end 526 end 527 fn keyemit off ulong count ulong to void 528 for i ulong count 529 emitb get Keys add off i 530 end 531 end 532 fn kindoff k ulong to ulong 533 if eq k 1 534 ret 0 535 end 536 if eq k 2 537 ret 3 538 end 539 if eq k 3 540 ret 7 541 end 542 if eq k 4 543 ret 10 544 end 545 if eq k 5 546 ret 13 547 end 548 ret 18 549 end 550 fn kindlen k ulong to ulong 551 if eq k 2 552 ret 4 553 end 554 if eq k 5 555 ret 5 556 end 557 if eq k 6 558 ret 2 559 end 560 ret 3 561 end 562 fn qbegin run ulong seq ulong to void 563 for i ulong 8 564 put Q i 0 565 end 566 put Q 0 run 567 put Q 1 seq 568 for i ulong 5 569 put Jhave i 0 570 end 571 for i ulong 3 572 put J i 0 573 end 574 end 575 note Serializer takes body In/Inlen; Outb/Outlen are published only on success. 576 fn packet k ulong seq ulong part ulong total ulong bytes ulong to bool 577 if or lt k 1 gt k 6 578 ret false 579 end 580 if gt get Inlen 0 1000 581 ret false 582 end 583 outreset 584 keyemit 0 22 585 for i ulong 16 586 d = and shr get Q 0 mul sub 15 i 4 15 587 emitb get Digits d 588 end 589 keyemit 22 6 590 off = kindoff k 591 for i ulong kindlen k 592 emitb get Kinds add off i 593 end 594 keyemit 28 5 595 emitn seq 596 keyemit 33 6 597 emitn part 598 emitb 47 599 emitn total 600 keyemit 39 7 601 emitn bytes 602 emitb 10 603 for i ulong get Inlen 0 604 emitb get In i 605 end 606 ret eq get Err 0 0 607 end 608 fn pkparse to bool 609 if or gt get Inlen 0 1200 lt get Inlen 0 65 610 ret false 611 end 612 put P 0 0 613 put P 2 0 614 keyread 0 22 615 run = ulong 0 616 for i ulong 16 617 p = get P 0 618 c = get In p 619 d = ulong 16 620 if isdigit c 621 d = sub ulong c 48 622 else 623 if and ge c 97 le c 102 624 d = sub ulong c 87 625 end 626 end 627 if ge d 16 628 ret false 629 end 630 run = or shl run 4 d 631 put P 0 add p 1 632 end 633 if ne run get Q 0 634 ret false 635 end 636 keyread 22 6 637 kind = ulong 0 638 for k ulong 6 639 at = get P 0 640 off = kindoff add k 1 641 size = kindlen add k 1 642 ok = true 643 for i ulong size 644 if not ineq add at i get Kinds add off i 645 ok = false 646 end 647 end 648 if and ok ineq add at size 32 649 kind = add k 1 650 end 651 end 652 if eq kind 0 653 ret false 654 end 655 put N 0 kind 656 put P 0 add get P 0 kindlen kind 657 keyread 28 5 658 number 659 put N 1 get P 1 660 keyread 33 6 661 number 662 put N 2 get P 1 663 expect 47 664 number 665 put N 3 get P 1 666 keyread 39 7 667 number 668 put N 4 get P 1 669 expect 10 670 put N 5 get P 0 671 put N 6 sub get Inlen 0 get P 0 672 ret eq get P 2 0 673 end 674 fn jobtake to ulong 675 note n via N4 676 note part via N2 677 note total via N3 678 if or eq get N 4 0 gt get N 4 4096 679 ret 0 680 end 681 if ne get N 3 div add get N 4 999 1000 682 ret 0 683 end 684 if or eq get N 2 0 gt get N 2 get N 3 685 ret 0 686 end 687 want = ulong 1000 688 if eq get N 2 get N 3 689 want = sub get N 4 mul sub get N 3 1 1000 690 end 691 if ne want get N 6 692 ret 0 693 end 694 if ne get J 0 0 695 if or ne get J 0 get N 4 ne get J 1 get N 3 696 ret 0 697 end 698 end 699 slot = sub get N 2 1 700 off = mul slot 1000 701 if ne get Jhave slot 0 702 for i ulong want 703 if ne get Jbuf add off i get In add get N 5 i 704 ret 0 705 end 706 end 707 ret 2 708 end 709 for i ulong want 710 put Jbuf add off i get In add get N 5 i 711 end 712 put Jhave slot 1 713 put J 0 get N 4 714 put J 1 get N 3 715 put J 2 add get J 2 1 716 ret 1 717 end 718 note Return0 refused,1 accepted,2 duplicate requiring GOT/ACK again. 719 fn qreceive to ulong 720 if not pkparse 721 ret 0 722 end 723 if ne get N 1 get Q 1 724 ret 0 725 end 726 kind = get N 0 727 if eq kind 1 728 ret jobtake 729 end 730 if ne kind 2 731 if ne get N 6 0 732 ret 0 733 end 734 ret 1 735 end 736 note part via N2 737 if eq get N 2 0 738 ret 0 739 end 740 if le get N 2 get Q 2 741 ret 2 742 end 743 if or ne get N 2 add get Q 2 1 eq get Q 4 8 744 ret 0 745 end 746 n = get N 6 747 if or eq n 0 gt n 319 748 ret 0 749 end 750 slot = rem add get Q 3 get Q 4 8 751 for i ulong n 752 put Queue add mul slot 320 i get In add get N 5 i 753 end 754 put Qlens slot n 755 put Q 4 add get Q 4 1 756 put Q 2 get N 2 757 ret 1 758 end 759 fn qtake to bool 760 if eq get Q 4 0 761 ret false 762 end 763 slot = get Q 3 764 n = get Qlens slot 765 for i ulong n 766 put In i get Queue add mul slot 320 i 767 end 768 put Inlen 0 n 769 put Q 3 rem add slot 1 8 770 put Q 4 sub get Q 4 1 771 ret true 772 end 773 note L725 compilable behavioral stub, retained only in RED evidence. 774 global T ulong 16 775 global JobOut uchar 4096 776 fn qstart run ulong now ulong to bool 777 ret false 778 end 779 fn qready now ulong to bool 780 ret false 781 end 782 fn qsubmit now ulong to bool 783 ret false 784 end 785 fn qnext now ulong link bool to bool 786 ret false 787 end 788 fn qsent now ulong ok bool to bool 789 ret false 790 end 791 fn qincoming now ulong to ulong 792 ret 0 793 end 794 fn qcancel to void 795 end 796 global Fails ulong 1 797 global Checks ulong 1 798 fn check ok bool id ulong to void 799 put Checks 0 add get Checks 0 1 800 outreset 801 emitn id 802 if ok 803 emitb 32 804 emitb 48 805 else 806 put Fails 0 add get Fails 0 1 807 emitb 32 808 emitb 49 809 end 810 emitb 10 811 w = write 1 Outb 0 get Outlen 0 812 end 813 note Native courier lifecycle regression. Clock values are injected milliseconds. 814 text Lineone "SAY 1 1/1 Model text." 815 fn test ok bool to void 816 check ok add get Checks 0 1 817 end 818 fn tcopy to void 819 put Inlen 0 get Outlen 0 820 for i ulong get Outlen 0 821 put In i get Outb i 822 end 823 end 824 fn control kind ulong seq ulong to void 825 put Inlen 0 0 826 b = packet kind seq 0 0 0 827 tcopy 828 end 829 fn linepkt part ulong to void 830 put Inlen 0 len Lineone 831 for i ulong len Lineone 832 put In i get Lineone i 833 end 834 b = packet 2 get Q 1 part 0 0 835 tcopy 836 end 837 fn jobinput to void 838 put Inlen 0 1001 839 for i ulong 1001 840 put In i 120 841 end 842 put In 999 10 843 put In 1000 121 844 end 845 fn main to int 846 test qstart 42 100 847 test not qready 100 848 test not qnext 100 false 849 test eq get T 3 0 850 test qnext 100 true 851 test eq get T 10 5 852 test not qnext 100 true 853 test qsent 100 false 854 test eq get T 3 0 855 test qnext 101 true 856 test qsent 101 true 857 test eq get T 3 1 858 test not qnext 2100 true 859 test qnext 2101 true 860 test qsent 2101 true 861 control 6 0 862 test eq qincoming 2102 1 863 test qready 2102 864 test not qnext 12100 true 865 test qnext 12101 true 866 test eq get T 10 5 867 test qsent 12101 true 868 test qready 32101 869 test not qready 32102 870 test qnext 32102 true 871 test qsent 32102 true 872 test not qnext 32101 true 873 test eq get T 0 32102 874 jobinput 875 test qsubmit 32103 876 test eq get Q 1 1 877 test eq get JobOut 999 32 878 test eq get JobOut 1000 121 879 test not qsubmit 32103 880 test qnext 32103 true 881 test eq get T 10 1 882 test eq get T 11 1 883 tcopy 884 test pkparse 885 test eq get N 6 1000 886 test eq get In add get N 5 999 32 887 test qsent 32103 false 888 test eq get T 9 1 889 test qnext 32104 true 890 test eq get T 11 1 891 test qsent 32104 true 892 test qnext 32104 true 893 test eq get T 11 2 894 tcopy 895 test pkparse 896 test eq get N 6 1 897 test eq get In get N 5 121 898 test qsent 32104 true 899 test eq get T 9 0 900 control 6 0 901 test eq qincoming 32105 1 902 test qready 32105 903 test not qnext 34103 true 904 test qnext 34104 true 905 test eq get T 10 1 906 test eq get T 11 1 907 test qsent 34104 true 908 test qnext 34104 true 909 test eq get T 11 2 910 test qsent 34104 true 911 control 4 2 912 test eq qincoming 34105 0 913 test eq get T 6 0 914 control 4 1 915 test eq qincoming 34105 1 916 test eq get T 6 1 917 test not qnext 36104 true 918 linepkt 1 919 test eq qincoming 36105 1 920 test eq get Q 4 1 921 test eq get T 13 1 922 test qnext 36105 true 923 test eq get T 10 3 924 test qsent 36105 false 925 test eq get T 13 1 926 linepkt 1 927 test eq qincoming 36106 2 928 test eq get Q 4 1 929 test qnext 36106 true 930 test eq get T 10 3 931 test qsent 36106 true 932 test eq get T 13 0 933 test qtake 934 test eq get Inlen 0 len Lineone 935 test not qtake 936 linepkt 2 937 test eq qincoming 36107 1 938 linepkt 3 939 test eq qincoming 36107 0 940 test eq get Q 2 2 941 test eq get Q 4 1 942 test qnext 36108 true 943 test qsent 36108 true 944 linepkt 3 945 test eq qincoming 36109 1 946 test eq get Q 2 3 947 qcancel 948 test eq get T 5 0 949 linepkt 4 950 test eq qincoming 36110 0 951 jobinput 952 test qsubmit 36111 953 test eq get Q 1 2 954 test eq get Q 4 0 955 control 6 0 956 test eq qincoming 36112 1 957 control 6 0 958 put In 22 49 959 test eq qincoming 36113 0 960 test eq get T 2 36112 961 control 4 2 962 test eq qincoming 36110 0 963 test eq get T 6 0 964 qcancel 965 put Q 1 `4294967295` 966 jobinput 967 test not qsubmit 36114 968 test eq get Q 1 `4294967295` 969 test not qstart 0 36114 970 test eq get Q 0 42 971 test qstart 43 0 972 put Inlen 0 4097 973 test not qsubmit 0 974 test eq get Q 1 0 975 put Inlen 0 0 976 test not qsubmit 0 977 test not qsent 0 true 978 ret int get Fails 0 979 end