rewrite ipc to use vaddress instead of paddr

This commit is contained in:
2026-02-28 23:15:41 +01:00
parent 770e77769a
commit 11c01ab7f6
3 changed files with 46 additions and 41 deletions

View File

@@ -6,25 +6,25 @@ char sbuf[8194], rbuf[8194]; // (2 * 4KiB) + 2
void main() {
fork();
fork();
int other = fork();
int ppid = sys_getpid();
write(1, "app", 3, 0, ppid);
int other = fork();
if (ppid == other) { // child
sbuf[0] = 3;
sbuf[8192] = sys_getpid();
sbuf[8193] = 1;
send(other, sbuf, 8193, rbuf, 8193);
//if (ppid == other) { // child
// sbuf[0] = 3;
// sbuf[8192] = sys_getpid();
// sbuf[8193] = 1;
// send(other, sbuf, 8193, rbuf, 8193);
char msg[] = "REPLY: AA\n";
msg[7] += rbuf[0] + sbuf[8193];
msg[8] += 4 + ppid;
write(0, msg, 10);
} else { // parent
receive(rbuf, 8193);
rbuf[0] = rbuf[0] + rbuf[8192];
rbuf[8193] = 7;
reply(rbuf, 8193);
}
// char msg[] = "REPLY: AA\n";
// msg[7] += rbuf[0] + sbuf[8193];
// msg[8] += 4 + ppid;
// write(0, msg, 10);
//} else { // parent
// receive(rbuf, 8193);
// rbuf[0] = rbuf[0] + rbuf[8192];
// rbuf[8193] = 7;
// reply(rbuf, 8193);
//}
sys_exit();
}