Subversion Repositories HelenOS

Rev

Rev 2805 | Rev 2807 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

#include <stdio.h>
#include <unistd.h>
#include <ipc/ipc.h>
#include "../tester.h"

const char *syscall_name[] = {
    "sys_io",
    "sys_tls_set",
    "sys_thread_create",
    "sys_thread_exit",
    "sys_thread_get_id",
    "sys_task_get_id",
    "sys_futex_sleep_timeout",
    "sys_futex_wakeup",
    "sys_as_area_create",
    "sys_as_area_resize",
    "sys_as_area_destroy",
    "sys_ipc_call_sync_fast",
    "sys_ipc_call_sync_slow",
    "sys_ipc_call_async_fast",
    "sys_ipc_call_async_slow",
    "sys_ipc_answer_fast",
    "sys_ipc_answer_slow",
    "sys_ipc_forward_fast",
    "sys_ipc_wait_for_call",
    "sys_ipc_hangup",
    "sys_ipc_register_irq",
    "sys_ipc_unregister_irq",
    "sys_cap_grant",
    "sys_cap_revoke",
    "sys_physmem_map",
    "sys_iospace_enable",
    "sys_preempt_control",
    "sys_sysinfo_valid",
    "sys_sysinfo_value",
    "sys_debug_enable_console",
    "sys_ipc_connect_task"
};

char * test_debug1(bool quiet)
{
    int taskid;
    int rc;
    int phoneid;
    int i;
    unsigned sc_args[6];
    unsigned copied;
    unsigned ev_type;
    unsigned sc_id;
    int sc_rc;

    printf("running debug1 test\n");
    taskid = 12;
    printf("ipc_connect_task(%d)...\n", taskid);
    rc = ipc_connect_task(taskid);
    printf("-> %d\n", rc);
    phoneid = rc;

    printf("send IPC_M_DEBUG_BEGIN message\n");
    rc = ipc_call_sync_0_0(phoneid, IPC_M_DEBUG_BEGIN);
    printf("-> %d\n", rc);

    while (1) {
        rc = ipc_call_sync_0_3(phoneid, IPC_M_DEBUG_GO, &ev_type,
            &sc_id, &sc_rc);
        rc = ipc_call_sync_3_1(phoneid, IPC_M_DEBUG_ARGS_READ, NULL,
            sc_args, 6 * sizeof(unsigned), &copied);
        if (rc >= 0) {
            printf("%s[%d](%u, %u, %u, %u, %u, %u) -> %d\n",
                syscall_name[sc_id], sc_id,
                sc_args[0], sc_args[1], sc_args[2],
                sc_args[3], sc_args[4], sc_args[5],
                sc_rc);
        }
    }

    printf("done\n");
    return NULL;
}