//////////////////////// \brief SysEndpointCall (endpoint, id, data, rID, rData, size, timeout) Accept a pending connection on an interface and return a new MessageEndpoint \param endpoint (handle_id_t) Handle ID of specified endpoint \param id (uint64_t) id of message to send \param data (uint8_t*/uint64_t) Message data to be sent, if size <= 8 then treated as an integer containing message data
| 2472 | /// \return 0 on success, negative error code on failure |
| 2473 | ///////////////////////////// |
| 2474 | long SysEndpointCall(regs64_t* r){ |
| 2475 | process_t* currentProcess = Scheduler::GetCurrentProcess(); |
| 2476 | |
| 2477 | Handle* endpHandle; |
| 2478 | if(Scheduler::FindHandle(currentProcess, SC_ARG0(r), &endpHandle)){ |
| 2479 | Log::Warning("SysEndpointCall: Invalid handle ID %d", SC_ARG0(r)); |
| 2480 | return -EINVAL; |
| 2481 | } |
| 2482 | |
| 2483 | if(!endpHandle->ko->IsType(MessageEndpoint::TypeID())){ |
| 2484 | Log::Warning("SysEndpointCall: Invalid handle type (ID %d)", SC_ARG0(r)); |
| 2485 | return -EINVAL; |
| 2486 | } |
| 2487 | |
| 2488 | uint16_t* size = reinterpret_cast<uint16_t*>(SC_ARG5(r)); |
| 2489 | if((*size) > 8 && !Memory::CheckUsermodePointer(SC_ARG3(r), *size, currentProcess->addressSpace)){ |
| 2490 | return -EFAULT; // Data greater than 8 and invalid pointer |
| 2491 | } |
| 2492 | |
| 2493 | MessageEndpoint* endpoint = reinterpret_cast<MessageEndpoint*>(endpHandle->ko.get()); |
| 2494 | |
| 2495 | return endpoint->Call(SC_ARG1(r), *size, SC_ARG2(r), SC_ARG3(r), size, reinterpret_cast<uint64_t*>(SC_ARG4(r)), -1); |
| 2496 | } |
| 2497 | |
| 2498 | ///////////////////////////// |
| 2499 | /// \brief SysEndpointInfo (endpoint, info) |
nothing calls this directly
no test coverage detected