mirror of
https://github.com/drasko/codezero.git
synced 2026-01-21 23:33:15 +01:00
Extended IPC Support added.
Benefits & Facts: - Messages up to 2 kilobytes may be sent. - Both parties may use non-disjoint user buffers. E.g. any userspace address. - Userspace buffers can page fault. - Page faults punish timeslice of only the faulting thread. - Any number of extended ipcs can take place at any one time, since only ktcbs of ipc parties are engaged. No global buffer is used. - This also provides smp-safety benefit. Disadvantages: - There is triple copying penalty. This has to be done: - Sender buffer to sender ktcb - Sender ktcb to receiver ktcb - Receiver ktcb to receiver buffer. This is due to the fact that buffers can be on non-disjoint userspace addresses. If you want to avoid disadvantages and lose some of the benefits, (e.g. address freedom, shorter copy size) use FULL IPC.
This commit is contained in:
@@ -89,7 +89,8 @@ void ipc_extended_test(void)
|
||||
*/
|
||||
ipcbuf = base + PAGE_SIZE - L4_IPC_EXTENDED_MAX_SIZE / 2;
|
||||
|
||||
if (!child) {
|
||||
/* Child sending message */
|
||||
if (child == 0) {
|
||||
/* Child creates a string of maximum extended ipc size */
|
||||
for (int i = 0; i < L4_IPC_EXTENDED_MAX_SIZE; i++) {
|
||||
ipcbuf[i] = 'A' + i % 20;
|
||||
@@ -107,6 +108,7 @@ void ipc_extended_test(void)
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
/* Parent receiving message */
|
||||
} else {
|
||||
/*
|
||||
* Parent receives on the buffer - we are sure that the
|
||||
@@ -125,11 +127,16 @@ void ipc_extended_test(void)
|
||||
printf("(%d): Message received from child: %s\n",
|
||||
getpid(), ipcbuf);
|
||||
|
||||
/* Check that child string is there */
|
||||
for (int i = 0; i < L4_IPC_EXTENDED_MAX_SIZE; i++) {
|
||||
/* Check that string received from child is an exact match */
|
||||
for (int i = 0; i < L4_IPC_EXTENDED_MAX_SIZE - 2; i++) {
|
||||
if (ipcbuf[i] != ('A' + i % 20))
|
||||
goto out_err;
|
||||
}
|
||||
if (ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 2] != '\n')
|
||||
goto out_err;
|
||||
if (ipcbuf[L4_IPC_EXTENDED_MAX_SIZE - 1] != '\0')
|
||||
goto out_err;
|
||||
|
||||
printf("EXTENDED IPC TEST: -- PASSED --\n");
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user