Changeset 86d05fae in mainline
- Timestamp:
- 2006-03-24T11:05:41Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4f2c821
- Parents:
- a71d9af9
- Files:
-
- 5 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
init/init.c
ra71d9af9 r86d05fae 275 275 version_print(); 276 276 277 / * test_printf(); */277 // test_printf(); 278 278 // test_ping(); 279 279 // test_async_ipc(); … … 289 289 printf("Futex failed.\n"); 290 290 291 if ((tid = thread_create(utest, NULL, "utest") != -1)) { 291 if (futex_down(&ftx) < 0) 292 printf("Futex failed.\n"); 293 294 if ((tid = thread_create(utest, NULL, "utest")) != -1) { 292 295 printf("Created thread tid=%d\n", tid); 293 296 } 294 297 295 if (futex_down(&ftx) < 0) 296 printf("Futex failed.\n"); 297 298 if ((tid = thread_create(utest, NULL, "utest") != -1)) { 298 if ((tid = thread_create(utest, NULL, "utest")) != -1) { 299 299 printf("Created thread tid=%d\n", tid); 300 300 } … … 302 302 int i; 303 303 304 for (i = 0; i < 10000000; i++)304 for (i = 0; i < 50000000; i++) 305 305 ; 306 306 … … 309 309 310 310 ptid = psthread_create(ptest, NULL); 311 printf(" Main thread-1\n");312 ps_preempt(); 313 printf(" Main thread-2\n");311 printf("main thread-1\n"); 312 ps_preempt(); 313 printf("main thread-2\n"); 314 314 ps_preempt(); 315 315 printf("main thread-3\n"); -
libc/arch/ia64/Makefile.inc
ra71d9af9 r86d05fae 36 36 AFLAGS += 37 37 38 ARCH_SOURCES += arch/$(ARCH)/src/syscall.S 38 ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \ 39 arch/$(ARCH)/src/psthread.S -
libc/generic/psthread.c
ra71d9af9 r86d05fae 33 33 #include <thread.h> 34 34 #include <stdio.h> 35 #include <kernel/arch/faddr.h> 35 36 36 37 static LIST_INITIALIZE(ready_list); 38 39 static void ps_exit(void) __attribute__ ((noinline)); 37 40 38 41 /** Function to preempt to other thread without adding 39 42 * currently running thread to runqueue 40 43 */ 41 staticvoid ps_exit(void)44 void ps_exit(void) 42 45 { 43 46 psthread_data_t *pt; … … 88 91 int ps_join(pstid_t psthrid) 89 92 { 90 psthread_data_t *pt, *mypt;91 int retval;93 volatile psthread_data_t *pt, *mypt; 94 volatile int retval; 92 95 93 96 /* Handle psthrid = Kernel address -> it is wait for call */ … … 97 100 if (!pt->finished) { 98 101 mypt = __tls_get(); 99 if (context_save(& mypt->ctx)) {100 pt->waiter = mypt;102 if (context_save(&((psthread_data_t *) mypt)->ctx)) { 103 pt->waiter = (psthread_data_t *) mypt; 101 104 ps_exit(); 102 105 } … … 105 108 106 109 free(pt->stack); 107 __free_tls( pt);110 __free_tls((psthread_data_t *) pt); 108 111 109 112 return retval; … … 131 134 132 135 context_save(&pt->ctx); 133 context_set(&pt->ctx, psthread_main, pt->stack, getpagesize(), pt);136 context_set(&pt->ctx, FADDR(psthread_main), pt->stack, getpagesize(), pt); 134 137 135 138 list_append(&pt->list, &ready_list); -
libc/include/psthread.h
ra71d9af9 r86d05fae 34 34 35 35 #ifndef context_set 36 #define context_set(c, _pc, stack, size, ptls) \37 (c)->pc = (sysarg_t) (_pc); \38 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \36 #define context_set(c, _pc, stack, size, ptls) \ 37 (c)->pc = (sysarg_t) (_pc); \ 38 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 39 39 (c)->tls = (sysarg_t) (ptls); 40 40 #endif /* context_set */ … … 43 43 44 44 struct psthread_data { 45 struct psthread_data *self; /* IA32,AMD64 needs to get self address */45 struct psthread_data *self; /* ia32, amd64 needs to get self address */ 46 46 47 47 link_t list; -
libc/include/stdarg.h
ra71d9af9 r86d05fae 45 45 46 46 #endif 47 -
libc/include/stdlib.h
ra71d9af9 r86d05fae 30 30 #define __LIBC__STDLIB_H__ 31 31 32 #include <unistd.h> 32 33 #include <malloc.h> 33 34
Note:
See TracChangeset
for help on using the changeset viewer.