| 612 | */ |
| 613 | #define ROBUST_LIST_LIMIT 2048 |
| 614 | void KThread::exitRobustList() |
| 615 | { |
| 616 | BOXEDWINE_CRITICAL_SECTION; |
| 617 | |
| 618 | struct k_robust_list_head head; |
| 619 | struct k_robust_list_head entry; |
| 620 | struct k_robust_list_head next_entry; |
| 621 | struct k_robust_list_head pending; |
| 622 | unsigned int limit = ROBUST_LIST_LIMIT, pi, pip; |
| 623 | unsigned int next_pi; |
| 624 | U32 futex_offset = 0; |
| 625 | int rc; |
| 626 | |
| 627 | if (!this->robustList || !memory->canRead(this->robustList, 12)) { |
| 628 | return; |
| 629 | } |
| 630 | |
| 631 | memory->memcpy(&head, this->robustList, 12); |
| 632 | head.address = this->robustList; |
| 633 | |
| 634 | /* |
| 635 | * Fetch the list head (which was registered earlier, via |
| 636 | * sys_set_robust_list()): |
| 637 | */ |
| 638 | if (fetch_robust_entry(this, &entry, head.next, &pi)) { |
| 639 | return; |
| 640 | } |
| 641 | |
| 642 | /* |
| 643 | * Fetch the relative futex offset: |
| 644 | */ |
| 645 | //U32 futexOffset = head.futex_offset; |
| 646 | |
| 647 | /* |
| 648 | * Fetch any possibly pending lock-add first, and handle it |
| 649 | * if it exists: |
| 650 | */ |
| 651 | if (fetch_robust_entry(this, &pending, head.list_op_pending, &pip)) |
| 652 | return; |
| 653 | |
| 654 | next_entry.address = 0; /* avoid warning with gcc */ |
| 655 | while (entry.address != head.next) { |
| 656 | /* |
| 657 | * Fetch the next entry in the list before calling |
| 658 | * handle_futex_death: |
| 659 | */ |
| 660 | rc = fetch_robust_entry(this, &next_entry, entry.next, &next_pi); |
| 661 | /* |
| 662 | * A pending lock might already be on the list, so |
| 663 | * don't process it twice: |
| 664 | */ |
| 665 | if (entry.address != pending.address) { |
| 666 | if (handleFutexDeath(entry.address + futex_offset, pi, HANDLE_DEATH_LIST)) { |
| 667 | return; |
| 668 | } |
| 669 | } |
| 670 | if (rc) { |
| 671 | return; |
no test coverage detected