Make a copy of a Rendezvous Takes handle as first argument (syscall RDI) Returns new handle in RDI
(context_ptr: *mut Context, handle: u64)
| 545 | /// Takes handle as first argument (syscall RDI) |
| 546 | /// Returns new handle in RDI |
| 547 | fn sys_copy_rendezvous(context_ptr: *mut Context, handle: u64) { |
| 548 | let context = unsafe {&mut (*context_ptr)}; |
| 549 | |
| 550 | if let Some(mut thread) = process::take_current_thread() { |
| 551 | thread.set_context(context_ptr); |
| 552 | |
| 553 | // Thread::rendezvous() returns a clone |
| 554 | if let Some(rdv) = thread.rendezvous(handle) { |
| 555 | let new_handle = thread.give_rendezvous(rdv); |
| 556 | // Return |
| 557 | context.rax = 0; // Success! |
| 558 | context.rdi = new_handle; |
| 559 | } else { |
| 560 | // Missing handle |
| 561 | thread.return_error(SYSCALL_ERROR_INVALID_HANDLE); |
| 562 | } |
| 563 | process::set_current_thread(thread); |
| 564 | } |
| 565 | } |
| 566 | |
| 567 | /// Create a new process |
| 568 | /// |
no test coverage detected