* SysUnmapSharedMemory (address, key) - Map Shared Memory * address - address of mapped memory * key - Memory key * * On Success - return 0 * On Failure - return -1 */
| 1107 | * On Failure - return -1 |
| 1108 | */ |
| 1109 | long SysUnmapSharedMemory(regs64_t* r){ |
| 1110 | uint64_t address = SC_ARG0(r); |
| 1111 | int64_t key = SC_ARG1(r); |
| 1112 | |
| 1113 | shared_mem_t* sMem = Memory::GetSharedMemory(key); |
| 1114 | if(!sMem) return -1; |
| 1115 | |
| 1116 | if(!Memory::CheckRegion(address, sMem->pgCount * PAGE_SIZE_4K, Scheduler::GetCurrentProcess()->addressSpace)) // Make sure the process is not screwing with kernel memory |
| 1117 | return -1; |
| 1118 | |
| 1119 | Memory::Free4KPages((void*)address, sMem->pgCount, Scheduler::GetCurrentProcess()->addressSpace); |
| 1120 | |
| 1121 | sMem->mapCount--; |
| 1122 | |
| 1123 | Memory::DestroySharedMemory(key); // Active shared memory will not be destroyed and this will return |
| 1124 | |
| 1125 | return 0; |
| 1126 | } |
| 1127 | |
| 1128 | /* |
| 1129 | * SysDestroySharedMemory (key) - Destroy Shared Memory |
nothing calls this directly
no test coverage detected