mirror of
https://github.com/drasko/codezero.git
synced 2026-01-13 19:33:15 +01:00
Full IPC working.
- Test0 has a full ipc mr read/write test. - A full ipc occurs for definite only if both parties use the FULL IPC flag. Otherwise the thread that makes the ipc copy rules on whether it was a short or a full copy.
This commit is contained in:
@@ -153,7 +153,6 @@ static inline int l4_sendrecv_full(l4id_t to, l4id_t from, unsigned int tag)
|
||||
BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
|
||||
l4_set_tag(tag);
|
||||
|
||||
printf("%s: to %d from %d tag %u\n", __FUNCTION__, to, from, tag);
|
||||
err = l4_ipc(to, from, L4_IPC_FLAGS_FULL);
|
||||
|
||||
return err;
|
||||
@@ -256,7 +255,6 @@ static inline void l4_print_mrs()
|
||||
*/
|
||||
static inline int l4_ipc_return(int retval)
|
||||
{
|
||||
// unsigned int tag = l4_get_tag();
|
||||
l4id_t sender = l4_get_sender();
|
||||
|
||||
l4_set_retval(retval);
|
||||
|
||||
@@ -63,7 +63,7 @@ static inline void write_mr(unsigned int offset, unsigned int val)
|
||||
if (offset < MR_TOTAL)
|
||||
l4_get_utcb()->mr[offset] = val;
|
||||
else
|
||||
l4_get_utcb()->mr[offset - MR_TOTAL] = val;
|
||||
l4_get_utcb()->mr_rest[offset - MR_TOTAL] = val;
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
@@ -25,15 +25,18 @@
|
||||
#include <boot.h>
|
||||
|
||||
|
||||
|
||||
int ipc_test_full_sync(void)
|
||||
/* Receives all registers and replies back */
|
||||
int ipc_test_full_sync(l4id_t senderid)
|
||||
{
|
||||
for (int i = 0; i < MR_TOTAL + MR_REST; i++) {
|
||||
printf("%s/%s: MR%d: %d\n", __TASKNAME__, __FUNCTION__,
|
||||
i, read_mr(i));
|
||||
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
|
||||
// printf("%s/%s: MR%d: %d\n", __TASKNAME__, __FUNCTION__,
|
||||
// i, read_mr(i));
|
||||
/* Reset it to 0 */
|
||||
write_mr(i, 0);
|
||||
}
|
||||
|
||||
/* Send a full reply */
|
||||
l4_send_full(senderid, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -68,8 +71,8 @@ void handle_requests(void)
|
||||
|
||||
switch(tag) {
|
||||
case L4_IPC_TAG_SYNC_FULL:
|
||||
ret = ipc_test_full_sync();
|
||||
break;
|
||||
ret = ipc_test_full_sync(senderid);
|
||||
return;
|
||||
case L4_IPC_TAG_SYNC:
|
||||
mm0_test_global_vm_integrity();
|
||||
// printf("%s: Synced with waiting thread.\n", __TASKNAME__);
|
||||
|
||||
@@ -33,11 +33,9 @@ void main(void)
|
||||
|
||||
wait_pager(0);
|
||||
|
||||
printf("%s: Full IPC test.\n", __TASKNAME__);
|
||||
|
||||
ipc_full_test();
|
||||
|
||||
printf("%s: Running POSIX API tests.\n", __TASKNAME__);
|
||||
printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
|
||||
|
||||
dirtest();
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
*/
|
||||
void ipc_full_test(void)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
/* 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);
|
||||
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
|
||||
//printf("Writing: MR%d: %d\n", i, i);
|
||||
write_mr(i, i);
|
||||
}
|
||||
|
||||
@@ -21,13 +21,16 @@ void ipc_full_test(void)
|
||||
}
|
||||
/* 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));
|
||||
//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)
|
||||
;
|
||||
|
||||
if (!ret)
|
||||
printf("FULL IPC TEST: -- PASSED --\n");
|
||||
else
|
||||
printf("FULL IPC TEST: -- FAILED --\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user