Showing the changes to src/vm/sys/Sysmod.cpp (1 of 1 file). Show all
Unified · Split
| @@ -305,21 +305,21 @@ void · 304 unmodified lines | |||
| 305 | Sys_announce(vm_registers_t &r, vm_t &vm) | 305 | Sys_announce(vm_registers_t &r, vm_t &vm) |
| 306 | { | 306 | { |
| 307 | auto &fp = r.stack.peek_frame()->base<F_Sys_announce>(); | 307 | auto &fp = r.stack.peek_frame()->base<F_Sys_announce>(); |
| 308 | throw vm_system_exception{ "Instruction not implemented" }; | 308 | throw vm_system_exception{ "Function not implemented" }; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | void | 311 | void |
| 312 | Sys_aprint(vm_registers_t &r, vm_t &vm) | 312 | Sys_aprint(vm_registers_t &r, vm_t &vm) |
| 313 | { | 313 | { |
| 314 | auto &fp = r.stack.peek_frame()->base<F_Sys_aprint>(); | 314 | auto &fp = r.stack.peek_frame()->base<F_Sys_aprint>(); |
| 315 | throw vm_system_exception{ "Instruction not implemented" }; | 315 | throw vm_system_exception{ "Function not implemented" }; |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | void | 318 | void |
| 319 | Sys_bind(vm_registers_t &r, vm_t &vm) | 319 | Sys_bind(vm_registers_t &r, vm_t &vm) |
| 320 | { | 320 | { |
| 321 | auto &fp = r.stack.peek_frame()->base<F_Sys_bind>(); | 321 | auto &fp = r.stack.peek_frame()->base<F_Sys_bind>(); |
| 322 | throw vm_system_exception{ "Instruction not implemented" }; | 322 | throw vm_system_exception{ "Function not implemented" }; |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | void | 325 | void |
| @@ -403,7 +403,7 @@ void · 77 unmodified lines | |||
| 403 | Sys_chdir(vm_registers_t &r, vm_t &vm) | 403 | Sys_chdir(vm_registers_t &r, vm_t &vm) |
| 404 | { | 404 | { |
| 405 | auto &fp = r.stack.peek_frame()->base<F_Sys_chdir>(); | 405 | auto &fp = r.stack.peek_frame()->base<F_Sys_chdir>(); |
| 406 | throw vm_system_exception{ "Instruction not implemented" }; | 406 | throw vm_system_exception{ "Function not implemented" }; |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | void | 409 | void |
| @@ -445,49 +445,48 @@ Sys_create(vm_registers_t &r, vm_t &vm) · 35 unmodified lines | |||
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | *fp.ret = fd_alloc->get_allocation(); | 447 | *fp.ret = fd_alloc->get_allocation(); |
| 448 | fd_alloc->add_ref(); | ||
| 449 | } | 448 | } |
| 450 | 449 | ||
| 451 | void | 450 | void |
| 452 | Sys_dial(vm_registers_t &r, vm_t &vm) | 451 | Sys_dial(vm_registers_t &r, vm_t &vm) |
| 453 | { | 452 | { |
| 454 | auto &fp = r.stack.peek_frame()->base<F_Sys_dial>(); | 453 | auto &fp = r.stack.peek_frame()->base<F_Sys_dial>(); |
| 455 | throw vm_system_exception{ "Instruction not implemented" }; | 454 | throw vm_system_exception{ "Function not implemented" }; |
| 456 | } | 455 | } |
| 457 | 456 | ||
| 458 | void | 457 | void |
| 459 | Sys_dirread(vm_registers_t &r, vm_t &vm) | 458 | Sys_dirread(vm_registers_t &r, vm_t &vm) |
| 460 | { | 459 | { |
| 461 | auto &fp = r.stack.peek_frame()->base<F_Sys_dirread>(); | 460 | auto &fp = r.stack.peek_frame()->base<F_Sys_dirread>(); |
| 462 | throw vm_system_exception{ "Instruction not implemented" }; | 461 | throw vm_system_exception{ "Function not implemented" }; |
| 463 | } | 462 | } |
| 464 | 463 | ||
| 465 | void | 464 | void |
| 466 | Sys_dup(vm_registers_t &r, vm_t &vm) | 465 | Sys_dup(vm_registers_t &r, vm_t &vm) |
| 467 | { | 466 | { |
| 468 | auto &fp = r.stack.peek_frame()->base<F_Sys_dup>(); | 467 | auto &fp = r.stack.peek_frame()->base<F_Sys_dup>(); |
| 469 | throw vm_system_exception{ "Instruction not implemented" }; | 468 | throw vm_system_exception{ "Function not implemented" }; |
| 470 | } | 469 | } |
| 471 | 470 | ||
| 472 | void | 471 | void |
| 473 | Sys_export(vm_registers_t &r, vm_t &vm) | 472 | Sys_export(vm_registers_t &r, vm_t &vm) |
| 474 | { | 473 | { |
| 475 | auto &fp = r.stack.peek_frame()->base<F_Sys_export>(); | 474 | auto &fp = r.stack.peek_frame()->base<F_Sys_export>(); |
| 476 | throw vm_system_exception{ "Instruction not implemented" }; | 475 | throw vm_system_exception{ "Function not implemented" }; |
| 477 | } | 476 | } |
| 478 | 477 | ||
| 479 | void | 478 | void |
| 480 | Sys_fauth(vm_registers_t &r, vm_t &vm) | 479 | Sys_fauth(vm_registers_t &r, vm_t &vm) |
| 481 | { | 480 | { |
| 482 | auto &fp = r.stack.peek_frame()->base<F_Sys_fauth>(); | 481 | auto &fp = r.stack.peek_frame()->base<F_Sys_fauth>(); |
| 483 | throw vm_system_exception{ "Instruction not implemented" }; | 482 | throw vm_system_exception{ "Function not implemented" }; |
| 484 | } | 483 | } |
| 485 | 484 | ||
| 486 | void | 485 | void |
| 487 | Sys_fd2path(vm_registers_t &r, vm_t &vm) | 486 | Sys_fd2path(vm_registers_t &r, vm_t &vm) |
| 488 | { | 487 | { |
| 489 | auto &fp = r.stack.peek_frame()->base<F_Sys_fd2path>(); | 488 | auto &fp = r.stack.peek_frame()->base<F_Sys_fd2path>(); |
| 490 | throw vm_system_exception{ "Instruction not implemented" }; | 489 | throw vm_system_exception{ "Function not implemented" }; |
| 491 | } | 490 | } |
| 492 | 491 | ||
| 493 | void | 492 | void |
| @@ -510,7 +509,7 @@ void · 16 unmodified lines | |||
| 510 | Sys_file2chan(vm_registers_t &r, vm_t &vm) | 509 | Sys_file2chan(vm_registers_t &r, vm_t &vm) |
| 511 | { | 510 | { |
| 512 | auto &fp = r.stack.peek_frame()->base<F_Sys_file2chan>(); | 511 | auto &fp = r.stack.peek_frame()->base<F_Sys_file2chan>(); |
| 513 | throw vm_system_exception{ "Instruction not implemented" }; | 512 | throw vm_system_exception{ "Function not implemented" }; |
| 514 | } | 513 | } |
| 515 | 514 | ||
| 516 | void | 515 | void |
| @@ -532,35 +531,35 @@ void · 15 unmodified lines | |||
| 532 | Sys_fstat(vm_registers_t &r, vm_t &vm) | 531 | Sys_fstat(vm_registers_t &r, vm_t &vm) |
| 533 | { | 532 | { |
| 534 | auto &fp = r.stack.peek_frame()->base<F_Sys_fstat>(); | 533 | auto &fp = r.stack.peek_frame()->base<F_Sys_fstat>(); |
| 535 | throw vm_system_exception{ "Instruction not implemented" }; | 534 | throw vm_system_exception{ "Function not implemented" }; |
| 536 | } | 535 | } |
| 537 | 536 | ||
| 538 | void | 537 | void |
| 539 | Sys_fversion(vm_registers_t &r, vm_t &vm) | 538 | Sys_fversion(vm_registers_t &r, vm_t &vm) |
| 540 | { | 539 | { |
| 541 | auto &fp = r.stack.peek_frame()->base<F_Sys_fversion>(); | 540 | auto &fp = r.stack.peek_frame()->base<F_Sys_fversion>(); |
| 542 | throw vm_system_exception{ "Instruction not implemented" }; | 541 | throw vm_system_exception{ "Function not implemented" }; |
| 543 | } | 542 | } |
| 544 | 543 | ||
| 545 | void | 544 | void |
| 546 | Sys_fwstat(vm_registers_t &r, vm_t &vm) | 545 | Sys_fwstat(vm_registers_t &r, vm_t &vm) |
| 547 | { | 546 | { |
| 548 | auto &fp = r.stack.peek_frame()->base<F_Sys_fwstat>(); | 547 | auto &fp = r.stack.peek_frame()->base<F_Sys_fwstat>(); |
| 549 | throw vm_system_exception{ "Instruction not implemented" }; | 548 | throw vm_system_exception{ "Function not implemented" }; |
| 550 | } | 549 | } |
| 551 | 550 | ||
| 552 | void | 551 | void |
| 553 | Sys_iounit(vm_registers_t &r, vm_t &vm) | 552 | Sys_iounit(vm_registers_t &r, vm_t &vm) |
| 554 | { | 553 | { |
| 555 | auto &fp = r.stack.peek_frame()->base<F_Sys_iounit>(); | 554 | auto &fp = r.stack.peek_frame()->base<F_Sys_iounit>(); |
| 556 | throw vm_system_exception{ "Instruction not implemented" }; | 555 | throw vm_system_exception{ "Function not implemented" }; |
| 557 | } | 556 | } |
| 558 | 557 | ||
| 559 | void | 558 | void |
| 560 | Sys_listen(vm_registers_t &r, vm_t &vm) | 559 | Sys_listen(vm_registers_t &r, vm_t &vm) |
| 561 | { | 560 | { |
| 562 | auto &fp = r.stack.peek_frame()->base<F_Sys_listen>(); | 561 | auto &fp = r.stack.peek_frame()->base<F_Sys_listen>(); |
| 563 | throw vm_system_exception{ "Instruction not implemented" }; | 562 | throw vm_system_exception{ "Function not implemented" }; |
| 564 | } | 563 | } |
| 565 | 564 | ||
| 566 | void | 565 | void |
| @@ -577,7 +576,7 @@ void · 10 unmodified lines | |||
| 577 | Sys_mount(vm_registers_t &r, vm_t &vm) | 576 | Sys_mount(vm_registers_t &r, vm_t &vm) |
| 578 | { | 577 | { |
| 579 | auto &fp = r.stack.peek_frame()->base<F_Sys_mount>(); | 578 | auto &fp = r.stack.peek_frame()->base<F_Sys_mount>(); |
| 580 | throw vm_system_exception{ "Instruction not implemented" }; | 579 | throw vm_system_exception{ "Function not implemented" }; |
| 581 | } | 580 | } |
| 582 | 581 | ||
| 583 | void | 582 | void |
| @@ -614,28 +613,27 @@ Sys_open(vm_registers_t &r, vm_t &vm) · 30 unmodified lines | |||
| 614 | } | 613 | } |
| 615 | 614 | ||
| 616 | *fp.ret = fd_alloc->get_allocation(); | 615 | *fp.ret = fd_alloc->get_allocation(); |
| 617 | fd_alloc->add_ref(); | ||
| 618 | } | 616 | } |
| 619 | 617 | ||
| 620 | void | 618 | void |
| 621 | Sys_pctl(vm_registers_t &r, vm_t &vm) | 619 | Sys_pctl(vm_registers_t &r, vm_t &vm) |
| 622 | { | 620 | { |
| 623 | auto &fp = r.stack.peek_frame()->base<F_Sys_pctl>(); | 621 | auto &fp = r.stack.peek_frame()->base<F_Sys_pctl>(); |
| 624 | throw vm_system_exception{ "Instruction not implemented" }; | 622 | throw vm_system_exception{ "Function not implemented" }; |
| 625 | } | 623 | } |
| 626 | 624 | ||
| 627 | void | 625 | void |
| 628 | Sys_pipe(vm_registers_t &r, vm_t &vm) | 626 | Sys_pipe(vm_registers_t &r, vm_t &vm) |
| 629 | { | 627 | { |
| 630 | auto &fp = r.stack.peek_frame()->base<F_Sys_pipe>(); | 628 | auto &fp = r.stack.peek_frame()->base<F_Sys_pipe>(); |
| 631 | throw vm_system_exception{ "Instruction not implemented" }; | 629 | throw vm_system_exception{ "Function not implemented" }; |
| 632 | } | 630 | } |
| 633 | 631 | ||
| 634 | void | 632 | void |
| 635 | Sys_pread(vm_registers_t &r, vm_t &vm) | 633 | Sys_pread(vm_registers_t &r, vm_t &vm) |
| 636 | { | 634 | { |
| 637 | auto &fp = r.stack.peek_frame()->base<F_Sys_pread>(); | 635 | auto &fp = r.stack.peek_frame()->base<F_Sys_pread>(); |
| 638 | throw vm_system_exception{ "Instruction not implemented" }; | 636 | throw vm_system_exception{ "Function not implemented" }; |
| 639 | } | 637 | } |
| 640 | 638 | ||
| 641 | void | 639 | void |
| @@ -654,7 +652,7 @@ void · 12 unmodified lines | |||
| 654 | Sys_pwrite(vm_registers_t &r, vm_t &vm) | 652 | Sys_pwrite(vm_registers_t &r, vm_t &vm) |
| 655 | { | 653 | { |
| 656 | auto &fp = r.stack.peek_frame()->base<F_Sys_pwrite>(); | 654 | auto &fp = r.stack.peek_frame()->base<F_Sys_pwrite>(); |
| 657 | throw vm_system_exception{ "Instruction not implemented" }; | 655 | throw vm_system_exception{ "Function not implemented" }; |
| 658 | } | 656 | } |
| 659 | 657 | ||
| 660 | void | 658 | void |
| @@ -691,7 +689,7 @@ void · 30 unmodified lines | |||
| 691 | Sys_readn(vm_registers_t &r, vm_t &vm) | 689 | Sys_readn(vm_registers_t &r, vm_t &vm) |
| 692 | { | 690 | { |
| 693 | auto &fp = r.stack.peek_frame()->base<F_Sys_readn>(); | 691 | auto &fp = r.stack.peek_frame()->base<F_Sys_readn>(); |
| 694 | throw vm_system_exception{ "Instruction not implemented" }; | 692 | throw vm_system_exception{ "Function not implemented" }; |
| 695 | } | 693 | } |
| 696 | 694 | ||
| 697 | void | 695 | void |
| @@ -760,7 +758,6 @@ Sys_sprint(vm_registers_t &r, vm_t &vm) · 62 unmodified lines | |||
| 760 | new_string = new vm_string_t{ static_cast<std::size_t>(written), reinterpret_cast<uint8_t *>(dynamic_buffer.data()) }; | 758 | new_string = new vm_string_t{ static_cast<std::size_t>(written), reinterpret_cast<uint8_t *>(dynamic_buffer.data()) }; |
| 761 | } | 759 | } |
| 762 | 760 | ||
| 763 | assert(new_string != nullptr); | ||
| 764 | *fp.ret = new_string->get_allocation(); | 761 | *fp.ret = new_string->get_allocation(); |
| 765 | } | 762 | } |
| 766 | 763 | ||
| @@ -768,14 +765,14 @@ void · 1 unmodified line | |||
| 768 | Sys_stat(vm_registers_t &r, vm_t &vm) | 765 | Sys_stat(vm_registers_t &r, vm_t &vm) |
| 769 | { | 766 | { |
| 770 | auto &fp = r.stack.peek_frame()->base<F_Sys_stat>(); | 767 | auto &fp = r.stack.peek_frame()->base<F_Sys_stat>(); |
| 771 | throw vm_system_exception{ "Instruction not implemented" }; | 768 | throw vm_system_exception{ "Function not implemented" }; |
| 772 | } | 769 | } |
| 773 | 770 | ||
| 774 | void | 771 | void |
| 775 | Sys_stream(vm_registers_t &r, vm_t &vm) | 772 | Sys_stream(vm_registers_t &r, vm_t &vm) |
| 776 | { | 773 | { |
| 777 | auto &fp = r.stack.peek_frame()->base<F_Sys_stream>(); | 774 | auto &fp = r.stack.peek_frame()->base<F_Sys_stream>(); |
| 778 | throw vm_system_exception{ "Instruction not implemented" }; | 775 | throw vm_system_exception{ "Function not implemented" }; |
| 779 | } | 776 | } |
| 780 | 777 | ||
| 781 | namespace | 778 | namespace |
| @@ -907,7 +904,7 @@ void · 125 unmodified lines | |||
| 907 | Sys_unmount(vm_registers_t &r, vm_t &vm) | 904 | Sys_unmount(vm_registers_t &r, vm_t &vm) |
| 908 | { | 905 | { |
| 909 | auto &fp = r.stack.peek_frame()->base<F_Sys_unmount>(); | 906 | auto &fp = r.stack.peek_frame()->base<F_Sys_unmount>(); |
| 910 | throw vm_system_exception{ "Instruction not implemented" }; | 907 | throw vm_system_exception{ "Function not implemented" }; |
| 911 | } | 908 | } |
| 912 | 909 | ||
| 913 | void | 910 | void |
| @@ -933,7 +930,14 @@ void · 19 unmodified lines | |||
| 933 | Sys_werrstr(vm_registers_t &r, vm_t &vm) | 930 | Sys_werrstr(vm_registers_t &r, vm_t &vm) |
| 934 | { | 931 | { |
| 935 | auto &fp = r.stack.peek_frame()->base<F_Sys_werrstr>(); | 932 | auto &fp = r.stack.peek_frame()->base<F_Sys_werrstr>(); |
| 936 | throw vm_system_exception{ "Instruction not implemented" }; | 933 | |
| 934 | auto new_err = ""; | ||
| 935 | auto s = vm_alloc_t::from_allocation<vm_string_t>(fp.s); | ||
| 936 | if (s != nullptr) | ||
| 937 | new_err = s->str(); | ||
| 938 | |||
| 939 | push_syscall_error_message(vm, new_err); | ||
| 940 | *fp.ret = 0; | ||
| 937 | } | 941 | } |
| 938 | 942 | ||
| 939 | void | 943 | void |
| @@ -972,5 +976,5 @@ void · 32 unmodified lines | |||
| 972 | Sys_wstat(vm_registers_t &r, vm_t &vm) | 976 | Sys_wstat(vm_registers_t &r, vm_t &vm) |
| 973 | { | 977 | { |
| 974 | auto &fp = r.stack.peek_frame()->base<F_Sys_wstat>(); | 978 | auto &fp = r.stack.peek_frame()->base<F_Sys_wstat>(); |
| 975 | throw vm_system_exception{ "Instruction not implemented" }; | 979 | throw vm_system_exception{ "Function not implemented" }; |
| 976 | } | 980 | } |