/branches/dynload/uspace/lib/libc/Makefile |
---|
30,8 → 30,6 |
## Common compiler flags |
# |
include ../../Makefile.config |
LIBC_PREFIX = $(shell pwd) |
SOFTINT_PREFIX = ../softint |
CONSOLE_PREFIX = ../../srv/console |
/branches/dynload/uspace/lib/libc/include/loader/loader.h |
---|
44,7 → 44,7 |
int phone_id; |
} loader_t; |
extern loader_t *loader_spawn(char *name); |
extern loader_t *loader_spawn(void); |
extern int loader_get_task_id(loader_t *, task_id_t *); |
extern int loader_set_pathname(loader_t *, const char *); |
extern int loader_set_args(loader_t *, char *const []); |
/branches/dynload/uspace/lib/libc/generic/loader.c |
---|
46,11 → 46,10 |
/** Connect to a new program loader. |
* |
* Spawns a new program loader task and returns the connection structure. |
* @param name Symbolic name to set on the newly created task. |
* @return Pointer to the loader connection structure (should be |
* de-allocated using free() after use). |
*/ |
loader_t *loader_spawn(char *name) |
loader_t *loader_spawn(void) |
{ |
int phone_id, rc; |
loader_t *ldr; |
58,8 → 57,7 |
/* |
* Ask kernel to spawn a new loader task. |
*/ |
rc = __SYSCALL3(SYS_PROGRAM_SPAWN_LOADER, (sysarg_t) &phone_id, |
(sysarg_t) name, strlen(name)); |
rc = __SYSCALL1(SYS_PROGRAM_SPAWN_LOADER, (sysarg_t) &phone_id); |
if (rc != 0) |
return NULL; |
/branches/dynload/uspace/lib/libc/generic/task.c |
---|
64,7 → 64,7 |
int rc; |
/* Spawn a program loader. */ |
ldr = loader_spawn(path); |
ldr = loader_spawn(); |
if (ldr == NULL) |
return 0; |
/branches/dynload/uspace/lib/libc/generic/thread.c |
---|
108,8 → 108,8 |
uarg->uspace_thread_arg = arg; |
uarg->uspace_uarg = uarg; |
rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, |
(sysarg_t) strlen(name), (sysarg_t) tid); |
rc = __SYSCALL3(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name, |
(sysarg_t) tid); |
if (rc) { |
/* |
/branches/dynload/uspace/lib/libblock/Makefile |
---|
30,8 → 30,6 |
## Common compiler flags |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../libc |
## Setup toolchain |
# |
/branches/dynload/uspace/lib/libfs/Makefile |
---|
30,8 → 30,6 |
## Common compiler flags |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../libc |
## Setup toolchain |
# |
/branches/dynload/uspace/lib/softfloat/Makefile |
---|
29,8 → 29,6 |
## Common compiler flags |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../libc |
## Setup toolchain |
# |
/branches/dynload/uspace/lib/softint/Makefile |
---|
30,8 → 30,6 |
## Common compiler flags |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../libc |
## Setup toolchain |
# |
/branches/dynload/uspace/app/tester/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
/branches/dynload/uspace/app/tetris/Makefile |
---|
1,5 → 1,3 |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
/branches/dynload/uspace/app/klog/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
/branches/dynload/uspace/app/trace/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
/branches/dynload/uspace/app/trace/trace.c |
---|
516,7 → 516,7 |
int rc; |
/* Spawn a program loader */ |
ldr = loader_spawn(path); |
ldr = loader_spawn(); |
if (ldr == NULL) |
return 0; |
/branches/dynload/uspace/srv/kbd/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
/branches/dynload/uspace/srv/pci/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
RTLD_PREFIX = ../../lib/rtld |
/branches/dynload/uspace/srv/loader/Makefile |
---|
27,6 → 27,7 |
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
# |
include ../../../version |
include ../../Makefile.config |
## Setup toolchain |
/branches/dynload/uspace/srv/fs/tmpfs/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../../Makefile.config |
LIBC_PREFIX = ../../../lib/libc |
LIBFS_PREFIX = ../../../lib/libfs |
LIBBLOCK_PREFIX = ../../../lib/libblock |
/branches/dynload/uspace/srv/fs/fat/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../../Makefile.config |
LIBC_PREFIX = ../../../lib/libc |
LIBFS_PREFIX = ../../../lib/libfs |
LIBBLOCK_PREFIX = ../../../lib/libblock |
/branches/dynload/uspace/srv/vfs/Makefile |
---|
30,8 → 30,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
/branches/dynload/uspace/srv/rd/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
/branches/dynload/uspace/srv/fb/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
/branches/dynload/uspace/srv/ns/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
/branches/dynload/uspace/srv/console/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
/branches/dynload/uspace/srv/devmap/Makefile |
---|
29,8 → 29,6 |
## Setup toolchain |
# |
include ../../Makefile.config |
LIBC_PREFIX = ../../lib/libc |
SOFTINT_PREFIX = ../../lib/softint |
include $(LIBC_PREFIX)/Makefile.toolchain |
/branches/dynload/uspace/Makefile |
---|
95,7 → 95,7 |
-rm Makefile.config |
$(CLEANS): |
-$(MAKE) -C $(basename $@) clean |
-$(MAKE) -C $(basename $@) clean ARCH=$(ARCH) |
$(BUILDS): |
$(MAKE) -C $(basename $@) all |
$(MAKE) -C $(basename $@) all ARCH=$(ARCH) COMPILER=$(COMPILER) |
/branches/dynload/kernel/generic/include/proc/task.h |
---|
54,8 → 54,6 |
#include <proc/scheduler.h> |
#include <udebug/udebug.h> |
#define TASK_NAME_BUFLEN 20 |
struct thread; |
/** Task structure. */ |
69,8 → 67,8 |
* threads. |
*/ |
SPINLOCK_DECLARE(lock); |
char name[TASK_NAME_BUFLEN]; |
char *name; |
/** List of threads contained in this task. */ |
link_t th_head; |
/** Address space. */ |
/branches/dynload/kernel/generic/include/proc/thread.h |
---|
259,8 → 259,7 |
extern slab_cache_t *fpu_context_slab; |
/* Thread syscall prototypes. */ |
extern unative_t sys_thread_create(uspace_arg_t *uspace_uarg, |
char *uspace_name, size_t name_len, thread_id_t *uspace_thread_id); |
extern unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, thread_id_t *uspace_thread_id); |
extern unative_t sys_thread_exit(int uspace_status); |
extern unative_t sys_thread_get_id(thread_id_t *uspace_thread_id); |
/branches/dynload/kernel/generic/include/proc/program.h |
---|
52,15 → 52,12 |
extern void *program_loader; |
extern void program_create(as_t *as, uintptr_t entry_addr, char *name, |
program_t *p); |
extern int program_create_from_image(void *image_addr, char *name, |
program_t *p); |
extern int program_create_loader(program_t *p, char *name); |
extern void program_create(as_t *as, uintptr_t entry_addr, program_t *p); |
extern int program_create_from_image(void *image_addr, program_t *p); |
extern int program_create_loader(program_t *p); |
extern void program_ready(program_t *p); |
extern unative_t sys_program_spawn_loader(int *uspace_phone_id, |
char *uspace_name, size_t name_len); |
extern unative_t sys_program_spawn_loader(int *uspace_phone_id); |
#endif |
/branches/dynload/kernel/generic/src/main/kinit.c |
---|
169,7 → 169,7 |
} |
int rc = program_create_from_image((void *) init.tasks[i].addr, |
"init-bin", &programs[i]); |
&programs[i]); |
if (rc == 0 && programs[i].task != NULL) { |
/* |
/branches/dynload/kernel/generic/src/proc/task.c |
---|
130,7 → 130,7 |
/** Create new task with no threads. |
* |
* @param as Task's address space. |
* @param name Symbolic name (a copy is made). |
* @param name Symbolic name. |
* |
* @return New task's structure. |
* |
148,10 → 148,7 |
spinlock_initialize(&ta->lock, "task_ta_lock"); |
list_initialize(&ta->th_head); |
ta->as = as; |
memcpy(ta->name, name, TASK_NAME_BUFLEN); |
ta->name[TASK_NAME_BUFLEN - 1] = '\0'; |
ta->name = name; |
atomic_set(&ta->refcount, 0); |
atomic_set(&ta->lifecount, 0); |
ta->context = CONTEXT; |
/branches/dynload/kernel/generic/src/proc/thread.c |
---|
279,7 → 279,7 |
* guarantee that the task won't cease to exist during the |
* call. The task's lock may not be held. |
* @param flags Thread flags. |
* @param name Symbolic name (a copy is made). |
* @param name Symbolic name. |
* @param uncounted Thread's accounting doesn't affect accumulated task |
* accounting. |
* |
316,7 → 316,6 |
interrupts_restore(ipl); |
memcpy(t->name, name, THREAD_NAME_BUFLEN); |
t->name[THREAD_NAME_BUFLEN - 1] = '\0'; |
t->thread_code = func; |
t->thread_arg = arg; |
709,7 → 708,7 |
* |
*/ |
unative_t sys_thread_create(uspace_arg_t *uspace_uarg, char *uspace_name, |
size_t name_len, thread_id_t *uspace_thread_id) |
thread_id_t *uspace_thread_id) |
{ |
thread_t *t; |
char namebuf[THREAD_NAME_BUFLEN]; |
716,15 → 715,10 |
uspace_arg_t *kernel_uarg; |
int rc; |
if (name_len > THREAD_NAME_BUFLEN - 1) |
name_len = THREAD_NAME_BUFLEN - 1; |
rc = copy_from_uspace(namebuf, uspace_name, name_len); |
rc = copy_from_uspace(namebuf, uspace_name, THREAD_NAME_BUFLEN); |
if (rc != 0) |
return (unative_t) rc; |
namebuf[name_len] = '\0'; |
/* |
* In case of failure, kernel_uarg will be deallocated in this function. |
* In case of success, kernel_uarg will be freed in uinit(). |
/branches/dynload/kernel/generic/src/proc/program.c |
---|
66,10 → 66,9 |
* |
* @param as Address space containing a binary program image. |
* @param entry_addr Program entry-point address in program address space. |
* @param name Name to set for the program's task. |
* @param p Buffer for storing program information. |
*/ |
void program_create(as_t *as, uintptr_t entry_addr, char *name, program_t *p) |
void program_create(as_t *as, uintptr_t entry_addr, program_t *p) |
{ |
as_area_t *a; |
uspace_arg_t *kernel_uarg; |
81,7 → 80,7 |
kernel_uarg->uspace_thread_arg = NULL; |
kernel_uarg->uspace_uarg = NULL; |
p->task = task_create(as, name); |
p->task = task_create(as, "app"); |
ASSERT(p->task); |
/* |
106,7 → 105,6 |
* executable image. The task is returned in *task. |
* |
* @param image_addr Address of an executable program image. |
* @param name Name to set for the program's task. |
* @param p Buffer for storing program info. If image_addr |
* points to a loader image, p->task will be set to |
* NULL and EOK will be returned. |
113,7 → 111,7 |
* |
* @return EOK on success or negative error code. |
*/ |
int program_create_from_image(void *image_addr, char *name, program_t *p) |
int program_create_from_image(void *image_addr, program_t *p) |
{ |
as_t *as; |
unsigned int rc; |
135,7 → 133,7 |
return EOK; |
} |
program_create(as, ((elf_header_t *) image_addr)->e_entry, name, p); |
program_create(as, ((elf_header_t *) image_addr)->e_entry, p); |
return EOK; |
} |
142,12 → 140,10 |
/** Create a task from the program loader image. |
* |
* @param p Buffer for storing program info. |
* @param name Name to set for the program's task. |
* |
* @param p Buffer for storing program info. |
* @return EOK on success or negative error code. |
*/ |
int program_create_loader(program_t *p, char *name) |
int program_create_loader(program_t *p) |
{ |
as_t *as; |
unsigned int rc; |
165,8 → 161,7 |
return ENOENT; |
} |
program_create(as, ((elf_header_t *) program_loader)->e_entry, |
name, p); |
program_create(as, ((elf_header_t *) program_loader)->e_entry, p); |
return EOK; |
} |
187,20 → 182,16 |
* Creates a new task from the program loader image, connects a phone |
* to it and stores the phone id into the provided buffer. |
* |
* @param uspace_phone_id Userspace address where to store the phone id. |
* @param name Name to set on the new task (typically the same |
* as the command used to execute it). |
* @param uspace_phone_id Userspace address where to store the phone id. |
* |
* @return 0 on success or an error code from @ref errno.h. |
*/ |
unative_t sys_program_spawn_loader(int *uspace_phone_id, char *uspace_name, |
size_t name_len) |
unative_t sys_program_spawn_loader(int *uspace_phone_id) |
{ |
program_t p; |
int fake_id; |
int rc; |
int phone_id; |
char namebuf[TASK_NAME_BUFLEN]; |
fake_id = 0; |
210,26 → 201,11 |
if (rc != 0) |
return rc; |
/* Cap length of name and copy it from userspace. */ |
if (name_len > THREAD_NAME_BUFLEN - 1) |
name_len = THREAD_NAME_BUFLEN - 1; |
rc = copy_from_uspace(namebuf, uspace_name, name_len); |
if (rc != 0) |
return (unative_t) rc; |
namebuf[name_len] = '\0'; |
/* Allocate the phone for communicating with the new task. */ |
phone_id = phone_alloc(); |
if (phone_id < 0) |
return ELIMIT; |
/* Spawn the new task. */ |
rc = program_create_loader(&p, namebuf); |
rc = program_create_loader(&p); |
if (rc != 0) |
return rc; |