Commit 2644558
committed
Add task termination infrastructure for fault handling
Implement deferred cleanup mechanism to safely terminate tasks that
encounter unrecoverable faults. Tasks cannot immediately free their own
resources since they execute on the stack being freed.
The solution uses a two-phase approach: when termination is requested,
the task is marked as suspended with a special flag indicating pending
cleanup, then yields to another task. After the context switch completes
and we're executing in a different context, the scheduler detects the
marked task and safely frees its resources.
This infrastructure enables graceful handling of PMP violations and
other unrecoverable task faults without panicking the entire system.1 parent 0b17a78 commit 2644558
2 files changed
+95
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
86 | | - | |
| 89 | + | |
87 | 90 | | |
88 | 91 | | |
89 | 92 | | |
| |||
281 | 284 | | |
282 | 285 | | |
283 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
284 | 297 | | |
285 | 298 | | |
286 | 299 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
461 | 503 | | |
462 | 504 | | |
463 | 505 | | |
| |||
497 | 539 | | |
498 | 540 | | |
499 | 541 | | |
500 | | - | |
| 542 | + | |
| 543 | + | |
501 | 544 | | |
502 | 545 | | |
503 | 546 | | |
504 | 547 | | |
505 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
506 | 553 | | |
507 | 554 | | |
508 | 555 | | |
| |||
535 | 582 | | |
536 | 583 | | |
537 | 584 | | |
538 | | - | |
| 585 | + | |
| 586 | + | |
539 | 587 | | |
540 | 588 | | |
541 | 589 | | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
542 | 594 | | |
543 | 595 | | |
544 | 596 | | |
| |||
714 | 766 | | |
715 | 767 | | |
716 | 768 | | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
717 | 796 | | |
718 | 797 | | |
719 | 798 | | |
| |||
0 commit comments