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; unsigned int ipc_type = 0;
int ret = 0; int ret = 0;
#if 0
if (regs->r2) if (regs->r2)
__asm__ __volatile__ ( __asm__ __volatile__ (
"1:\n" "1:\n"
"b 1b\n"); "b 1b\n");
#endif
/* Check arguments */ /* Check arguments */
if (from < L4_ANYTHREAD) { if (from < L4_ANYTHREAD) {
ret = -EINVAL; ret = -EINVAL;
@@ -391,7 +392,12 @@ int sys_ipc(syscall_context_t *regs)
return ret; return ret;
error: 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; ipc_type = IPC_INVALID;
return ret; return ret;
} }

View File

@@ -18,7 +18,7 @@
#include INC_SUBARCH(mm.h) #include INC_SUBARCH(mm.h)
/* Abort debugging conditions */ /* Abort debugging conditions */
#define DEBUG_ABORTS // #define DEBUG_ABORTS
#if defined (DEBUG_ABORTS) #if defined (DEBUG_ABORTS)
#define dbg_abort(...) dprintk(__VA_ARGS__) #define dbg_abort(...) dprintk(__VA_ARGS__)
#else #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); BUG_ON(to == L4_NILTHREAD || from == L4_NILTHREAD);
l4_set_tag(tag); 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); err = l4_ipc(to, from, L4_IPC_FLAGS_FULL);
return err; return err;
@@ -256,7 +255,6 @@ static inline void l4_print_mrs()
*/ */
static inline int l4_ipc_return(int retval) static inline int l4_ipc_return(int retval)
{ {
// unsigned int tag = l4_get_tag();
l4id_t sender = l4_get_sender(); l4id_t sender = l4_get_sender();
l4_set_retval(retval); 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) if (offset < MR_TOTAL)
l4_get_utcb()->mr[offset] = val; l4_get_utcb()->mr[offset] = val;
else else
l4_get_utcb()->mr[offset - MR_TOTAL] = val; l4_get_utcb()->mr_rest[offset - MR_TOTAL] = val;
} }
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */

View File

@@ -25,15 +25,18 @@
#include <boot.h> #include <boot.h>
/* Receives all registers and replies back */
int ipc_test_full_sync(void) int ipc_test_full_sync(l4id_t senderid)
{ {
for (int i = 0; i < MR_TOTAL + MR_REST; i++) { for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
printf("%s/%s: MR%d: %d\n", __TASKNAME__, __FUNCTION__, // printf("%s/%s: MR%d: %d\n", __TASKNAME__, __FUNCTION__,
i, read_mr(i)); // i, read_mr(i));
/* Reset it to 0 */ /* Reset it to 0 */
write_mr(i, 0); write_mr(i, 0);
} }
/* Send a full reply */
l4_send_full(senderid, 0);
return 0; return 0;
} }
@@ -68,8 +71,8 @@ void handle_requests(void)
switch(tag) { switch(tag) {
case L4_IPC_TAG_SYNC_FULL: case L4_IPC_TAG_SYNC_FULL:
ret = ipc_test_full_sync(); ret = ipc_test_full_sync(senderid);
break; return;
case L4_IPC_TAG_SYNC: case L4_IPC_TAG_SYNC:
mm0_test_global_vm_integrity(); mm0_test_global_vm_integrity();
// printf("%s: Synced with waiting thread.\n", __TASKNAME__); // printf("%s: Synced with waiting thread.\n", __TASKNAME__);

View File

@@ -33,11 +33,9 @@ void main(void)
wait_pager(0); wait_pager(0);
printf("%s: Full IPC test.\n", __TASKNAME__);
ipc_full_test(); ipc_full_test();
printf("%s: Running POSIX API tests.\n", __TASKNAME__); printf("\n%s: Running POSIX API tests.\n", __TASKNAME__);
dirtest(); dirtest();

View File

@@ -6,11 +6,11 @@
*/ */
void ipc_full_test(void) void ipc_full_test(void)
{ {
int ret; int ret = 0;
/* Fill in all of the utcb locations */ /* Fill in all of the utcb locations */
for (int i = 0; i < MR_TOTAL + MR_REST; i++) { for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) {
printf("Writing: MR%d: %d\n", i, i); //printf("Writing: MR%d: %d\n", i, i);
write_mr(i, i); write_mr(i, i);
} }
@@ -21,13 +21,16 @@ void ipc_full_test(void)
} }
/* Read back updated utcb */ /* Read back updated utcb */
for (int i = MR_UNUSED_START; i < MR_TOTAL + MR_REST; i++) { 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) { if (read_mr(i) != 0) {
printf("Expected 0 on all mrs. Failed.\n"); printf("Expected 0 on all mrs. Failed.\n");
BUG(); BUG();
} }
} }
while (1)
; if (!ret)
printf("FULL IPC TEST: -- PASSED --\n");
else
printf("FULL IPC TEST: -- FAILED --\n");
} }