Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3448 → Rev 3423

/branches/dynload/uspace/app/trace/ipcp.h
File deleted
/branches/dynload/uspace/app/trace/errors.h
File deleted
/branches/dynload/uspace/app/trace/syscalls.h
File deleted
/branches/dynload/uspace/app/trace/proto.c
File deleted
/branches/dynload/uspace/app/trace/trace.h
File deleted
/branches/dynload/uspace/app/trace/proto.h
File deleted
/branches/dynload/uspace/app/trace/ipc_desc.c
File deleted
/branches/dynload/uspace/app/trace/ipcp.c
File deleted
/branches/dynload/uspace/app/trace/errors.c
File deleted
/branches/dynload/uspace/app/trace/Makefile
File deleted
/branches/dynload/uspace/app/trace/syscalls.c
File deleted
/branches/dynload/uspace/app/trace/trace.c
File deleted
/branches/dynload/uspace/app/trace/ipc_desc.h
File deleted
/branches/dynload/uspace/app/bdsh/scli.c
53,8 → 53,8
const char *progname = PACKAGE_NAME;
 
/* These are not exposed, even to builtins */
static int cli_init(cliuser_t *);
static void cli_finit(cliuser_t *);
static int cli_init(cliuser_t *usr);
static void cli_finit(cliuser_t *usr);
 
/* Constructor */
static int cli_init(cliuser_t *usr)
/branches/dynload/uspace/app/bdsh/cmds/builtins/cd/cd.c
42,7 → 42,7
 
static char * cmdname = "cd";
 
void help_cmd_cd(unsigned int level)
void * help_cmd_cd(unsigned int level)
{
if (level == HELP_SHORT) {
printf("`%s' changes the current working directory.\n", cmdname);
53,12 → 53,12
cmdname, cmdname);
}
 
return;
return CMD_VOID;
}
 
/* This is a very rudamentary 'cd' command. It is not 'link smart' (yet) */
 
int cmd_cd(char **argv, cliuser_t *usr)
int * cmd_cd(char **argv, cliuser_t *usr)
{
int argc, rc = 0;
 
/branches/dynload/uspace/app/bdsh/cmds/builtins/cd/entry.h
4,8 → 4,8
#include "scli.h"
 
/* Entry points for the cd command */
extern void help_cmd_cd(unsigned int);
extern int cmd_cd(char **, cliuser_t *);
extern void * help_cmd_cd(unsigned int);
extern int * cmd_cd(char **, cliuser_t *);
 
#endif
 
/branches/dynload/uspace/app/bdsh/cmds/modules/cp/cp.c
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/cp/cp_def.h
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/cp/entry.h
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/cp/cp.h
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/sleep/entry.h
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/sleep/sleep.c
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/sleep/sleep_def.h
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/sleep/sleep.h
File deleted
/branches/dynload/uspace/app/bdsh/cmds/modules/touch/touch.c
48,7 → 48,7
static char *cmdname = "touch";
 
/* Dispays help for touch in various levels */
void help_cmd_touch(unsigned int level)
void * help_cmd_touch(unsigned int level)
{
if (level == HELP_SHORT) {
printf("`%s' updates access times for files\n", cmdname);
58,11 → 58,11
"created\n", cmdname);
}
 
return;
return CMD_VOID;
}
 
/* Main entry point for touch, accepts an array of arguments */
int cmd_touch(char **argv)
int * cmd_touch(char **argv)
{
unsigned int argc, i = 0, ret = 0;
int fd;
/branches/dynload/uspace/app/bdsh/cmds/modules/touch/entry.h
2,8 → 2,8
#define TOUCH_ENTRY_H
 
/* Entry points for the touch command */
extern int cmd_touch(char **);
extern void help_cmd_touch(unsigned int);
extern int * cmd_touch(char **);
extern void * help_cmd_touch(unsigned int);
 
#endif /* TOUCH_ENTRY_H */
 
/branches/dynload/uspace/app/bdsh/cmds/modules/mkdir/mkdir.c
60,7 → 60,7
};
 
 
void help_cmd_mkdir(unsigned int level)
void * help_cmd_mkdir(unsigned int level)
{
if (level == HELP_SHORT) {
printf("`%s' creates a new directory\n", cmdname);
79,7 → 79,7
cmdname, cmdname);
}
 
return;
return CMD_VOID;
}
 
/* This is kind of clunky, but effective for now */
181,7 → 181,7
return ret;
}
 
int cmd_mkdir(char **argv)
int * cmd_mkdir(char **argv)
{
unsigned int argc, create_parents = 0, i, ret = 0, follow = 0;
unsigned int verbose = 0;
/branches/dynload/uspace/app/bdsh/cmds/modules/mkdir/entry.h
2,8 → 2,8
#define MKDIR_ENTRY_H
 
/* Entry points for the mkdir command */
extern int cmd_mkdir(char **);
extern void help_cmd_mkdir(unsigned int);
extern int * cmd_mkdir(char **);
extern void * help_cmd_mkdir(unsigned int);
 
#endif /* MKDIR_ENTRY_H */
 
/branches/dynload/uspace/app/bdsh/cmds/modules/cat/cat.c
59,7 → 59,7
};
 
/* Dispays help for cat in various levels */
void help_cmd_cat(unsigned int level)
void * help_cmd_cat(unsigned int level)
{
if (level == HELP_SHORT) {
printf("`%s' shows the contents of files\n", cmdname);
78,7 → 78,7
cmdname, cmdname);
}
 
return;
return CMD_VOID;
}
 
static unsigned int cat_file(const char *fname, size_t blen)
121,6 → 121,12
return 1;
}
 
/* Debug stuff, newline not added purposefully */
printf("** %s is a file with the size of %ld bytes\n",
fname, total);
printf( "** %d bytes were read in a buffer of %d bytes in %d reads\n",
count, blen, reads);
printf("** Read %s\n", count == total ? "Succeeded" : "Failed");
free(buff);
 
return 0;
127,7 → 133,7
}
 
/* Main entry point for cat, accepts an array of arguments */
int cmd_cat(char **argv)
int * cmd_cat(char **argv)
{
unsigned int argc, i, ret = 0, buffer = 0;
int c, opt_ind;
/branches/dynload/uspace/app/bdsh/cmds/modules/cat/entry.h
2,8 → 2,8
#define CAT_ENTRY_H
 
/* Entry points for the cat command */
extern int cmd_cat(char **);
extern void help_cmd_cat(unsigned int);
extern int * cmd_cat(char **);
extern void * help_cmd_cat(unsigned int);
 
#endif /* CAT_ENTRY_H */
 
/branches/dynload/uspace/app/bdsh/cmds/modules/help/help.c
69,7 → 69,7
return HELP_IS_RUBBISH;
}
 
void help_cmd_help(unsigned int level)
void *help_cmd_help(unsigned int level)
{
if (level == HELP_SHORT) {
printf(
86,10 → 86,10
cmdname, cmdname, cmdname, cmdname);
}
 
return;
return CMD_VOID;
}
 
int cmd_help(char *argv[])
int *cmd_help(char *argv[])
{
module_t *mod;
builtin_t *cmd;
/branches/dynload/uspace/app/bdsh/cmds/modules/help/entry.h
2,7 → 2,7
#define HELP_ENTRY_H_
 
/* Entry points for the help command */
extern void help_cmd_help(unsigned int);
extern int cmd_help(char *[]);
extern void * help_cmd_help(unsigned int);
extern int * cmd_help(char *[]);
 
#endif
/branches/dynload/uspace/app/bdsh/cmds/modules/ls/ls.c
132,7 → 132,7
return;
}
 
void help_cmd_ls(unsigned int level)
void * help_cmd_ls(unsigned int level)
{
if (level == HELP_SHORT) {
printf("`%s' lists files and directories.\n", cmdname);
142,10 → 142,10
"working directory is used.\n", cmdname);
}
 
return;
return CMD_VOID;
}
 
int cmd_ls(char **argv)
int * cmd_ls(char **argv)
{
unsigned int argc;
unsigned int scope;
/branches/dynload/uspace/app/bdsh/cmds/modules/ls/entry.h
2,8 → 2,8
#define LS_ENTRY_H
 
/* Entry points for the ls command */
extern int cmd_ls(char **);
extern void help_cmd_ls(unsigned int);
extern int * cmd_ls(char **);
extern void * help_cmd_ls(unsigned int);
 
#endif /* LS_ENTRY_H */
 
/branches/dynload/uspace/app/bdsh/cmds/modules/rm/rm.c
144,7 → 144,7
}
 
/* Dispays help for rm in various levels */
void help_cmd_rm(unsigned int level)
void * help_cmd_rm(unsigned int level)
{
if (level == HELP_SHORT) {
printf("`%s' removes files and directories.\n", cmdname);
161,11 → 161,11
"Currently, %s is under development, some options don't work.\n",
cmdname, cmdname);
}
return;
return CMD_VOID;
}
 
/* Main entry point for rm, accepts an array of arguments */
int cmd_rm(char **argv)
int * cmd_rm(char **argv)
{
unsigned int argc;
unsigned int i, scope, ret = 0;
/branches/dynload/uspace/app/bdsh/cmds/modules/rm/entry.h
2,8 → 2,8
#define RM_ENTRY_H
 
/* Entry points for the rm command */
extern int cmd_rm(char **);
extern void help_cmd_rm(unsigned int);
extern int * cmd_rm(char **);
extern void * help_cmd_rm(unsigned int);
 
#endif /* RM_ENTRY_H */
 
/branches/dynload/uspace/app/bdsh/cmds/modules/quit/quit.c
39,15 → 39,15
extern volatile unsigned int cli_quit;
extern const char *progname;
 
void help_cmd_quit(unsigned int level)
void * help_cmd_quit(unsigned int level)
{
printf("Type `%s' to exit %s\n", cmdname, progname);
return;
return CMD_VOID;
}
 
/* Quits the program and returns the status of whatever command
* came before invoking 'quit' */
int cmd_quit(char *argv[])
int * cmd_quit(char *argv[])
{
/* Inform that we're outta here */
cli_quit = 1;
/branches/dynload/uspace/app/bdsh/cmds/modules/quit/entry.h
2,8 → 2,8
#define QUIT_ENTRY_H_
 
/* Entry points for the quit command */
extern void help_cmd_quit(unsigned int);
extern int cmd_quit(char *[]);
extern void * help_cmd_quit(unsigned int);
extern int * cmd_quit(char *[]);
 
#endif
 
/branches/dynload/uspace/app/bdsh/cmds/modules/pwd/entry.h
4,8 → 4,8
#include "scli.h"
 
/* Entry points for the pwd command */
extern void help_cmd_pwd(unsigned int);
extern int cmd_pwd(char **);
extern void * help_cmd_pwd(unsigned int);
extern int * cmd_pwd(char **);
 
#endif
 
/branches/dynload/uspace/app/bdsh/cmds/modules/pwd/pwd.c
39,13 → 39,13
 
static char * cmdname = "pwd";
 
void help_cmd_pwd(unsigned int level)
void * help_cmd_pwd(unsigned int level)
{
printf("`%s' prints your current working directory.\n", cmdname);
return;
return CMD_VOID;
}
 
int cmd_pwd(char *argv[])
int * cmd_pwd(char *argv[])
{
char *buff;
 
/branches/dynload/uspace/app/bdsh/cmds/modules/modules.h
25,8 → 25,6
#include "touch/entry.h"
#include "ls/entry.h"
#include "pwd/entry.h"
#include "sleep/entry.h"
#include "cp/entry.h"
 
/* Each .def function fills the module_t struct with the individual name, entry
* point, help entry point, etc. You can use config.h to control what modules
41,8 → 39,6
#include "touch/touch_def.h"
#include "ls/ls_def.h"
#include "pwd/pwd_def.h"
#include "sleep/sleep_def.h"
#include "cp/cp_def.h"
{NULL, NULL, NULL, NULL}
};
 
/branches/dynload/uspace/app/bdsh/cmds/mknewcmd
120,8 → 120,8
EOF
[ "${CMDTYPE}" = "module" ] && cat << EOF >> ${OUTDIR}/entry.h
/* Entry points for the ${CMDNAME} command */
extern int ${CMDENTRY}(char **);
extern void ${HELPENTRY}(unsigned int);
extern int * ${CMDENTRY}(char **);
extern void * ${HELPENTRY}(unsigned int);
 
#endif /* ${defname}_ENTRY_H */
 
170,22 → 170,22
static char *cmdname = "${CMDNAME}";
 
/* Dispays help for ${CMDNAME} in various levels */
void ${HELPENTRY}(unsigned int level)
void * ${HELPENTRY}(unsigned int level)
{
printf("This is the %s help for '%s'.\n",
level ? EXT_HELP : SHORT_HELP, cmdname);
return;
return CMD_VOID;
}
 
EOF
[ "${CMDTYPE}" = "module" ] && cat << EOF >> ${OUTDIR}/${CMDNAME}.c
/* Main entry point for ${CMDNAME}, accepts an array of arguments */
int ${CMDENTRY}(char **argv)
int * ${CMDENTRY}(char **argv)
EOF
[ "${CMDTYPE}" = "builtin" ] && cat << EOF >> ${OUTDIR}/${CMDNAME}.c
/* Main entry point for ${CMDNAME}, accepts an array of arguments and a
* pointer to the cliuser_t structure */
int ${CMDENTRY}(char **argv, cliuser_t *usr)
int * ${CMDENTRY}(char **argv, cliuser_t *usr)
EOF
cat << EOF >> ${OUTDIR}/${CMDNAME}.c
{
/branches/dynload/uspace/app/bdsh/cmds/cmds.h
19,16 → 19,17
#define BUFF_SMALL 255
 
/* Return macros for int type entry points */
#define CMD_FAILURE 1
#define CMD_FAILURE (int*)1
#define CMD_SUCCESS 0
#define CMD_VOID (void *)NULL
 
/* Types for module command entry and help */
typedef int (* mod_entry_t)(char **);
typedef void (* mod_help_t)(unsigned int);
typedef int * (* mod_entry_t)(char **);
typedef void * (* mod_help_t)(unsigned int);
 
/* Built-in commands need to be able to modify cliuser_t */
typedef int (* builtin_entry_t)(char **, cliuser_t *);
typedef void (* builtin_help_t)(unsigned int);
typedef int * (* builtin_entry_t)(char **, cliuser_t *);
typedef void * (* builtin_help_t)(unsigned int);
 
/* Module structure */
typedef struct {
/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/Makefile
64,8 → 64,6
cmds/modules/touch/ \
cmds/modules/ls/ \
cmds/modules/pwd/ \
cmds/modules/sleep/ \
cmds/modules/cp/ \
cmds/builtins/ \
cmds/builtins/cd/
 
78,8 → 76,6
cmds/modules/touch/touch.c \
cmds/modules/ls/ls.c \
cmds/modules/pwd/pwd.c \
cmds/modules/sleep/sleep.c \
cmds/modules/cp/cp.c \
cmds/builtins/cd/cd.c \
cmds/mod_cmds.c \
cmds/builtin_cmds.c \
/branches/dynload/uspace/app/bdsh/README
57,12 → 57,12
They are typed as such (from cmds.h):
 
/* Types for module command entry and help */
typedef int (* mod_entry_t)(char **);
typedef void (* mod_help_t)(unsigned int);
typedef int * (* mod_entry_t)(char **);
typedef void * (* mod_help_t)(unsigned int);
 
/* Built-in commands need to be able to modify cliuser_t */
typedef int (* builtin_entry_t)(char **, cliuser_t *);
typedef void (* builtin_help_t)(unsigned int);
typedef int * (* builtin_entry_t)(char **, cliuser_t *);
typedef void * (* builtin_help_t)(unsigned int);
 
As you can see, both modular and builtin commands expect an array of
arguments, however bulitins also expect to be pointed to cliuser_t.
153,7 → 153,9
 
2: Change your "usage()" command as shown:
-- void usage(...)
++ void help_cmd_foo(unsigned int level)
++ void * help_cmd_foo(unsigned int level)
-- return;
++ retrn CMD_VOID;
 
'level' is either 0 or 1, indicating the level of help requested.
If the help / usage function currently exits based on how it is
161,19 → 163,33
 
3: Change the programs "main()" as shown:
-- int main(int argc, char **argv)
++ int cmd_foo(char **argv)
++ int * cmd_foo(char **argv)
-- return 1;
++ return CMD_FAILURE;
-- return 0;
++ return CMD_SUCCESS;
 
If main() returns an int that is not 1 or 0 (e.g. 127), cast it as
such:
 
-- return 127;
++ return (int *) 127;
 
NOTE: _ONLY_ the main and help entry points need to return int * or
void *, respectively. Also take note that argc has changed. The type
for entry points may soon change.
 
NOTE: If main is void, you'll need to change it and ensure that its
expecting an array of arguments, even if they'll never be read or
used. I.e.:
 
-- void main(void)
++ int cmd_foo(char **argv)
++ int * cmd_foo(char **argv)
 
Similararly, do not try to return CMD_VOID within the modules main
entry point. If somehow you escape the compiler yelling at you, you
will surely see pretty blue and yellow fireworks once its reached.
 
4: Don't expose more than the entry and help points:
-- void my_function(int n)
++ static void my_function(int n)
/branches/dynload/uspace/app/bdsh/config.h
1,18 → 1,15
/* Various things that are used in many places including a few
* tidbits left over from autoconf prior to the HelenOS port */
/* Various things that are used in many files
* Various temporary port work-arounds are addressed in __HELENOS__ , this
* serves as a convenience and later as a guide to make "phony.h" for future
* ports */
 
/* Specific port work-arounds : */
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
 
#ifndef EXIT_SUCCESS
#define EXIT_SUCCESS 0
#define EXIT_FAILURE 1
#endif
#define EXIT_FAILURE 0
 
/* Work around for getenv() */
#define PATH "/srv:/app"
#define PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
#define PATH_DELIM ":"
 
/* Used in many places */
29,7 → 26,7
#define PACKAGE_BUGREPORT "echo@echoreply.us"
#define PACKAGE_NAME "bdsh"
#define PACKAGE_STRING "The brain dead shell"
#define PACKAGE_TARNAME "bdsh"
#define PACKAGE_TARNAME "scli"
#define PACKAGE_VERSION "0.0.1"
 
 
/branches/dynload/uspace/app/init/init.c
108,15 → 108,17
return -1;
}
// FIXME: spawn("/srv/pci");
spawn("/srv/fb");
spawn("/srv/kbd");
spawn("/srv/console");
buf = malloc(BUF_SIZE);
// FIXME: spawn("/sbin/pci");
spawn("/sbin/fb");
spawn("/sbin/kbd");
spawn("/sbin/console");
console_wait();
version_print();
spawn("/app/bdsh");
spawn("/sbin/bdsh");
free(buf);
return 0;
/branches/dynload/uspace/app/tester/tester.c
133,7 → 133,7
if (c == 'a')
break;
if (test->name == NULL)
if (c > 'a')
printf("Unknown test\n\n");
else
run_test(test);
/branches/dynload/uspace/lib/libc/include/udebug.h
File deleted
/branches/dynload/uspace/lib/libc/include/string.h
64,9 → 64,6
extern long int strtol(const char *, char **, int);
extern unsigned long strtoul(const char *, char **, int);
 
extern char * strtok_r(char *, const char *, char **);
extern char * strtok(char *, const char *);
 
#endif
 
/** @}
/branches/dynload/uspace/lib/libc/include/ipc/loader.h
39,7 → 39,6
 
typedef enum {
LOADER_HELLO = IPC_FIRST_USER_METHOD,
LOADER_GET_TASKID,
LOADER_SET_PATHNAME,
LOADER_SET_ARGS,
LOADER_RUN
/branches/dynload/uspace/lib/libc/include/ipc/ipc.h
288,10 → 288,6
extern int ipc_data_write_receive(ipc_callid_t *callid, size_t *size);
extern int ipc_data_write_finalize(ipc_callid_t callid, void *dst, size_t size);
 
#include <task.h>
 
extern int ipc_connect_kbox(task_id_t id);
 
#endif
 
/** @}
/branches/dynload/uspace/lib/libc/generic/udebug.c
File deleted
/branches/dynload/uspace/lib/libc/generic/task.c
133,7 → 133,6
 
char *pa;
size_t pa_len;
task_id_t task_id;
 
pa = absolutize(path, &pa_len);
if (!pa)
152,18 → 151,6
if (rc != EOK)
return 0;
 
/* Get task ID. */
req = async_send_0(phone_id, LOADER_GET_TASKID, &answer);
rc = ipc_data_read_start(phone_id, &task_id, sizeof(task_id));
if (rc != EOK) {
async_wait_for(req, NULL);
goto error;
}
 
async_wait_for(req, &retval);
if (retval != EOK)
goto error;
 
/* Send program pathname */
req = async_send_0(phone_id, LOADER_SET_PATHNAME, &answer);
rc = ipc_data_write_start(phone_id, (void *)pa, pa_len);
188,7 → 175,7
 
/* Success */
ipc_hangup(phone_id);
return task_id;
return 1;
 
/* Error exit */
error:
/branches/dynload/uspace/lib/libc/generic/string.c
1,7 → 1,5
/*
* Copyright (c) 2005 Martin Decky
* Copyright (C) 1998 by Wes Peters <wes@softweyr.com>
* Copyright (c) 1988, 1993 The Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
398,52 → 396,5
return (char *) memcpy(ret, s1, len);
}
 
/* Ported from FBSD strtok.c 8.1 (Berkeley) 6/4/93 */
char * strtok_r(char *s, const char *delim, char **last)
{
char *spanp, *tok;
int c, sc;
 
if (s == NULL && (s = *last) == NULL)
return (NULL);
 
cont:
c = *s++;
for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
if (c == sc)
goto cont;
}
 
if (c == 0) { /* no non-delimiter characters */
*last = NULL;
return (NULL);
}
 
tok = s - 1;
 
for (;;) {
c = *s++;
spanp = (char *)delim;
do {
if ((sc = *spanp++) == c) {
if (c == 0)
s = NULL;
else
s[-1] = '\0';
*last = s;
return (tok);
}
} while (sc != 0);
}
}
 
/* Ported from FBSD strtok.c 8.1 (Berkeley) 6/4/93 */
char * strtok(char *s, const char *delim)
{
static char *last;
 
return (strtok_r(s, delim, &last));
}
 
/** @}
*/
/branches/dynload/uspace/lib/libc/generic/ipc.c
909,18 → 909,6
{
return ipc_answer_2(callid, EOK, (ipcarg_t) dst, (ipcarg_t) size);
}
 
#include <kernel/syscall/sysarg64.h>
/** Connect to a task specified by id.
*/
int ipc_connect_kbox(task_id_t id)
{
sysarg64_t arg;
 
arg.value = (unsigned long long) id;
 
return __SYSCALL1(SYS_IPC_CONNECT_KBOX, (sysarg_t) &arg);
}
/** @}
*/
/branches/dynload/uspace/lib/libc/Makefile
80,7 → 80,6
generic/err.c \
generic/stdlib.c \
generic/mman.c \
generic/udebug.c \
generic/vfs/vfs.c \
generic/vfs/canonify.c
 
/branches/dynload/uspace/srv/loader/main.c
77,27 → 77,6
/** Buffer holding all arguments */
static char *arg_buf = NULL;
 
static int loader_get_taskid(ipc_callid_t rid, ipc_call_t *request)
{
ipc_callid_t callid;
task_id_t task_id;
size_t len;
 
task_id = task_get_id();
 
if (!ipc_data_read_receive(&callid, &len)) {
ipc_answer_0(callid, EINVAL);
ipc_answer_0(rid, EINVAL);
return;
}
 
if (len > sizeof(task_id)) len = sizeof(task_id);
 
ipc_data_write_finalize(callid, &task_id, len);
ipc_answer_0(rid, EOK);
}
 
 
/** Receive a call setting pathname of the program to execute.
*
* @param rid
297,9 → 276,6
// printf("received call from phone %d, method=%d\n",
// call.in_phone_hash, IPC_GET_METHOD(call));
switch (IPC_GET_METHOD(call)) {
case LOADER_GET_TASKID:
loader_get_taskid(callid, &call);
continue;
case LOADER_SET_PATHNAME:
loader_set_pathname(callid, &call);
continue;
/branches/dynload/uspace/Makefile
51,7 → 51,6
app/tetris \
app/tester \
app/dltest \
app/trace \
app/klog \
app/init \
app/bdsh
/branches/dynload/uspace/dist/etc/inittab
--- kernel/generic/src/udebug/udebug_ipc.c (revision 3448)
+++ kernel/generic/src/udebug/udebug_ipc.c (nonexistent)
@@ -1,294 +0,0 @@
-/*
- * Copyright (c) 2008 Jiri Svoboda
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup generic
- * @{
- */
-
-/**
- * @file
- * @brief Udebug IPC message handling.
- */
-
-#include <proc/task.h>
-#include <proc/thread.h>
-#include <arch.h>
-#include <errno.h>
-#include <ipc/ipc.h>
-#include <syscall/copy.h>
-#include <udebug/udebug.h>
-#include <udebug/udebug_ops.h>
-#include <udebug/udebug_ipc.h>
-
-int udebug_request_preprocess(call_t *call, phone_t *phone)
-{
- switch (IPC_GET_ARG1(call->data)) {
- /* future UDEBUG_M_REGS_WRITE, UDEBUG_M_MEM_WRITE: */
- default:
- break;
- }
-
- return 0;
-}
-
-static void udebug_receive_begin(call_t *call)
-{
- int rc;
-
- rc = udebug_begin(call);
- if (rc < 0) {
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
- return;
- }
-
- if (rc != 0) {
- IPC_SET_RETVAL(call->data, 0);
- ipc_answer(&TASK->kernel_box, call);
- }
-}
-
-static void udebug_receive_end(call_t *call)
-{
- int rc;
-
- rc = udebug_end();
-
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
-}
-
-static void udebug_receive_set_evmask(call_t *call)
-{
- int rc;
- udebug_evmask_t mask;
-
- mask = IPC_GET_ARG2(call->data);
- rc = udebug_set_evmask(mask);
-
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
-}
-
-
-static void udebug_receive_go(call_t *call)
-{
- thread_t *t;
- int rc;
-
- t = (thread_t *)IPC_GET_ARG2(call->data);
-
- rc = udebug_go(t, call);
- if (rc < 0) {
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
- return;
- }
-}
-
-static void udebug_receive_stop(call_t *call)
-{
- thread_t *t;
- int rc;
-
- t = (thread_t *)IPC_GET_ARG2(call->data);
-
- rc = udebug_stop(t, call);
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
-}
-
-static void udebug_receive_thread_read(call_t *call)
-{
- unative_t uspace_addr;
- unative_t to_copy;
- unsigned total_bytes;
- unsigned buf_size;
- void *buffer;
- size_t n;
- int rc;
-
- uspace_addr = IPC_GET_ARG2(call->data); /* Destination address */
- buf_size = IPC_GET_ARG3(call->data); /* Dest. buffer size */
-
- /*
- * Read thread list. Variable n will be filled with actual number
- * of threads times thread-id size.
- */
- rc = udebug_thread_read(&buffer, buf_size, &n);
- if (rc < 0) {
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
- return;
- }
-
- total_bytes = n;
-
- /* Copy MAX(buf_size, total_bytes) bytes */
-
- if (buf_size > total_bytes)
- to_copy = total_bytes;
- else
- to_copy = buf_size;
-
- /*
- * Make use of call->buffer to transfer data to caller's userspace
- */
-
- IPC_SET_RETVAL(call->data, 0);
- /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
- same code in process_answer() can be used
- (no way to distinguish method in answer) */
- IPC_SET_ARG1(call->data, uspace_addr);
- IPC_SET_ARG2(call->data, to_copy);
-
- IPC_SET_ARG3(call->data, total_bytes);
- call->buffer = buffer;
-
- ipc_answer(&TASK->kernel_box, call);
-}
-
-static void udebug_receive_args_read(call_t *call)
-{
- thread_t *t;
- unative_t uspace_addr;
- int rc;
- void *buffer;
-
- t = (thread_t *)IPC_GET_ARG2(call->data);
-
- rc = udebug_args_read(t, &buffer);
- if (rc != EOK) {
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
- return;
- }
-
- /*
- * Make use of call->buffer to transfer data to caller's userspace
- */
-
- uspace_addr = IPC_GET_ARG3(call->data);
-
- IPC_SET_RETVAL(call->data, 0);
- /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
- same code in process_answer() can be used
- (no way to distinguish method in answer) */
- IPC_SET_ARG1(call->data, uspace_addr);
- IPC_SET_ARG2(call->data, 6 * sizeof(unative_t));
- call->buffer = buffer;
-
- ipc_answer(&TASK->kernel_box, call);
-}
-
-static void udebug_receive_mem_read(call_t *call)
-{
- unative_t uspace_dst;
- unative_t uspace_src;
- unsigned size;
- void *buffer;
- int rc;
-
- uspace_dst = IPC_GET_ARG2(call->data);
- uspace_src = IPC_GET_ARG3(call->data);
- size = IPC_GET_ARG4(call->data);
-
- rc = udebug_mem_read(uspace_src, size, &buffer);
- if (rc < 0) {
- IPC_SET_RETVAL(call->data, rc);
- ipc_answer(&TASK->kernel_box, call);
- return;
- }
-
- IPC_SET_RETVAL(call->data, 0);
- /* ARG1=dest, ARG2=size as in IPC_M_DATA_READ so that
- same code in process_answer() can be used
- (no way to distinguish method in answer) */
- IPC_SET_ARG1(call->data, uspace_dst);
- IPC_SET_ARG2(call->data, size);
- call->buffer = buffer;
-
- ipc_answer(&TASK->kernel_box, call);
-}
-
-/**
- * Handle a debug call received on the kernel answerbox.
- *
- * This is called by the kbox servicing thread.
- */
-void udebug_call_receive(call_t *call)
-{
- int debug_method;
-
- debug_method = IPC_GET_ARG1(call->data);
-
- if (debug_method != UDEBUG_M_BEGIN) {
- /*
- * Verify that the sender is this task's debugger.
- * Note that this is the only thread that could change
- * TASK->debugger. Therefore no locking is necessary
- * and the sender can be safely considered valid until
- * control exits this function.
- */
- if (TASK->udebug.debugger != call->sender) {
- IPC_SET_RETVAL(call->data, EINVAL);
- ipc_answer(&TASK->kernel_box, call);
- return;
- }
- }
-
- switch (debug_method) {
- case UDEBUG_M_BEGIN:
- udebug_receive_begin(call);
- break;
- case UDEBUG_M_END:
- udebug_receive_end(call);
- break;
- case UDEBUG_M_SET_EVMASK:
- udebug_receive_set_evmask(call);
- break;
- case UDEBUG_M_GO:
- udebug_receive_go(call);
- break;
- case UDEBUG_M_STOP:
- udebug_receive_stop(call);
- break;
- case UDEBUG_M_THREAD_READ:
- udebug_receive_thread_read(call);
- break;
- case UDEBUG_M_ARGS_READ:
- udebug_receive_args_read(call);
- break;
- case UDEBUG_M_MEM_READ:
- udebug_receive_mem_read(call);
- break;
- }
-}
-
-/** @}
- */
/branches/dynload/kernel/generic/src/udebug/udebug.c
File deleted
/branches/dynload/kernel/generic/src/udebug/udebug_ops.c
File deleted
/branches/dynload/kernel/generic/src/main/uinit.c
46,9 → 46,7
#include <userspace.h>
#include <mm/slab.h>
#include <arch.h>
#include <udebug/udebug.h>
 
 
/** Thread used to bring up userspace thread.
*
* @param arg Pointer to structure containing userspace entry and stack
67,10 → 65,6
* deployed for the event of forceful task termination.
*/
thread_detach(THREAD);
 
#ifdef CONFIG_UDEBUG
udebug_stoppable_end();
#endif
uarg.uspace_entry = ((uspace_arg_t *) arg)->uspace_entry;
uarg.uspace_stack = ((uspace_arg_t *) arg)->uspace_stack;
/branches/dynload/kernel/generic/src/proc/task.c
155,18 → 155,7
 
ta->capabilities = 0;
ta->cycles = 0;
 
#ifdef CONFIG_UDEBUG
/* Init debugging stuff */
udebug_task_init(&ta->udebug);
 
/* Init kbox stuff */
ipc_answerbox_init(&ta->kernel_box, ta);
ta->kb_thread = NULL;
mutex_initialize(&ta->kb_cleanup_lock, MUTEX_PASSIVE);
ta->kb_finished = false;
#endif
 
ipc_answerbox_init(&ta->answerbox, ta);
for (i = 0; i < IPC_MAX_PHONES; i++)
ipc_phone_init(&ta->phones[i]);
/branches/dynload/kernel/generic/src/proc/thread.c
180,10 → 180,6
return -1;
}
 
#ifdef CONFIG_UDEBUG
mutex_initialize(&t->udebug.lock, MUTEX_PASSIVE);
#endif
 
return 0;
}
 
351,11 → 347,6
avltree_node_initialize(&t->threads_tree_node);
t->threads_tree_node.key = (uintptr_t) t;
 
#ifdef CONFIG_UDEBUG
/* Init debugging stuff */
udebug_thread_initialize(&t->udebug);
#endif
 
/* might depend on previous initialization */
thread_create_arch(t);
 
418,17 → 409,12
ipl_t ipl;
 
/*
* Attach to the specified task.
* Attach to the current task.
*/
ipl = interrupts_disable();
spinlock_lock(&task->lock);
 
atomic_inc(&task->refcount);
 
/* Must not count kbox thread into lifecount */
if (t->flags & THREAD_FLAG_USPACE)
atomic_inc(&task->lifecount);
 
atomic_inc(&task->lifecount);
list_append(&t->th_link, &task->th_head);
spinlock_unlock(&task->lock);
 
451,19 → 437,14
{
ipl_t ipl;
 
if (THREAD->flags & THREAD_FLAG_USPACE) {
#ifdef CONFIG_UDEBUG
/* Generate udebug THREAD_E event */
udebug_thread_e_event();
#endif
if (atomic_predec(&TASK->lifecount) == 0) {
/*
* We are the last userspace thread in the task that
* still has not exited. With the exception of the
* moment the task was created, new userspace threads
* can only be created by threads of the same task.
* We are safe to perform cleanup.
*/
if (atomic_predec(&TASK->lifecount) == 0) {
/*
* We are the last thread in the task that still has not exited.
* With the exception of the moment the task was created, new
* threads can only be created by threads of the same task.
* We are safe to perform cleanup.
*/
if (THREAD->flags & THREAD_FLAG_USPACE) {
ipc_cleanup();
futex_cleanup();
LOG("Cleanup of task %" PRIu64" completed.", TASK->taskid);
760,11 → 741,6
thread_attach(t, TASK);
thread_ready(t);
 
#ifdef CONFIG_UDEBUG
/* Generate udebug THREAD_B event */
udebug_thread_b_event(t);
#endif
 
return 0;
} else
free(kernel_uarg);
/branches/dynload/kernel/generic/src/mm/as.c
385,7 → 385,7
if (pages < area->pages) {
bool cond;
uintptr_t start_free = area->base + pages * PAGE_SIZE;
uintptr_t start_free = area->base + pages*PAGE_SIZE;
 
/*
* Shrinking the area.
395,7 → 395,7
/*
* Start TLB shootdown sequence.
*/
tlb_shootdown_start(TLB_INVL_PAGES, as->asid, area->base +
tlb_shootdown_start(TLB_INVL_PAGES, AS->asid, area->base +
pages * PAGE_SIZE, area->pages - pages);
 
/*
/branches/dynload/kernel/generic/src/ipc/kbox.c
File deleted
/branches/dynload/kernel/generic/src/ipc/sysipc.c
42,9 → 42,8
#include <ipc/sysipc.h>
#include <ipc/irq.h>
#include <ipc/ipcrsc.h>
#include <ipc/kbox.h>
#include <udebug/udebug_ipc.h>
#include <arch/interrupt.h>
#include <print.h>
#include <syscall/copy.h>
#include <security/cap.h>
#include <mm/as.h>
296,11 → 295,10
/** Called before the request is sent.
*
* @param call Call structure with the request.
* @param phone Phone that the call will be sent through.
*
* @return Return 0 on success, ELIMIT or EPERM on error.
*/
static int request_preprocess(call_t *call, phone_t *phone)
static int request_preprocess(call_t *call)
{
int newphid;
size_t size;
342,10 → 340,6
return rc;
}
break;
#ifdef CONFIG_UDEBUG
case IPC_M_DEBUG_ALL:
return udebug_request_preprocess(call, phone);
#endif
default:
break;
}
375,7 → 369,6
 
if (call->buffer) {
/* This must be an affirmative answer to IPC_M_DATA_READ. */
/* or IPC_M_DEBUG_ALL/UDEBUG_M_MEM_READ... */
uintptr_t dst = IPC_GET_ARG1(call->data);
size_t size = IPC_GET_ARG2(call->data);
int rc = copy_to_uspace((void *) dst, call->buffer, size);
406,13 → 399,7
return -1;
}
IPC_SET_ARG5(call->data, phoneid);
}
switch (IPC_GET_METHOD(call->data)) {
case IPC_M_DEBUG_ALL:
return -1;
default:
break;
}
}
return 0;
}
 
454,7 → 441,7
IPC_SET_ARG4(call.data, 0);
IPC_SET_ARG5(call.data, 0);
 
if (!(res = request_preprocess(&call, phone))) {
if (!(res = request_preprocess(&call))) {
rc = ipc_call_sync(phone, &call);
if (rc != EOK)
return rc;
494,7 → 481,7
 
GET_CHECK_PHONE(phone, phoneid, return ENOENT);
 
if (!(res = request_preprocess(&call, phone))) {
if (!(res = request_preprocess(&call))) {
rc = ipc_call_sync(phone, &call);
if (rc != EOK)
return rc;
563,7 → 550,7
*/
IPC_SET_ARG5(call->data, 0);
 
if (!(res = request_preprocess(call, phone)))
if (!(res = request_preprocess(call)))
ipc_call(phone, call);
else
ipc_backsend_err(phone, call, res);
597,7 → 584,7
ipc_call_free(call);
return (unative_t) rc;
}
if (!(res = request_preprocess(call, phone)))
if (!(res = request_preprocess(call)))
ipc_call(phone, call);
else
ipc_backsend_err(phone, call, res);
881,30 → 868,5
return 0;
}
 
#include <console/console.h>
 
/**
* Syscall connect to a task by id.
*
* @return Phone id on success, or negative error code.
*/
unative_t sys_ipc_connect_kbox(sysarg64_t *uspace_taskid_arg)
{
#ifdef CONFIG_UDEBUG
sysarg64_t taskid_arg;
int rc;
rc = copy_from_uspace(&taskid_arg, uspace_taskid_arg, sizeof(sysarg64_t));
if (rc != 0)
return (unative_t) rc;
 
LOG("sys_ipc_connect_kbox(%" PRIu64 ")\n", taskid_arg.value);
 
return ipc_connect_kbox(taskid_arg.value);
#else
return (unative_t) ENOTSUP;
#endif
}
 
/** @}
*/
/branches/dynload/kernel/generic/src/ipc/ipc.c
43,7 → 43,6
#include <synch/waitq.h>
#include <synch/synch.h>
#include <ipc/ipc.h>
#include <ipc/kbox.h>
#include <errno.h>
#include <mm/slab.h>
#include <arch.h>
52,7 → 51,6
#include <debug.h>
 
#include <print.h>
#include <console/console.h>
#include <proc/thread.h>
#include <arch/interrupt.h>
#include <ipc/irq.h>
429,7 → 427,7
*
* @param lst Head of the list to be cleaned up.
*/
void ipc_cleanup_call_list(link_t *lst)
static void ipc_cleanup_call_list(link_t *lst)
{
call_t *call;
 
444,31 → 442,33
}
}
 
/** Disconnects all phones connected to an answerbox.
/** Cleans up all IPC communication of the current task.
*
* @param box Answerbox to disconnect phones from.
* @param notify_box If true, the answerbox will get a hangup message for
* each disconnected phone.
* Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
* have to change it as well if you want to cleanup other tasks than TASK.
*/
void ipc_answerbox_slam_phones(answerbox_t *box, bool notify_box)
void ipc_cleanup(void)
{
int i;
call_t *call;
phone_t *phone;
DEADLOCK_PROBE_INIT(p_phonelck);
ipl_t ipl;
call_t *call;
 
call = notify_box ? ipc_call_alloc(0) : NULL;
/* Disconnect all our phones ('ipc_phone_hangup') */
for (i = 0; i < IPC_MAX_PHONES; i++)
ipc_phone_hangup(&TASK->phones[i]);
 
/* Disconnect all connected irqs */
ipc_irq_cleanup(&TASK->answerbox);
 
/* Disconnect all phones connected to our answerbox */
restart_phones:
ipl = interrupts_disable();
spinlock_lock(&box->lock);
while (!list_empty(&box->connected_phones)) {
phone = list_get_instance(box->connected_phones.next,
spinlock_lock(&TASK->answerbox.lock);
while (!list_empty(&TASK->answerbox.connected_phones)) {
phone = list_get_instance(TASK->answerbox.connected_phones.next,
phone_t, link);
if (SYNCH_FAILED(mutex_trylock(&phone->lock))) {
spinlock_unlock(&box->lock);
interrupts_restore(ipl);
spinlock_unlock(&TASK->answerbox.lock);
DEADLOCK_PROBE(p_phonelck, DEADLOCK_THRESHOLD);
goto restart_phones;
}
475,69 → 475,13
/* Disconnect phone */
ASSERT(phone->state == IPC_PHONE_CONNECTED);
 
phone->state = IPC_PHONE_SLAMMED;
list_remove(&phone->link);
phone->state = IPC_PHONE_SLAMMED;
 
if (notify_box) {
mutex_unlock(&phone->lock);
spinlock_unlock(&box->lock);
interrupts_restore(ipl);
 
/*
* Send one message to the answerbox for each
* phone. Used to make sure the kbox thread
* wakes up after the last phone has been
* disconnected.
*/
IPC_SET_METHOD(call->data, IPC_M_PHONE_HUNGUP);
call->flags |= IPC_CALL_DISCARD_ANSWER;
_ipc_call(phone, box, call);
 
/* Allocate another call in advance */
call = ipc_call_alloc(0);
 
/* Must start again */
goto restart_phones;
}
 
mutex_unlock(&phone->lock);
}
 
spinlock_unlock(&box->lock);
interrupts_restore(ipl);
 
/* Free unused call */
if (call) ipc_call_free(call);
}
 
/** Cleans up all IPC communication of the current task.
*
* Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
* have to change it as well if you want to cleanup other tasks than TASK.
*/
void ipc_cleanup(void)
{
int i;
call_t *call;
 
/* Disconnect all our phones ('ipc_phone_hangup') */
for (i = 0; i < IPC_MAX_PHONES; i++)
ipc_phone_hangup(&TASK->phones[i]);
 
/* Disconnect all connected irqs */
ipc_irq_cleanup(&TASK->answerbox);
 
/* Disconnect all phones connected to our regular answerbox */
ipc_answerbox_slam_phones(&TASK->answerbox, false);
 
#ifdef CONFIG_UDEBUG
/* Clean up kbox thread and communications */
ipc_kbox_cleanup();
#endif
 
/* Answer all messages in 'calls' and 'dispatched_calls' queues */
spinlock_lock(&TASK->answerbox.lock);
ipc_cleanup_call_list(&TASK->answerbox.dispatched_calls);
ipc_cleanup_call_list(&TASK->answerbox.calls);
spinlock_unlock(&TASK->answerbox.lock);
/branches/dynload/kernel/generic/src/syscall/syscall.c
53,7 → 53,6
#include <syscall/copy.h>
#include <sysinfo/sysinfo.h>
#include <console/console.h>
#include <udebug/udebug.h>
 
/** Print using kernel facility
*
109,16 → 108,9
{
unative_t rc;
 
#ifdef CONFIG_UDEBUG
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, 0, false);
#endif
 
if (id < SYSCALL_END) {
#ifdef CONFIG_UDEBUG
udebug_stoppable_begin();
#endif
if (id < SYSCALL_END)
rc = syscall_table[id](a1, a2, a3, a4, a5, a6);
} else {
else {
printf("Task %" PRIu64": Unknown syscall %#" PRIxn, TASK->taskid, id);
task_kill(TASK->taskid);
thread_exit();
126,11 → 118,6
if (THREAD->interrupted)
thread_exit();
 
#ifdef CONFIG_UDEBUG
udebug_syscall_event(a1, a2, a3, a4, a5, a6, id, rc, true);
udebug_stoppable_end();
#endif
return rc;
}
186,9 → 173,7
/* Debug calls */
(syshandler_t) sys_debug_putint,
(syshandler_t) sys_debug_enable_console,
 
(syshandler_t) sys_ipc_connect_kbox
(syshandler_t) sys_debug_enable_console
};
 
/** @}
/branches/dynload/kernel/generic/include/udebug/udebug.h
File deleted
/branches/dynload/kernel/generic/include/udebug/udebug_ops.h
File deleted
/branches/dynload/kernel/generic/include/udebug/udebug_ipc.h
File deleted
/branches/dynload/kernel/generic/include/ipc/kbox.h
File deleted
/branches/dynload/kernel/generic/include/ipc/ipc.h
195,12 → 195,6
*/
#define IPC_M_DATA_READ 7
 
/** Debug the recipient.
* - ARG1 - specifies the debug method (from udebug_method_t)
* - other arguments are specific to the debug method
*/
#define IPC_M_DEBUG_ALL 8
 
/* Well-known methods */
#define IPC_M_LAST_SYSTEM 511
#define IPC_M_PING 512
313,8 → 307,6
extern int ipc_phone_hangup(phone_t *);
extern void ipc_backsend_err(phone_t *, call_t *, unative_t);
extern void ipc_print_task(task_id_t);
extern void ipc_answerbox_slam_phones(answerbox_t *, bool);
extern void ipc_cleanup_call_list(link_t *);
 
extern answerbox_t *ipc_phone_0;
 
/branches/dynload/kernel/generic/include/ipc/sysipc.h
57,7 → 57,6
unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
irq_code_t *ucode);
unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
unative_t sys_ipc_connect_kbox(sysarg64_t *task_id);
 
#endif
 
/branches/dynload/kernel/generic/include/syscall/syscall.h
79,7 → 79,7
 
SYS_DEBUG_PUTINT,
SYS_DEBUG_ENABLE_CONSOLE,
SYS_IPC_CONNECT_KBOX,
 
SYSCALL_END
} syscall_t;
 
/branches/dynload/kernel/generic/include/proc/task.h
52,7 → 52,6
#include <arch/cpu.h>
#include <mm/tlb.h>
#include <proc/scheduler.h>
#include <udebug/udebug.h>
 
struct thread;
 
94,20 → 93,6
* certain extent.
*/
atomic_t active_calls;
 
#ifdef CONFIG_UDEBUG
/** Debugging stuff */
udebug_task_t udebug;
 
/** Kernel answerbox */
answerbox_t kernel_box;
/** Thread used to service kernel answerbox */
struct thread *kb_thread;
/** Kbox thread creation vs. begin of cleanup mutual exclusion */
mutex_t kb_cleanup_lock;
/** True if cleanup of kbox has already started */
bool kb_finished;
#endif
/** Architecture specific task data. */
task_arch_t arch;
/branches/dynload/kernel/generic/include/proc/thread.h
46,7 → 46,6
#include <arch/cpu.h>
#include <mm/tlb.h>
#include <proc/uarg.h>
#include <udebug/udebug.h>
 
#define THREAD_STACK_SIZE STACK_SIZE
#define THREAD_NAME_BUFLEN 20
204,12 → 203,6
 
/** Thread's kernel stack. */
uint8_t *kstack;
 
#ifdef CONFIG_UDEBUG
/** Debugging stuff */
udebug_thread_t udebug;
#endif
 
} thread_t;
 
/** Thread list lock.
/branches/dynload/kernel/arch/arm32/include/interrupt.h
37,7 → 37,6
#define KERN_arm32_INTERRUPT_H_
 
#include <arch/types.h>
#include <arch/exception.h>
 
/** Initial size of exception dispatch table. */
#define IVT_ITEMS 6
/branches/dynload/kernel/kernel.config
144,8 → 144,6
# Virtually indexed D-cache support
! [ARCH=sparc64] CONFIG_VIRT_IDX_DCACHE (y/n)
 
# Support for userspace debuggers
! CONFIG_UDEBUG (n/y)
 
## Debugging configuration directives
 
/branches/dynload/kernel/Makefile
150,10 → 150,6
endif
endif
 
ifeq ($(CONFIG_UDEBUG),y)
DEFS += -DCONFIG_UDEBUG
endif
 
## Simple detection for the type of the host system
#
HOST = $(shell uname)
287,17 → 283,6
generic/src/security/cap.c \
generic/src/sysinfo/sysinfo.c
 
## Udebug interface sources
#
 
ifeq ($(CONFIG_UDEBUG),y)
GENERIC_SOURCES += \
generic/src/ipc/kbox.c \
generic/src/udebug/udebug.c \
generic/src/udebug/udebug_ops.c \
generic/src/udebug/udebug_ipc.c
endif
 
## Test sources
#
 
/branches/dynload/boot/arch/sparc64/loader/Makefile
94,14 → 94,12
COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
endif
 
RD_SRVS = \
RD_TASKS = \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \
$(USPACEDIR)/srv/console/console \
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/fs/fat/fat
 
RD_APPS = \
$(USPACEDIR)/srv/fs/fat/fat \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/bdsh/bdsh \
123,21 → 121,15
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-for file in $(RD_SRVS) ; do \
rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-for file in $(RD_APPS) ; do \
rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
done
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) initrd.img image.boot image.map image.disasm Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
for file in $(RD_SRVS) ; do \
cp $$file $(USPACEDIR)/dist/srv/ ; \
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_TASKS) _link.ld.in
for task in $(RD_TASKS) ; do \
cp $$task $(USPACEDIR)/dist/sbin/ ; \
done
for file in $(RD_APPS) ; do \
cp $$file $(USPACEDIR)/dist/app/ ; \
done
ifeq ($(RDFMT),tmpfs)
../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
endif
/branches/dynload/boot/arch/ia64/loader/Makefile
98,7 → 98,6
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/devmap/devmap \
$(USPACEDIR)/app/cli/cli \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/klog/klog
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
/branches/dynload/boot/arch/arm32/loader/Makefile
96,17 → 96,14
COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
endif
 
RD_SRVS = \
RD_TASKS = \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \
$(USPACEDIR)/srv/console/console \
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/fs/fat/fat
 
RD_APPS = \
$(USPACEDIR)/srv/fs/fat/fat \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/klog/klog \
$(USPACEDIR)/app/bdsh/bdsh
 
126,21 → 123,15
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-for file in $(RD_SRVS) ; do \
rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-for file in $(RD_APPS) ; do \
rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
done
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
for file in $(RD_SRVS) ; do \
cp $$file $(USPACEDIR)/dist/srv/ ; \
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) _link.ld.in
for task in $(RD_TASKS) ; do \
cp $$task $(USPACEDIR)/dist/sbin/ ; \
done
for file in $(RD_APPS) ; do \
cp $$file $(USPACEDIR)/dist/app/ ; \
done
ifeq ($(RDFMT),tmpfs)
../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
endif
/branches/dynload/boot/arch/ppc32/loader/Makefile
91,18 → 91,15
COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
endif
 
RD_SRVS = \
RD_TASKS = \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \
$(USPACEDIR)/srv/console/console \
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/fs/fat/fat
 
RD_APPS = \
$(USPACEDIR)/srv/fs/fat/fat \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/dltest/dltest \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/klog/klog \
$(USPACEDIR)/app/bdsh/bdsh
 
126,27 → 123,21
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-for file in $(RD_SRVS) ; do \
rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-for lib in $(RD_LIBS) ; do \
rm -f $(USPACEDIR)/dist/lib/`basename $$lib` ; \
done
-for file in $(RD_APPS) ; do \
rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
done
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_LIBS) $(RD_APPS) _link.ld.in
for file in $(RD_SRVS) ; do \
cp $$file $(USPACEDIR)/dist/srv/ ; \
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_TASKS) $(RD_LIBS) _link.ld.in
for task in $(RD_TASKS) ; do \
cp $$task $(USPACEDIR)/dist/sbin/ ; \
done
for lib in $(RD_LIBS) ; do \
cp $$lib $(USPACEDIR)/dist/lib/ ; \
done
for file in $(RD_APPS) ; do \
cp $$file $(USPACEDIR)/dist/app/ ; \
done
ifeq ($(RDFMT),tmpfs)
../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
endif
/branches/dynload/boot/arch/amd64/Makefile.inc
40,24 → 40,21
INIT_TASKS += $(USPACEDIR)/srv/fs/fat/fat
endif
 
RD_SRVS = \
RD_TASKS = \
$(USPACEDIR)/srv/pci/pci \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \
$(USPACEDIR)/srv/console/console \
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/fs/fat/fat
 
RD_APPS = \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/klog/klog \
$(USPACEDIR)/app/bdsh/bdsh
$(USPACEDIR)/app/bdsh/bdsh \
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/fs/fat/fat
 
build: $(BASE)/image.iso
 
$(BASE)/image.iso: arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_APPS)
$(BASE)/image.iso: arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_TASKS)
mkdir -p arch/$(ARCH)/iso/boot/grub
cp arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/iso/boot/grub/
ifneq ($(RDFMT),tmpfs)
70,12 → 67,9
for task in $(INIT_TASKS) ; do \
cp $$task arch/$(ARCH)/iso/boot/ ; \
done
for file in $(RD_SRVS) ; do \
cp $$file $(USPACEDIR)/dist/srv/ ; \
for task in $(RD_TASKS) ; do \
cp $$task $(USPACEDIR)/dist/sbin/ ; \
done
for file in $(RD_APPS) ; do \
cp $$file $(USPACEDIR)/dist/app/ ; \
done
ifeq ($(RDFMT),tmpfs)
$(BASE)/tools/mktmpfs.py $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.fs
endif
87,11 → 81,8
mkisofs -J -r -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $(BASE)/image.iso arch/$(ARCH)/iso/
 
clean:
-for file in $(RD_SRVS) ; do \
rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-for file in $(RD_APPS) ; do \
rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
done
-rm -fr arch/$(ARCH)/iso
-rm -f $(BASE)/image.iso
/branches/dynload/boot/arch/ppc64/loader/Makefile
89,7 → 89,6
$(USPACEDIR)/app/init/init \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/klog/klog
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
/branches/dynload/boot/arch/mips32/loader/Makefile
96,20 → 96,18
COMPONENTS += $(USPACEDIR)/srv/fs/fat/fat
endif
 
RD_SRVS = \
RD_TASKS = \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \
$(USPACEDIR)/srv/console/console \
$(USPACEDIR)/srv/fs/tmpfs/tmpfs \
$(USPACEDIR)/srv/fs/fat/fat
 
RD_APPS = \
$(USPACEDIR)/srv/fs/fat/fat \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/bdsh/bdsh \
$(USPACEDIR)/app/klog/klog
 
 
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
 
126,21 → 124,15
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-for file in $(RD_SRVS) ; do \
rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-for file in $(RD_APPS) ; do \
rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
done
-rm -f _components.h _components.c _link.ld _link.ld.in $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in
for file in $(RD_SRVS) ; do \
cp $$file $(USPACEDIR)/dist/srv/ ; \
_components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) _link.ld.in
for task in $(RD_TASKS) ; do \
cp $$task $(USPACEDIR)/dist/sbin/ ; \
done
for file in $(RD_APPS) ; do \
cp $$file $(USPACEDIR)/dist/app/ ; \
done
ifeq ($(RDFMT),tmpfs)
../../../../tools/mktmpfs.py $(USPACEDIR)/dist/ initrd.fs
endif
/branches/dynload/boot/arch/ia32/Makefile.inc
40,18 → 40,15
INIT_TASKS += $(USPACEDIR)/srv/fs/fat/fat
endif
 
RD_SRVS = \
RD_TASKS = \
$(USPACEDIR)/srv/pci/pci \
$(USPACEDIR)/srv/fb/fb \
$(USPACEDIR)/srv/kbd/kbd \
$(USPACEDIR)/srv/console/console \
$(USPACEDIR)/srv/fs/fat/fat
 
RD_APPS = \
$(USPACEDIR)/srv/fs/fat/fat \
$(USPACEDIR)/app/tetris/tetris \
$(USPACEDIR)/app/tester/tester \
$(USPACEDIR)/app/dltest/dltest \
$(USPACEDIR)/app/trace/trace \
$(USPACEDIR)/app/klog/klog \
$(USPACEDIR)/app/bdsh/bdsh
 
61,7 → 58,7
 
build: $(BASE)/image.iso
 
$(BASE)/image.iso: arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_LIBS) $(RD_APPS)
$(BASE)/image.iso: arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_TASKS) $(RD_LIBS)
mkdir -p arch/$(ARCH)/iso/boot/grub
cp arch/$(ARCH)/grub/stage2_eltorito arch/$(ARCH)/iso/boot/grub/
ifneq ($(RDFMT),tmpfs)
74,15 → 71,12
for task in $(INIT_TASKS) ; do \
cp $$task arch/$(ARCH)/iso/boot/ ; \
done
for file in $(RD_SRVS) ; do \
cp $$file $(USPACEDIR)/dist/srv/ ; \
for task in $(RD_TASKS) ; do \
cp $$task $(USPACEDIR)/dist/sbin/ ; \
done
for lib in $(RD_LIBS) ; do \
cp $$lib $(USPACEDIR)/dist/lib/ ; \
done
for file in $(RD_APPS) ; do \
cp $$file $(USPACEDIR)/dist/app/ ; \
done
ifeq ($(RDFMT),tmpfs)
$(BASE)/tools/mktmpfs.py $(USPACEDIR)/dist/ arch/$(ARCH)/iso/boot/initrd.fs
endif
94,14 → 88,11
mkisofs -J -r -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -o $(BASE)/image.iso arch/$(ARCH)/iso/
 
clean:
-for file in $(RD_SRVS) ; do \
rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \
-for task in $(RD_TASKS) ; do \
rm -f $(USPACEDIR)/dist/sbin/`basename $$task` ; \
done
-for lib in $(RD_LIBS) ; do \
rm -f $(USPACEDIR)/dist/lib/`basename $$lib` ; \
done
-for file in $(RD_APPS) ; do \
rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \
done
-rm -fr arch/$(ARCH)/iso
-rm -f $(BASE)/image.iso