send seems to work, the stress test has weird unmotivated lines originally
This commit is contained in:
@@ -224,13 +224,22 @@ bool send(Vault& v, int pid, const void* sbuffer, size_t ssize, void* rbuffer, s
|
||||
}
|
||||
DBG_VERBOSE << "" << endl;
|
||||
}
|
||||
uint8_t num_pages = (rsize/4096)+1;
|
||||
|
||||
// Kopiere Antwort
|
||||
if (!copy_from_phys(v, isMapped(msg.ptr, target_thread->paging_tree->l4), rbuffer, rsize)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
// Kopiere Antwort size kann mehr sein
|
||||
for(uint8_t i=0;i<num_pages;i++){
|
||||
uintptr_t paddr = isMapped(msg.ptr, target_thread->paging_tree->l4); //always page aligned
|
||||
if(rsize-i*4096>4096){ // ganze pages
|
||||
if (!copy_from_phys(v,paddr,(void*)((uintptr_t) rbuffer+ (4096*i)),4096)) {
|
||||
return false;
|
||||
}
|
||||
} else { //teil von pages
|
||||
if (!copy_from_phys(v,paddr,(void*)((uintptr_t)rbuffer+ 4096*i), rsize-i*4096)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int receive(Vault& v, void* buffer, size_t size) {
|
||||
@@ -254,9 +263,9 @@ int receive(Vault& v, void* buffer, size_t size) {
|
||||
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(total_len - (i*4096) > 4096)
|
||||
copy_from_phys(v, paddr+offset, buffer, 4096-offset);
|
||||
copy_from_phys(v, paddr+offset,(void*)((uintptr_t)buffer+i*4096), 4096-offset);
|
||||
else
|
||||
copy_from_phys(v, paddr, buffer, total_len - (i*4096)); //last page
|
||||
copy_from_phys(v, paddr, (void*)((uintptr_t)buffer+i*4096), total_len - (i*4096)); //last page
|
||||
}
|
||||
|
||||
return ipc->pid;
|
||||
@@ -282,7 +291,7 @@ bool reply(Vault& v, const void* buffer, size_t size) {
|
||||
ipc->is_answer = true;
|
||||
|
||||
// Sender aufwecken
|
||||
other_thread->ipc_sem.v(v);
|
||||
other_thread->ipc_sem.v(v);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -18,12 +18,13 @@ void main() {
|
||||
char msg[] = "REPLY: AA\n";
|
||||
msg[7] += rbuf[0] + sbuf[8193];
|
||||
msg[8] += 4 + ppid;
|
||||
write(0, msg, 10,0, ppid);
|
||||
write(0, msg, 10);
|
||||
} else { // parent
|
||||
int X = recv(rbuf, 8193);
|
||||
receive(rbuf, 8193);
|
||||
rbuf[0] = rbuf[0] + rbuf[8192];
|
||||
rbuf[8193] = 7;
|
||||
reply(rbuf, 8193);
|
||||
reply(X,rbuf, 8193);
|
||||
}
|
||||
|
||||
sys_exit();
|
||||
|
||||
Reference in New Issue
Block a user