mirror of
https://github.com/drasko/codezero.git
synced 2026-01-26 01:33:21 +01:00
Modifications towards full ipc
- Added a full ipc send/recv test - Removed non-zero value checking in r2 for ipc that was there to catch inadvertent full ipc calls. - Added correct hanlding for read/write mrs for current status of utcb. TODO: - Add mapping of every utcb to every task for privileged access so that the kernel can access every utcb without switching spaces. - Removal of same mappings - Upon thread creation need to copy page tables accordingly i.e. each task will have its own utcb mapped with USER access, but every other utcb as kernel access only. Need to handle this case upon page table copying.
This commit is contained in:
33
tasks/test0/src/ipctest.c
Normal file
33
tasks/test0/src/ipctest.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <l4lib/arch/syslib.h>
|
||||
#include <l4lib/ipcdefs.h>
|
||||
|
||||
/*
|
||||
* Full ipc test. Sends/receives full utcb, done with the pager.
|
||||
*/
|
||||
void ipc_full_test(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Fill in all of the utcb locations */
|
||||
for (int i = 0; i < MR_TOTAL + MR_REST; i++) {
|
||||
printf("Writing: MR%d: %d\n", i, i);
|
||||
write_mr(i, i);
|
||||
}
|
||||
|
||||
/* Call the pager */
|
||||
if ((ret = l4_sendrecv_full(PAGER_TID, PAGER_TID, L4_IPC_TAG_SYNC_FULL)) < 0) {
|
||||
printf("%s: Failed with %d\n", __FUNCTION__, ret);
|
||||
BUG();
|
||||
}
|
||||
/* Read back updated utcb */
|
||||
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
|
||||
printf("Read MR%d: %d\n", i, read_mr(i));
|
||||
if (read_mr(i) != 0) {
|
||||
printf("Expected 0 on all mrs. Failed.\n");
|
||||
BUG();
|
||||
}
|
||||
}
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user