Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3473 → Rev 3474

/branches/dynload/uspace/app/dltest/dltest.c
46,6 → 46,7
// : "d" (i) /* input */
// : "%eax","%ecx" /* all scratch registers clobbered */
// );
/*
asm volatile (
"mr %%r3, %0\n"
"li %%r9, 32\n"
54,6 → 55,7
: "r" (i)
: "%r3","%r9"
);
*/
}
 
void __tls_get_addr(void)
/branches/dynload/uspace/app/bdsh/util.c
273,7 → 273,7
if (NULL == usr->cwd)
snprintf(usr->cwd, PATH_MAX, "(unknown)");
 
if (1 < cli_psprintf(&usr->prompt, "%s ", usr->cwd)) {
if (1 < cli_psprintf(&usr->prompt, "%s # ", usr->cwd)) {
cli_error(cli_errno, "Failed to set prompt");
return 1;
}
/branches/dynload/uspace/app/bdsh/exec.c
46,13 → 46,13
#include "errors.h"
 
/* FIXME: Just have find_command() return an allocated string */
char *found;
static char *found;
 
static char *find_command(char *);
static unsigned int try_access(const char *);
static int try_access(const char *);
 
/* work-around for access() */
static unsigned int try_access(const char *f)
static int try_access(const char *f)
{
int fd;
 
/branches/dynload/uspace/app/trace/trace.c
42,6 → 42,7
#include <udebug.h>
#include <async.h>
#include <task.h>
#include <loader/loader.h>
 
// Temporary: service and method names
#include "proto.h"
55,8 → 56,8
#include "trace.h"
 
#define THBUF_SIZE 64
unsigned thread_hash_buf[THBUF_SIZE];
unsigned n_threads;
uintptr_t thread_hash_buf[THBUF_SIZE];
int n_threads;
 
int next_thread_id;
 
63,21 → 64,59
int phoneid;
int abort_trace;
 
unsigned thash;
uintptr_t thash;
volatile int paused;
 
void thread_trace_start(unsigned thread_hash);
void thread_trace_start(uintptr_t thread_hash);
 
static proto_t *proto_console;
static task_id_t task_id;
static loader_t *task_ldr;
 
/** Combination of events/data to print. */
display_mask_t display_mask;
 
static int task_connect(task_id_t task_id)
static int program_run_fibril(void *arg);
 
static void program_run(void)
{
fid_t fid;
 
fid = fibril_create(program_run_fibril, NULL);
if (fid == 0) {
printf("Error creating fibril\n");
exit(1);
}
 
fibril_add_ready(fid);
}
 
static int program_run_fibril(void *arg)
{
int rc;
 
/*
* This must be done in background as it will block until
* we let the task reply to this call.
*/
rc = loader_run(task_ldr);
if (rc != 0) {
printf("Error running program\n");
exit(1);
}
 
free(task_ldr);
task_ldr = NULL;
 
printf("program_run_fibril exiting\n");
return 0;
}
 
 
static int connect_task(task_id_t task_id)
{
int rc;
 
rc = ipc_connect_kbox(task_id);
 
if (rc == ENOTSUP) {
125,60 → 164,94
return rc;
}
 
n_threads = tb_copied / sizeof(unsigned);
n_threads = tb_copied / sizeof(uintptr_t);
 
printf("Threads:");
for (i = 0; i < n_threads; i++) {
printf(" [%d] (hash 0x%x)", 1+i, thread_hash_buf[i]);
printf(" [%d] (hash 0x%lx)", 1+i, thread_hash_buf[i]);
}
printf("\ntotal of %u threads\n", tb_needed/sizeof(unsigned));
printf("\ntotal of %u threads\n", tb_needed / sizeof(uintptr_t));
 
return 0;
}
 
static void print_sc_retval(int retval, rv_type_t rv_type)
void val_print(sysarg_t val, val_type_t v_type)
{
printf (" -> ");
if (rv_type == RV_INTEGER) {
printf("%d", retval);
} else if (rv_type == RV_HASH) {
printf("0x%08x", retval);
} else if (rv_type == RV_ERRNO) {
if (retval >= -15 && retval <= 0) {
printf("%d %s (%s)", retval,
err_desc[retval].name,
err_desc[retval].desc);
switch (v_type) {
case V_VOID:
printf("<void>");
break;
 
case V_INTEGER:
printf("%ld", val);
break;
 
case V_HASH:
case V_PTR:
printf("0x%08lx", val);
break;
 
case V_ERRNO:
if (val >= -15 && val <= 0) {
printf("%ld %s (%s)", val,
err_desc[-val].name,
err_desc[-val].desc);
} else {
printf("%d", retval);
printf("%ld", val);
}
} else if (rv_type == RV_INT_ERRNO) {
if (retval >= -15 && retval < 0) {
printf("%d %s (%s)", retval,
err_desc[retval].name,
err_desc[retval].desc);
break;
case V_INT_ERRNO:
if (val >= -15 && val < 0) {
printf("%ld %s (%s)", val,
err_desc[-val].name,
err_desc[-val].desc);
} else {
printf("%d", retval);
printf("%ld", val);
}
break;
 
case V_CHAR:
if (val >= 0x20 && val < 0x7f) {
printf("'%c'", val);
} else {
switch (val) {
case '\a': printf("'\\a'"); break;
case '\b': printf("'\\b'"); break;
case '\n': printf("'\\n'"); break;
case '\r': printf("'\\r'"); break;
case '\t': printf("'\\t'"); break;
case '\\': printf("'\\\\'"); break;
default: printf("'\\x%02lX'", val); break;
}
}
break;
}
}
 
 
static void print_sc_retval(sysarg_t retval, val_type_t val_type)
{
printf(" -> ");
val_print(retval, val_type);
putchar('\n');
}
 
static void print_sc_args(unsigned *sc_args, int n)
static void print_sc_args(sysarg_t *sc_args, int n)
{
int i;
 
putchar('(');
if (n > 0) printf("%d", sc_args[0]);
for (i=1; i<n; i++) {
printf(", %d", sc_args[i]);
if (n > 0) printf("%ld", sc_args[0]);
for (i = 1; i < n; i++) {
printf(", %ld", sc_args[i]);
}
putchar(')');
}
 
static void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc)
static void sc_ipc_call_async_fast(sysarg_t *sc_args, sysarg_t sc_rc)
{
ipc_call_t call;
int phoneid;
ipcarg_t phoneid;
if (sc_rc == IPC_CALLRET_FATAL || sc_rc == IPC_CALLRET_TEMPORARY)
return;
195,7 → 268,7
ipcp_call_out(phoneid, &call, sc_rc);
}
 
static void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc)
static void sc_ipc_call_async_slow(sysarg_t *sc_args, sysarg_t sc_rc)
{
ipc_call_t call;
int rc;
211,7 → 284,7
}
}
 
static void sc_ipc_call_sync_fast(unsigned *sc_args)
static void sc_ipc_call_sync_fast(sysarg_t *sc_args)
{
ipc_call_t question, reply;
int rc;
239,7 → 312,7
ipcp_call_sync(phoneidx, &question, &reply);
}
 
static void sc_ipc_call_sync_slow(unsigned *sc_args)
static void sc_ipc_call_sync_slow(sysarg_t *sc_args)
{
ipc_call_t question, reply;
int rc;
257,7 → 330,7
ipcp_call_sync(sc_args[0], &question, &reply);
}
 
static void sc_ipc_wait(unsigned *sc_args, int sc_rc)
static void sc_ipc_wait(sysarg_t *sc_args, int sc_rc)
{
ipc_call_t call;
int rc;
274,9 → 347,10
}
}
 
static void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
static void event_syscall_b(unsigned thread_id, uintptr_t thread_hash,
unsigned sc_id, sysarg_t sc_rc)
{
unsigned sc_args[6];
sysarg_t sc_args[6];
int rc;
 
/* Read syscall arguments */
301,9 → 375,10
async_serialize_end();
}
 
static void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc)
static void event_syscall_e(unsigned thread_id, uintptr_t thread_hash,
unsigned sc_id, sysarg_t sc_rc)
{
unsigned sc_args[6];
sysarg_t sc_args[6];
int rv_type;
int rc;
 
349,10 → 424,10
async_serialize_end();
}
 
static void event_thread_b(unsigned hash)
static void event_thread_b(uintptr_t hash)
{
async_serialize_start();
printf("New thread, hash 0x%x\n", hash);
printf("New thread, hash 0x%lx\n", hash);
async_serialize_end();
 
thread_trace_start(hash);
362,14 → 437,14
{
int rc;
unsigned ev_type;
unsigned thread_hash;
uintptr_t thread_hash;
unsigned thread_id;
unsigned val0, val1;
sysarg_t val0, val1;
 
thread_hash = (unsigned)thread_hash_arg;
thread_hash = (uintptr_t)thread_hash_arg;
thread_id = next_thread_id++;
 
printf("Start tracing thread [%d] (hash 0x%x)\n", thread_id, thread_hash);
printf("Start tracing thread [%d] (hash 0x%lx)\n", thread_id, thread_hash);
 
while (!abort_trace) {
 
405,7 → 480,7
event_thread_b(val0);
break;
case UDEBUG_EVENT_THREAD_E:
printf("Thread 0x%x exited\n", val0);
printf("Thread 0x%lx exited\n", val0);
abort_trace = 1;
break;
default:
420,7 → 495,7
return 0;
}
 
void thread_trace_start(unsigned thread_hash)
void thread_trace_start(uintptr_t thread_hash)
{
fid_t fid;
 
433,20 → 508,53
fibril_add_ready(fid);
}
 
static void trace_active_task(task_id_t task_id)
static loader_t *preload_task(const char *path, char *const argv[],
task_id_t *task_id)
{
loader_t *ldr;
int rc;
 
/* Spawn a program loader */
ldr = loader_spawn();
if (ldr == NULL)
return 0;
 
/* Get task ID. */
rc = loader_get_task_id(ldr, task_id);
if (rc != EOK)
goto error;
 
/* Send program pathname */
rc = loader_set_pathname(ldr, path);
if (rc != EOK)
goto error;
 
/* Send arguments */
rc = loader_set_args(ldr, argv);
if (rc != EOK)
goto error;
 
/* Load the program. */
rc = loader_load_program(ldr);
if (rc != EOK)
goto error;
 
/* Success */
return ldr;
 
/* Error exit */
error:
loader_abort(ldr);
free(ldr);
return NULL;
}
 
static void trace_task(task_id_t task_id)
{
int i;
int rc;
int c;
 
rc = task_connect(task_id);
if (rc < 0) {
printf("Failed to connect to task %lld\n", task_id);
return;
}
 
printf("Connected to task %lld\n", task_id);
 
ipcp_init();
 
/*
496,6 → 604,22
proto_t *p;
oper_t *o;
 
val_type_t arg_def[OPER_MAX_ARGS] = {
V_INTEGER,
V_INTEGER,
V_INTEGER,
V_INTEGER,
V_INTEGER
};
 
val_type_t resp_def[OPER_MAX_ARGS] = {
V_INTEGER,
V_INTEGER,
V_INTEGER,
V_INTEGER,
V_INTEGER
};
 
next_thread_id = 1;
paused = 0;
 
502,38 → 626,45
proto_init();
 
p = proto_new("vfs");
o = oper_new("read");
o = oper_new("read", 1, arg_def, V_ERRNO, 1, resp_def);
proto_add_oper(p, VFS_READ, o);
o = oper_new("write");
o = oper_new("write", 1, arg_def, V_ERRNO, 1, resp_def);
proto_add_oper(p, VFS_WRITE, o);
o = oper_new("truncate");
o = oper_new("truncate", 5, arg_def, V_ERRNO, 0, resp_def);
proto_add_oper(p, VFS_TRUNCATE, o);
o = oper_new("mount");
o = oper_new("mount", 2, arg_def, V_ERRNO, 0, resp_def);
proto_add_oper(p, VFS_MOUNT, o);
o = oper_new("unmount");
proto_add_oper(p, VFS_UNMOUNT, o);
/* o = oper_new("unmount", 0, arg_def);
proto_add_oper(p, VFS_UNMOUNT, o);*/
 
proto_register(SERVICE_VFS, p);
 
p = proto_new("console");
o = oper_new("getchar");
resp_def[0] = V_CHAR;
o = oper_new("getchar", 0, arg_def, V_INTEGER, 2, resp_def);
proto_add_oper(p, CONSOLE_GETCHAR, o);
o = oper_new("putchar");
 
arg_def[0] = V_CHAR;
o = oper_new("putchar", 1, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_PUTCHAR, o);
o = oper_new("clear");
o = oper_new("clear", 0, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_CLEAR, o);
o = oper_new("goto");
 
arg_def[0] = V_INTEGER; arg_def[1] = V_INTEGER;
o = oper_new("goto", 2, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_GOTO, o);
o = oper_new("getsize");
 
resp_def[0] = V_INTEGER; resp_def[1] = V_INTEGER;
o = oper_new("getsize", 0, arg_def, V_INTEGER, 2, resp_def);
proto_add_oper(p, CONSOLE_GETSIZE, o);
o = oper_new("flush");
o = oper_new("flush", 0, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_FLUSH, o);
o = oper_new("set_style");
 
arg_def[0] = V_INTEGER; arg_def[1] = V_INTEGER;
o = oper_new("set_style", 2, arg_def, V_INTEGER, 0, resp_def);
proto_add_oper(p, CONSOLE_SET_STYLE, o);
o = oper_new("cursor_visibility");
o = oper_new("cursor_visibility", 1, arg_def, V_VOID, 0, resp_def);
proto_add_oper(p, CONSOLE_CURSOR_VISIBILITY, o);
o = oper_new("flush");
proto_add_oper(p, CONSOLE_FLUSH, o);
 
proto_console = p;
proto_register(SERVICE_CONSOLE, p);
598,6 → 729,7
/* Trace an already running task */
--argc; ++argv;
task_id = strtol(*argv, &err_p, 10);
task_ldr = NULL;
if (*err_p) {
printf("Task ID syntax error\n");
print_syntax();
616,7 → 748,7
}
 
if (task_id != 0) {
if (argc == 0) return;
if (argc == 0) return 0;
printf("Extra arguments\n");
print_syntax();
return -1;
628,13 → 760,13
return -1;
}
 
/* Execute the specified command and trace the new task. */
/* Preload the specified program file. */
printf("Spawning '%s' with arguments:\n", *argv);
{
char **cp = argv;
while (*cp) printf("'%s'\n", *cp++);
}
task_id = task_spawn(*argv, argv);
task_ldr = preload_task(*argv, argv, &task_id);
 
return 0;
}
641,6 → 773,8
 
int main(int argc, char *argv[])
{
int rc;
 
printf("System Call / IPC Tracer\n");
 
display_mask = DM_THREAD | DM_SYSTEM | DM_USER;
649,8 → 783,21
return 1;
 
main_init();
trace_active_task(task_id);
 
rc = connect_task(task_id);
if (rc < 0) {
printf("Failed connecting to task %lld\n", task_id);
return 1;
}
 
printf("Connected to task %lld\n", task_id);
 
if (task_ldr != NULL) {
program_run();
}
 
trace_task(task_id);
 
return 0;
}
 
/branches/dynload/uspace/app/trace/syscalls.h
35,17 → 35,12
#ifndef SYSCALLS_H_
#define SYSCALLS_H_
 
typedef enum {
RV_INTEGER,
RV_HASH,
RV_ERRNO,
RV_INT_ERRNO
} rv_type_t;
#include "trace.h"
 
typedef struct {
char *name;
int n_args;
rv_type_t rv_type;
val_type_t rv_type;
} sc_desc_t;
 
extern const sc_desc_t syscall_desc[];
/branches/dynload/uspace/app/trace/proto.c
37,6 → 37,7
#include <ipc/ipc.h>
#include <libadt/hash_table.h>
 
#include "trace.h"
#include "proto.h"
 
#define SRV_PROTO_TABLE_CHAINS 32
209,13 → 210,25
oper->name = name;
}
 
oper_t *oper_new(char *name)
oper_t *oper_new(char *name, int argc, val_type_t *arg_types,
val_type_t rv_type, int respc, val_type_t *resp_types)
{
oper_t *o;
int i;
 
o = malloc(sizeof(oper_t));
oper_struct_init(o, name);
 
o->argc = argc;
for (i = 0; i < argc; i++)
o->arg_type[i] = arg_types[i];
 
o->rv_type = rv_type;
 
o->respc = respc;
for (i = 0; i < respc; i++)
o->resp_type[i] = resp_types[i];
 
return o;
}
 
/branches/dynload/uspace/app/trace/trace.h
35,6 → 35,8
#ifndef TRACE_H_
#define TRACE_H_
 
#include <sys/types.h>
 
/**
* Classes of events that can be displayed. Can be or-ed together.
*/
48,9 → 50,21
 
} display_mask_t;
 
typedef enum {
V_VOID,
V_INTEGER,
V_PTR,
V_HASH,
V_ERRNO,
V_INT_ERRNO,
V_CHAR
} val_type_t;
 
/** Combination of events to print. */
extern display_mask_t display_mask;
 
void val_print(sysarg_t val, val_type_t v_type);
 
#endif
 
/** @}
/branches/dynload/uspace/app/trace/proto.h
36,9 → 36,21
#define PROTO_H_
 
#include <libadt/hash_table.h>
#include <ipc/ipc.h>
#include "trace.h"
 
#define OPER_MAX_ARGS (IPC_CALL_LEN - 1)
 
typedef struct {
char *name;
 
int argc;
val_type_t arg_type[OPER_MAX_ARGS];
 
val_type_t rv_type;
 
int respc;
val_type_t resp_type[OPER_MAX_ARGS];
} oper_t;
 
typedef struct {
62,9 → 74,11
void proto_add_oper(proto_t *proto, int method, oper_t *oper);
oper_t *proto_get_oper(proto_t *proto, int method);
 
oper_t *oper_new(char *name);
oper_t *oper_new(char *name, int argc, val_type_t *arg_types,
val_type_t rv_type, int respc, val_type_t *resp_types);
 
 
 
#endif
 
/** @}
/branches/dynload/uspace/app/trace/ipcp.c
44,10 → 44,11
#define IPCP_CALLID_SYNC 0
 
typedef struct {
int phone_hash;
ipcarg_t phone_hash;
ipc_call_t question;
oper_t *oper;
 
int call_hash;
ipc_callid_t call_hash;
 
link_t link;
} pending_call_t;
96,6 → 97,7
// printf("pending_call_compare\n");
hs = hash_table_get_instance(item, pending_call_t, link);
 
// FIXME: this will fail if sizeof(long) < sizeof(void *).
return key[0] == hs->call_hash;
}
 
133,11 → 135,11
}
 
if (oper != NULL) {
printf("%s (%d)", oper->name, method);
printf("%s (%ld)", oper->name, method);
return;
}
 
printf("%d", method);
printf("%ld", method);
}
 
void ipcp_init(void)
145,6 → 147,14
ipc_m_desc_t *desc;
oper_t *oper;
 
val_type_t arg_def[OPER_MAX_ARGS] = {
V_INTEGER,
V_INTEGER,
V_INTEGER,
V_INTEGER,
V_INTEGER
};
 
/*
* Create a pseudo-protocol 'unknown' that has no known methods.
*/
158,7 → 168,8
 
desc = ipc_methods;
while (desc->number != 0) {
oper = oper_new(desc->name);
oper = oper_new(desc->name, OPER_MAX_ARGS, arg_def, V_INTEGER,
OPER_MAX_ARGS, arg_def);
proto_add_oper(proto_system, desc->number, oper);
 
++desc;
179,21 → 190,20
proto_t *proto;
unsigned long key[1];
oper_t *oper;
ipcarg_t *args;
int i;
 
if (have_conn[phone]) proto = connections[phone].proto;
else proto = NULL;
 
args = call->args;
 
if ((display_mask & DM_IPC) != 0) {
printf("Call ID: 0x%x, phone: %d, proto: %s, method: ", hash,
printf("Call ID: 0x%lx, phone: %d, proto: %s, method: ", hash,
phone, (proto ? proto->name : "n/a"));
ipc_m_print(proto, IPC_GET_METHOD(*call));
printf(" args: (%u, %u, %u, %u, %u)\n",
IPC_GET_ARG1(*call),
IPC_GET_ARG2(*call),
IPC_GET_ARG3(*call),
IPC_GET_ARG4(*call),
IPC_GET_ARG5(*call)
);
printf(" args: (%lu, %lu, %lu, %lu, %lu)\n", args[1], args[2],
args[3], args[4], args[5]);
}
 
 
210,14 → 220,26
printf("%s(%d).%s", (proto ? proto->name : "n/a"),
phone, (oper ? oper->name : "unknown"));
 
printf("(%u, %u, %u, %u, %u)\n",
IPC_GET_ARG1(*call),
IPC_GET_ARG2(*call),
IPC_GET_ARG3(*call),
IPC_GET_ARG4(*call),
IPC_GET_ARG5(*call)
);
putchar('(');
for (i = 1; i <= oper->argc; ++i) {
if (i > 1) printf(", ");
val_print(args[i], oper->arg_type[i - 1]);
}
putchar(')');
 
if (oper->rv_type == V_VOID && oper->respc == 0) {
/*
* No response data (typically the task will
* not be interested in the response).
* We will not display response.
*/
putchar('.');
}
 
putchar('\n');
}
} else {
oper = NULL;
}
 
/* Store call in hash table for response matching */
226,6 → 248,7
pcall->phone_hash = phone;
pcall->question = *call;
pcall->call_hash = hash;
pcall->oper = oper;
 
key[0] = hash;
 
235,13 → 258,17
static void parse_answer(ipc_callid_t hash, pending_call_t *pcall,
ipc_call_t *answer)
{
int phone;
ipcarg_t phone;
ipcarg_t method;
ipcarg_t service;
int retval;
ipcarg_t retval;
proto_t *proto;
int cphone;
 
ipcarg_t *resp;
oper_t *oper;
int i;
 
// printf("parse_answer\n");
 
phone = pcall->phone_hash;
248,8 → 275,10
method = IPC_GET_METHOD(pcall->question);
retval = IPC_GET_RETVAL(*answer);
 
resp = answer->args;
 
if ((display_mask & DM_IPC) != 0) {
printf("Response to 0x%x: retval=%d, args = (%u, %u, %u, %u, %u)\n",
printf("Response to 0x%lx: retval=%ld, args = (%lu, %lu, %lu, %lu, %lu)\n",
hash, retval, IPC_GET_ARG1(*answer),
IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer),
IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer));
256,7 → 285,28
}
 
if ((display_mask & DM_USER) != 0) {
printf("-> %d\n", retval);
oper = pcall->oper;
 
if (oper != NULL && (oper->rv_type != V_VOID || oper->respc > 0)) {
printf("->");
 
if (oper->rv_type != V_VOID) {
putchar(' ');
val_print(retval, oper->rv_type);
}
if (oper->respc > 0) {
putchar(' ');
putchar('(');
for (i = 1; i <= oper->respc; ++i) {
if (i > 1) printf(", ");
val_print(resp[i], oper->resp_type[i - 1]);
}
putchar(')');
}
 
putchar('\n');
}
}
 
if (phone == 0 && method == IPC_M_CONNECT_ME_TO && retval == 0) {
281,20 → 331,11
unsigned long key[1];
 
// printf("ipcp_call_in()\n");
/* printf("phone: %d, method: ", call->in_phone_hash);
ipc_m_print(IPC_GET_METHOD(*call));
printf(" args: (%u, %u, %u, %u, %u)\n",
IPC_GET_ARG1(*call),
IPC_GET_ARG2(*call),
IPC_GET_ARG3(*call),
IPC_GET_ARG4(*call),
IPC_GET_ARG5(*call)
);*/
 
if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) {
/* Not a response */
if ((display_mask & DM_IPC) != 0) {
printf("Not a response (hash %d)\n", hash);
printf("Not a response (hash 0x%lx)\n", hash);
}
return;
}
/branches/dynload/uspace/app/trace/syscalls.c
34,45 → 34,46
 
#include <kernel/syscall/syscall.h>
#include "syscalls.h"
#include "trace.h"
 
const sc_desc_t syscall_desc[] = {
[SYS_KLOG] ={ "klog", 3, RV_INT_ERRNO },
[SYS_TLS_SET] = { "tls_set", 1, RV_ERRNO },
[SYS_THREAD_CREATE] = { "thread_create", 3, RV_ERRNO },
[SYS_THREAD_EXIT] = { "thread_exit", 1, RV_ERRNO },
[SYS_THREAD_GET_ID] = { "thread_get_id", 1, RV_ERRNO },
[SYS_KLOG] ={ "klog", 3, V_INT_ERRNO },
[SYS_TLS_SET] = { "tls_set", 1, V_ERRNO },
[SYS_THREAD_CREATE] = { "thread_create", 3, V_ERRNO },
[SYS_THREAD_EXIT] = { "thread_exit", 1, V_ERRNO },
[SYS_THREAD_GET_ID] = { "thread_get_id", 1, V_ERRNO },
 
[SYS_TASK_GET_ID] = { "task_get_id", 1, RV_ERRNO },
[SYS_FUTEX_SLEEP] = { "futex_sleep_timeout", 3, RV_ERRNO },
[SYS_FUTEX_WAKEUP] = { "futex_wakeup", 1, RV_ERRNO },
[SYS_TASK_GET_ID] = { "task_get_id", 1, V_ERRNO },
[SYS_FUTEX_SLEEP] = { "futex_sleep_timeout", 3, V_ERRNO },
[SYS_FUTEX_WAKEUP] = { "futex_wakeup", 1, V_ERRNO },
 
[SYS_AS_AREA_CREATE] = { "as_area_create", 3, RV_ERRNO },
[SYS_AS_AREA_RESIZE] = { "as_area_resize", 3, RV_ERRNO },
[SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, RV_ERRNO },
[SYS_AS_AREA_CREATE] = { "as_area_create", 3, V_ERRNO },
[SYS_AS_AREA_RESIZE] = { "as_area_resize", 3, V_ERRNO },
[SYS_AS_AREA_DESTROY] = { "as_area_destroy", 1, V_ERRNO },
 
[SYS_IPC_CALL_SYNC_FAST] = { "ipc_call_sync_fast", 6, RV_ERRNO },
[SYS_IPC_CALL_SYNC_SLOW] = { "ipc_call_sync_slow", 3, RV_ERRNO },
[SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, RV_HASH },
[SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 2, RV_HASH },
[SYS_IPC_CALL_SYNC_FAST] = { "ipc_call_sync_fast", 6, V_ERRNO },
[SYS_IPC_CALL_SYNC_SLOW] = { "ipc_call_sync_slow", 3, V_ERRNO },
[SYS_IPC_CALL_ASYNC_FAST] = { "ipc_call_async_fast", 6, V_HASH },
[SYS_IPC_CALL_ASYNC_SLOW] = { "ipc_call_async_slow", 2, V_HASH },
 
[SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, RV_ERRNO },
[SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, RV_ERRNO },
[SYS_IPC_FORWARD_FAST] = { "ipc_forward_fast", 6, RV_ERRNO },
[SYS_IPC_WAIT] = { "ipc_wait_for_call", 3, RV_HASH },
[SYS_IPC_HANGUP] = { "ipc_hangup", 1, RV_ERRNO },
[SYS_IPC_REGISTER_IRQ] = { "ipc_register_irq", 4, RV_ERRNO },
[SYS_IPC_UNREGISTER_IRQ] = { "ipc_unregister_irq", 2, RV_ERRNO },
[SYS_IPC_ANSWER_FAST] = { "ipc_answer_fast", 6, V_ERRNO },
[SYS_IPC_ANSWER_SLOW] = { "ipc_answer_slow", 2, V_ERRNO },
[SYS_IPC_FORWARD_FAST] = { "ipc_forward_fast", 6, V_ERRNO },
[SYS_IPC_WAIT] = { "ipc_wait_for_call", 3, V_HASH },
[SYS_IPC_HANGUP] = { "ipc_hangup", 1, V_ERRNO },
[SYS_IPC_REGISTER_IRQ] = { "ipc_register_irq", 4, V_ERRNO },
[SYS_IPC_UNREGISTER_IRQ] = { "ipc_unregister_irq", 2, V_ERRNO },
 
[SYS_CAP_GRANT] = { "cap_grant", 2, RV_ERRNO },
[SYS_CAP_REVOKE] = { "cap_revoke", 2, RV_ERRNO },
[SYS_PHYSMEM_MAP] = { "physmem_map", 4, RV_ERRNO },
[SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, RV_ERRNO },
[SYS_PREEMPT_CONTROL] = { "preempt_control", 1, RV_ERRNO },
[SYS_CAP_GRANT] = { "cap_grant", 2, V_ERRNO },
[SYS_CAP_REVOKE] = { "cap_revoke", 2, V_ERRNO },
[SYS_PHYSMEM_MAP] = { "physmem_map", 4, V_ERRNO },
[SYS_IOSPACE_ENABLE] = { "iospace_enable", 1, V_ERRNO },
[SYS_PREEMPT_CONTROL] = { "preempt_control", 1, V_ERRNO },
 
[SYS_SYSINFO_VALID] = { "sysinfo_valid", 2, RV_HASH },
[SYS_SYSINFO_VALUE] = { "sysinfo_value", 2, RV_HASH },
[SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0, RV_ERRNO },
[SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 1, RV_ERRNO }
[SYS_SYSINFO_VALID] = { "sysinfo_valid", 2, V_HASH },
[SYS_SYSINFO_VALUE] = { "sysinfo_value", 2, V_HASH },
[SYS_DEBUG_ENABLE_CONSOLE] = { "debug_enable_console", 0, V_ERRNO },
[SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox", 1, V_ERRNO }
};
 
/** @}