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/seed/host/aien-ioctl.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 / seed / host / aien-ioctl.om` 705 lines ยท 12361 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note CPU-only qualification: compiler, qemu-x86_64 oracle, fresh scratch directory. 3 note All ioctl executions use fd -1; no device is opened. Compiler/runtime are seeded Omega. 4 note Process packets, bounded child waits and exclusive artifacts follow qualification/om2/gate.om. 5 text matrix "seed/host/aien-ioctl.cases" 6 text omcsrc "seed/omc/omc.om" 7 text nullpath "/dev/null" 8 text pieces "target x86linux\n|global b uchar 4096\nfn main to int\nr = devctl neg int 1 uint | b 0 |\nif ne r neg long 9\nret 1\nend\nret 0\nend\n|om2\nexport fn ctl fd long to long\nb = new uchar 4096 0\nret devctl int fd uint |\nend\n|global b uchar 4096\nfn call request uint to long\nret devctl neg int 1 request b 0 112\nend\nfn main to int\nret int call uint `2154840336`\nend\n|om2\nexport fn ctl fd long request uint to long\nb = new uchar 4096 0\nret devctl int fd request b 0 112\nend\n|/|case-|.src|.elf|.cerr|.out|.err|.compiler|.mutant|error 9\n|AIEN-IOCTL FAIL |AIEN-IOCTL PASS native, x86-QEMU, function admissions, encoded/runtime refusals; four mutants killed; chip NOT_RUN\n|AIEN-IOCTL mutant killed |AIEN-IOCTL mutant survived |AIEN-IOCTL baseline\n|\nif ne r neg long 25\nret 1\nend\nret 0\nend\n|AIEN-IOCTL unexpected mutant failure |arch/span/phase/observed:\n|" 9 text mfrom "ok = or ok eq q `3222815012`\nif not ok|eq q `2154840336`|put a_ar add get a_rb 77 add x 23 xhreq 166 x\ne = harray x 1\nt = alloc\nmatconst t get a_ar add get a_rb 77 add x 23\ne3 `3942645760` 31 get a_ar add get a_rb 77 add x 22 t\ntrapc 1 3|xhs 2 get a_ar add get a_rb 77 add x 22\nxhcmp 2 get a_ar add get a_rb 77 add x 23\nxtrap 1 3\nxha x 4 7|" 10 text mto "ok = or ok eq q `3222815012`\nif false|eq q `2154840337`|put a_ar add get a_rb 77 add x 23 xhreq 166 x\ne = harray x 1\nt = alloc\nmatconst t get a_ar add get a_rb 77 add x 23\ne3 `3942645760` 31 get a_ar add get a_rb 77 add x 22 t|xhs 2 get a_ar add get a_rb 77 add x 22\nxhcmp 2 get a_ar add get a_rb 77 add x 23\nxha x 4 7|" 11 global cc uchar 4096 12 global cn ulong 1 13 global pinned uchar 4096 14 global pinlen ulong 1 15 global qemu uchar 4096 16 global qn ulong 1 17 global scratch uchar 4096 18 global sn ulong 1 19 global path uchar 8192 20 global pn ulong 1 21 global packet uchar 16384 22 global packetn ulong 2 23 global status uchar 4 24 global data uchar 65536 25 global dn ulong 1 26 global fields ulong 14 27 global fieldn ulong 1 28 global row ulong 2 29 global src uchar `16777216` 30 global srcn ulong 1 31 global compiler uchar `16777216` 32 global omclen ulong 1 33 global tmp uchar 65536 34 global nums uchar 24 35 global number ulong 1 36 global cut ulong 2 37 global serial ulong 1 38 global current ulong 1 39 global curarch ulong 1 40 global curspan ulong 1 41 global why ulong 1 42 global actual long 1 43 global mutating ulong 1 44 text loud "AIEN-IOCTL INVALID mutant anchor must occur exactly once in seed/omc/omc.om (mutant not applied; not a compiler verdict); respell mfrom/mto with the compiler change. mutant/count:\n|AIEN-IOCTL INVALID cannot create fresh scratch directory (it must not exist): |\n|AIEN-IOCTL expected mutant failure |AIEN-IOCTL INVALID mutated compiler did not build; mutant/status:\n|" 45 fn shout id ulong to void 46 s = ulong 0 47 k = ulong 1 48 for i ulong len loud 49 if eq get loud i 124 50 if eq k id 51 r = write 1 loud s sub i s 52 ret 53 end 54 s = add i 1 55 k = add k 1 56 end 57 end 58 exit 91 59 end 60 fn part id ulong to void 61 s = ulong 0 62 k = ulong 1 63 for i ulong len pieces 64 if eq get pieces i 124 65 if eq k id 66 put cut 0 s 67 put cut 1 sub i s 68 ret 69 end 70 s = add i 1 71 k = add k 1 72 end 73 end 74 exit 91 75 end 76 fn say id ulong to void 77 part id 78 r = write 1 pieces get cut 0 get cut 1 79 end 80 fn digits v ulong to void 81 n = ulong 0 82 while ge v 10 83 put nums n uchar add 48 rem v 10 84 n = add n 1 85 v = div v 10 86 end 87 put nums n uchar add 48 v 88 put number 0 add n 1 89 end 90 fn show v ulong to void 91 digits v 92 for i ulong get number 0 93 r = write 1 nums sub sub get number 0 i 1 1 94 end 95 put nums 0 10 96 r = write 1 nums 0 1 97 end 98 fn pathpart id ulong to void 99 part id 100 s = get cut 0 101 n = get cut 1 102 p = get pn 0 103 for i ulong n 104 put path add p i get pieces add s i 105 end 106 put pn 0 add p n 107 end 108 fn casepath suffix ulong to void 109 put pn 0 get sn 0 110 for i ulong get sn 0 111 put path i get scratch i 112 end 113 pathpart 9 114 pathpart 10 115 digits get current 0 116 n = get number 0 117 p = get pn 0 118 for i ulong n 119 put path add p i get nums sub sub n i 1 120 end 121 put pn 0 add p n 122 pathpart suffix 123 end 124 fn openpath flags int to int 125 ret int fopen path 0 get pn 0 flags 448 126 end 127 fn writeall fd int n ulong to bool 128 p = ulong 0 129 while lt p n 130 r = write fd src p sub n p 131 if le r 0 132 ret false 133 end 134 p = add p ulong r 135 end 136 ret true 137 end 138 fn packetclear to void 139 put packetn 0 2 140 put packetn 1 0 141 end 142 fn packetpath to void 143 n = get pn 0 144 p = get packetn 0 145 if gt add add p 2 n len packet 146 exit 91 147 end 148 put packet p uchar n 149 put packet add p 1 uchar shr n 8 150 for i ulong n 151 put packet add add p 2 i get path i 152 end 153 put packetn 0 add add p 2 n 154 put packetn 1 add get packetn 1 1 155 end 156 fn redir fd int target int to void 157 if ne dupfd fd target 0 long target 158 exit 127 159 end 160 end 161 fn spawn fi int fo int fe int to long 162 put packet 0 uchar get packetn 1 163 put packet 1 uchar shr get packetn 1 8 164 pid = fork 165 if lt pid 0 166 exit 91 167 end 168 if eq pid 0 169 redir fi 0 170 redir fo 1 171 redir fe 2 172 r = execprog packet 0 get packetn 0 173 exit 127 174 end 175 r = fclose fi 176 r = fclose fo 177 r = fclose fe 178 start = monons 179 while true 180 r = waitpid int pid status 0 4 1 181 if eq r pid 182 if ne get status 0 0 183 ret -1 184 end 185 ret long get status 1 186 end 187 if lt r 0 188 exit 91 189 end 190 if gt sub monons start `30000000000` 191 r = killpid int pid 9 192 r = waitpid int pid status 0 4 0 193 exit 91 194 end 195 r = sleepns `1000000` 196 end 197 ret -1 198 end 199 fn compile to long 200 packetclear 201 put pn 0 get cn 0 202 for i ulong get cn 0 203 put path i get cc i 204 end 205 packetpath 206 casepath 11 207 fi = openpath 524288 208 casepath 12 209 fo = openpath 524481 210 casepath 13 211 fe = openpath 524481 212 if or or lt fi 0 lt fo 0 lt fe 0 213 exit 91 214 end 215 r = spawn fi fo fe 216 put actual 0 r 217 ret r 218 end 219 fn readartifact suffix ulong to long 220 casepath suffix 221 fd = openpath 524288 222 if lt fd 0 223 exit 91 224 end 225 n = read fd tmp 0 len tmp 226 r = fclose fd 227 ret n 228 end 229 fn refuse to bool 230 put why 0 4 231 if ne compile 9 232 ret false 233 end 234 if ne readartifact 12 0 235 ret false 236 end 237 n = readartifact 13 238 if lt n 8 239 ret false 240 end 241 part 18 242 s = get cut 0 243 m = get cut 1 244 for i ulong add sub ulong n m 1 245 ok = true 246 for j ulong m 247 a = get tmp add i j 248 b = get pieces add s j 249 if ne a b 250 ok = false 251 end 252 end 253 if ok 254 ret true 255 end 256 end 257 ret false 258 end 259 fn run arch ulong expected long to bool 260 put why 0 1 261 if ne compile 0 262 ret false 263 end 264 put why 0 3 265 n = readartifact 12 266 if lt n 4 267 ret false 268 end 269 if or ne get tmp 0 127 ne get tmp 1 69 270 ret false 271 end 272 if or ne get tmp 2 76 ne get tmp 3 70 273 ret false 274 end 275 casepath 12 276 fd = openpath 524288 277 if ne fchmod fd 448 0 278 exit 91 279 end 280 r = fclose fd 281 packetclear 282 if eq arch 1 283 put pn 0 get qn 0 284 for i ulong get qn 0 285 put path i get qemu i 286 end 287 packetpath 288 end 289 casepath 12 290 packetpath 291 fi = int fopen nullpath 0 len nullpath 524288 0 292 casepath 14 293 fo = openpath 524481 294 casepath 15 295 fe = openpath 524481 296 put why 0 2 297 r = spawn fi fo fe 298 put actual 0 r 299 if ne r expected 300 ret false 301 end 302 put why 0 3 303 if ne readartifact 14 0 304 ret false 305 end 306 ret eq readartifact 15 0 307 end 308 fn addpart id ulong to void 309 part id 310 s = get cut 0 311 n = get cut 1 312 p = get srcn 0 313 for i ulong n 314 put src add p i get pieces add s i 315 end 316 put srcn 0 add p n 317 end 318 fn addfield id ulong to void 319 s = get fields mul id 2 320 n = get fields add mul id 2 1 321 p = get srcn 0 322 for i ulong n 323 put src add p i get data add s i 324 end 325 put srcn 0 add p n 326 end 327 fn savecase to void 328 put serial 0 add get serial 0 1 329 put current 0 get serial 0 330 casepath 11 331 fd = openpath 524481 332 if lt fd 0 333 exit 91 334 end 335 ok = writeall fd get srcn 0 336 r = fclose fd 337 if not ok 338 exit 91 339 end 340 end 341 fn fixture arch ulong span ulong dynamic bool to void 342 put srcn 0 0 343 put curarch 0 arch 344 put curspan 0 span 345 if eq arch 1 346 addpart 1 347 end 348 if dynamic 349 if eq arch 2 350 addpart 8 351 else 352 addpart 7 353 end 354 else 355 if eq arch 2 356 addpart 5 357 else 358 addpart 2 359 end 360 addfield 2 361 addpart 3 362 addfield span 363 if eq arch 2 364 addpart 6 365 else 366 if eq arch 1 367 addpart 24 368 else 369 addpart 4 370 end 371 end 372 end 373 savecase 374 end 375 fn nextrow to bool 376 p = get row 0 377 while lt p get dn 0 378 s = p 379 while and lt p get dn 0 ne get data p 10 380 p = add p 1 381 end 382 put row 1 s 383 put row 0 add p 1 384 if and lt s p ne get data s 35 385 k = ulong 0 386 while lt s p 387 while and lt s p eq get data s 32 388 s = add s 1 389 end 390 if lt s p 391 e = s 392 while and lt e p ne get data e 32 393 e = add e 1 394 end 395 if ge k 7 396 exit 91 397 end 398 put fields mul k 2 s 399 put fields add mul k 2 1 sub e s 400 k = add k 1 401 s = e 402 end 403 end 404 put fieldn 0 k 405 ret true 406 end 407 p = add p 1 408 end 409 ret false 410 end 411 fn failcase to bool 412 if ne get mutating 0 0 413 shout 4 414 else 415 say 19 416 end 417 show get current 0 418 say 26 419 show get curarch 0 420 show get curspan 0 421 show get why 0 422 if ge get actual 0 0 423 show ulong get actual 0 424 else 425 show 999 426 end 427 ret false 428 end 429 fn qualify to bool 430 put row 0 0 431 while nextrow 432 allow = eq get data get fields 0 97 433 for arch ulong 3 434 fixture arch 3 false 435 if allow 436 if eq arch 2 437 put why 0 1 438 if ne compile 0 439 ret failcase 440 end 441 if le readartifact 12 0 442 ret failcase 443 end 444 else 445 if not run arch 0 446 ret failcase 447 end 448 for mode ulong 2 449 fixture arch add mode 4 false 450 if not run arch 103 451 ret failcase 452 end 453 end 454 end 455 else 456 if not refuse 457 ret failcase 458 end 459 end 460 end 461 end 462 for arch ulong 3 463 fixture arch 3 true 464 if not refuse 465 ret failcase 466 end 467 end 468 ret true 469 end 470 fn matchmut at ulong o ulong n ulong to bool 471 for j ulong n 472 a = get compiler add at j 473 b = get mfrom add o j 474 if ne a b 475 ret false 476 end 477 end 478 ret true 479 end 480 fn selectold which ulong to void 481 s = ulong 0 482 k = ulong 0 483 for i ulong len mfrom 484 if eq get mfrom i 124 485 if eq k which 486 put cut 0 s 487 put cut 1 sub i s 488 end 489 s = add i 1 490 k = add k 1 491 end 492 end 493 end 494 fn anchors to ulong 495 count = ulong 0 496 o = get cut 0 497 n = get cut 1 498 for i ulong add sub get omclen 0 n 1 499 if matchmut i o n 500 count = add count 1 501 end 502 end 503 ret count 504 end 505 fn locate which ulong to ulong 506 at = ulong 0 507 count = ulong 0 508 o = get cut 0 509 n = get cut 1 510 for i ulong add sub get omclen 0 n 1 511 if matchmut i o n 512 at = i 513 count = add count 1 514 end 515 end 516 if ne count 1 517 shout 1 518 show which 519 show count 520 exit 92 521 end 522 ret at 523 end 524 fn copycc start ulong n ulong to void 525 p = get srcn 0 526 for i ulong n 527 put src add p i get compiler add start i 528 end 529 put srcn 0 add p n 530 end 531 fn appendnew which ulong to void 532 s = ulong 0 533 k = ulong 0 534 for i ulong len mto 535 if eq get mto i 124 536 if eq k which 537 p = get srcn 0 538 for j ulong sub i s 539 put src add p j get mto add s j 540 end 541 put srcn 0 add p sub i s 542 end 543 s = add i 1 544 k = add k 1 545 end 546 end 547 end 548 fn mutate which ulong to void 549 selectold which 550 at = locate which 551 oldend = add at get cut 1 552 put srcn 0 0 553 copycc 0 at 554 appendnew which 555 copycc oldend sub get omclen 0 oldend 556 savecase 557 if ne compile 0 558 shout 5 559 show which 560 if ge get actual 0 0 561 show ulong get actual 0 562 else 563 show 999 564 end 565 exit 91 566 end 567 casepath 12 568 fd = openpath 524288 569 if ne fchmod fd 448 0 570 exit 91 571 end 572 r = fclose fd 573 put cn 0 get pn 0 574 for i ulong get pn 0 575 put cc i get path i 576 end 577 end 578 note A failed child/compile is never a generic mutant kill. Attribute each intended assertion. 579 fn killed m ulong to bool 580 if eq m 0 581 if ne get why 0 4 582 ret false 583 end 584 if ne get actual 0 0 585 ret false 586 end 587 if ne get curarch 0 0 588 ret false 589 end 590 n = readartifact 12 591 if lt n 4 592 ret false 593 end 594 if or ne get tmp 0 127 ne get tmp 1 69 595 ret false 596 end 597 ret and eq get tmp 2 76 eq get tmp 3 70 598 end 599 if eq m 1 600 if ne get why 0 1 601 ret false 602 end 603 ret eq get actual 0 9 604 end 605 if ne get why 0 2 606 ret false 607 end 608 if ne get actual 0 0 609 ret false 610 end 611 if ne get curspan 0 4 612 ret false 613 end 614 ret eq get curarch 0 sub m 2 615 end 616 fn main to int 617 if ne argcnt 4 618 ret 90 619 end 620 n = argread 1 pinned 0 4095 621 if lt n 1 622 ret 90 623 end 624 put pinlen 0 ulong n 625 n = argread 2 qemu 0 4095 626 if lt n 1 627 ret 90 628 end 629 put qn 0 ulong n 630 n = argread 3 scratch 0 4095 631 if lt n 1 632 ret 90 633 end 634 put sn 0 ulong n 635 if ne makedir scratch 0 ulong n 448 0 636 shout 2 637 w = write 1 scratch 0 ulong n 638 shout 3 639 ret 91 640 end 641 fd = int fopen matrix 0 len matrix 524288 0 642 if lt fd 0 643 ret 91 644 end 645 n = read fd data 0 len data 646 r = fclose fd 647 if or lt n 1 ge ulong n len data 648 ret 91 649 end 650 put dn 0 ulong n 651 fd = int fopen omcsrc 0 len omcsrc 524288 0 652 if lt fd 0 653 ret 91 654 end 655 n = read fd compiler 0 len compiler 656 r = fclose fd 657 if or lt n 1 ge ulong n len compiler 658 ret 91 659 end 660 put omclen 0 ulong n 661 put cn 0 get pinlen 0 662 for i ulong get pinlen 0 663 put cc i get pinned i 664 end 665 bad = false 666 for m ulong 4 667 selectold m 668 c = anchors 669 if ne c 1 670 shout 1 671 show m 672 show c 673 bad = true 674 end 675 end 676 if bad 677 ret 92 678 end 679 say 23 680 if not qualify 681 ret 1 682 end 683 for m ulong 4 684 put cn 0 get pinlen 0 685 for i ulong get pinlen 0 686 put cc i get pinned i 687 end 688 put mutating 0 1 689 mutate m 690 if qualify 691 say 22 692 show m 693 ret 1 694 end 695 if not killed m 696 say 25 697 show m 698 ret 1 699 end 700 say 21 701 show m 702 end 703 say 20 704 ret 0 705 end