/uspace/trunk/libc/arch/ia32/Makefile.inc |
---|
35,4 → 35,4 |
ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \ |
arch/$(ARCH)/src/psthread.S |
LFLAGS += -N |
LFLAGS += -N |
/uspace/trunk/libc/arch/ia64/include/psthread.h |
---|
File deleted |
/uspace/trunk/libc/arch/ia64/include/stack.h |
---|
File deleted |
/uspace/trunk/libc/arch/ia64/include/thread.h |
---|
File deleted |
/uspace/trunk/libc/arch/ia64/src/psthread.S |
---|
File deleted |
/uspace/trunk/libc/arch/ia64/Makefile.inc |
---|
35,5 → 35,4 |
LFLAGS += -N ../softint/softint.a |
AFLAGS += |
ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \ |
arch/$(ARCH)/src/psthread.S |
ARCH_SOURCES += arch/$(ARCH)/src/syscall.S |
/uspace/trunk/libc/arch/amd64/Makefile.inc |
---|
35,4 → 35,4 |
ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \ |
arch/$(ARCH)/src/psthread.S |
LFLAGS += -N |
LFLAGS += -N |
/uspace/trunk/libc/include/align.h |
---|
File deleted |
/uspace/trunk/libc/include/psthread.h |
---|
33,9 → 33,9 |
#include <libadt/list.h> |
#ifndef context_set |
#define context_set(c, _pc, stack, size, ptls) \ |
(c)->pc = (sysarg_t) (_pc); \ |
(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ |
#define context_set(c, _pc, stack, size, ptls) \ |
(c)->pc = (sysarg_t) (_pc); \ |
(c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ |
(c)->tls = (sysarg_t) (ptls); |
#endif /* context_set */ |
42,7 → 42,7 |
typedef sysarg_t pstid_t; |
struct psthread_data { |
struct psthread_data *self; /* ia32, amd64 needs to get self address */ |
struct psthread_data *self; /* IA32,AMD64 needs to get self address */ |
link_t list; |
context_t ctx; |
/uspace/trunk/libc/include/stdarg.h |
---|
44,4 → 44,3 |
# endif |
#endif |
/uspace/trunk/libc/include/stdlib.h |
---|
29,7 → 29,6 |
#ifndef __LIBC__STDLIB_H__ |
#define __LIBC__STDLIB_H__ |
#include <unistd.h> |
#include <malloc.h> |
#define abort() _exit(1) |
/uspace/trunk/libc/generic/psthread.c |
---|
32,16 → 32,13 |
#include <unistd.h> |
#include <thread.h> |
#include <stdio.h> |
#include <kernel/arch/faddr.h> |
static LIST_INITIALIZE(ready_list); |
static void ps_exit(void) __attribute__ ((noinline)); |
/** Function to preempt to other thread without adding |
* currently running thread to runqueue |
*/ |
void ps_exit(void) |
static void ps_exit(void) |
{ |
psthread_data_t *pt; |
90,8 → 87,8 |
/** Wait for uspace thread to finish */ |
int ps_join(pstid_t psthrid) |
{ |
volatile psthread_data_t *pt, *mypt; |
volatile int retval; |
psthread_data_t *pt, *mypt; |
int retval; |
/* Handle psthrid = Kernel address -> it is wait for call */ |
99,8 → 96,8 |
if (!pt->finished) { |
mypt = __tls_get(); |
if (context_save(&((psthread_data_t *) mypt)->ctx)) { |
pt->waiter = (psthread_data_t *) mypt; |
if (context_save(&mypt->ctx)) { |
pt->waiter = mypt; |
ps_exit(); |
} |
} |
107,7 → 104,7 |
retval = pt->retval; |
free(pt->stack); |
__free_tls((psthread_data_t *) pt); |
__free_tls(pt); |
return retval; |
} |
133,7 → 130,7 |
pt->waiter = NULL; |
context_save(&pt->ctx); |
context_set(&pt->ctx, FADDR(psthread_main), pt->stack, getpagesize(), pt); |
context_set(&pt->ctx, psthread_main, pt->stack, getpagesize(), pt); |
list_append(&pt->list, &ready_list); |
/uspace/trunk/init/init.c |
---|
274,7 → 274,7 |
version_print(); |
// test_printf(); |
/* test_printf(); */ |
// test_ping(); |
// test_async_ipc(); |
// test_advanced_ipc(); |
288,20 → 288,20 |
if (futex_up(&ftx) < 0) |
printf("Futex failed.\n"); |
if ((tid = thread_create(utest, NULL, "utest") != -1)) { |
printf("Created thread tid=%d\n", tid); |
} |
if (futex_down(&ftx) < 0) |
printf("Futex failed.\n"); |
if ((tid = thread_create(utest, NULL, "utest")) != -1) { |
if ((tid = thread_create(utest, NULL, "utest") != -1)) { |
printf("Created thread tid=%d\n", tid); |
} |
if ((tid = thread_create(utest, NULL, "utest")) != -1) { |
printf("Created thread tid=%d\n", tid); |
} |
int i; |
for (i = 0; i < 50000000; i++) |
for (i = 0; i < 10000000; i++) |
; |
if (futex_up(&ftx) < 0) |
308,9 → 308,9 |
printf("Futex failed.\n"); |
ptid = psthread_create(ptest, NULL); |
printf("main thread-1\n"); |
printf("Main thread-1\n"); |
ps_preempt(); |
printf("main thread-2\n"); |
printf("Main thread-2\n"); |
ps_preempt(); |
printf("main thread-3\n"); |