wip multipage ipc send/recv

This commit is contained in:
2026-02-28 23:44:10 +01:00
parent 11c01ab7f6
commit 6668e412cc

View File

@@ -247,11 +247,13 @@ int receive(Vault& v, void* buffer, size_t size) {
if (ipc == nullptr) return -1;
size_t copy_len = (size < ipc->size) ? size:ipc->size;
// Buffer holen
size_t total_len = (Page::offset(ipc->ptr)+copy_len);
uint8_t num_pages = (total_len/4096)+1;
for(uint32_t i=0; i<(copy_len/4096)+1; i++){
for(uint32_t i=0; i<num_pages; i++){
uintptr_t offset = i==0?Page::offset(ipc->ptr):0; //apply offset only on first page
uintptr_t paddr = isMapped((ipc->ptr)+(i*4096), v.thread_list[ipc->pid]->paging_tree->l4);
if (!copy_from_phys(v, paddr, buffer, copy_len)) {
if (!copy_from_phys(v, paddr+offset, buffer, 4096-offset)) {
return -3;
}
}