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:
Bahadir Balban
2009-05-19 15:39:01 +03:00
parent 3bbbcdfefa
commit cc96e2c86c
7 changed files with 30 additions and 22 deletions

View File

@@ -351,11 +351,12 @@ int sys_ipc(syscall_context_t *regs)
unsigned int ipc_type = 0;
int ret = 0;
#if 0
if (regs->r2)
__asm__ __volatile__ (
"1:\n"
"b 1b\n");
#endif
/* Check arguments */
if (from < L4_ANYTHREAD) {
ret = -EINVAL;
@@ -391,7 +392,12 @@ int sys_ipc(syscall_context_t *regs)
return ret;
error:
// printk("Erroneous ipc by: %d. Err: %d\n", current->tid, ret);
/*
* This is not always an error. For example a send/recv
* thread may go to suspension before receive phase.
*/
//printk("Erroneous ipc by: %d. from: %d, to: %d, Err: %d\n",
// current->tid, from, to, ret);
ipc_type = IPC_INVALID;
return ret;
}

View File

@@ -18,7 +18,7 @@
#include INC_SUBARCH(mm.h)
/* Abort debugging conditions */
#define DEBUG_ABORTS
// #define DEBUG_ABORTS
#if defined (DEBUG_ABORTS)
#define dbg_abort(...) dprintk(__VA_ARGS__)
#else

View File

@@ -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);

View File

@@ -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__ */

View File

@@ -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__);

View File

@@ -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();

View File

@@ -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");
}