Changeset 29a9f62 in mainline
- Timestamp:
- 2006-03-23T10:33:55Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77bd004
- Parents:
- 1cef26f
- Files:
-
- 11 added
- 25 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r1cef26f r29a9f62 33 33 34 34 DIRS = \ 35 libc \ 35 36 softint \ 36 37 softfloat \ 37 libc \38 38 libipc \ 39 39 libadt \ -
init/init.c
r1cef26f r29a9f62 34 34 #include <ns.h> 35 35 #include <thread.h> 36 #include <psthread.h> 36 37 #include <futex.h> 37 38 … … 253 254 } 254 255 255 256 static int ptest(void *arg) 257 { 258 printf("Pseudo thread-1\n"); 259 ps_preempt(); 260 printf("Pseudo thread-2\n"); 261 ps_preempt(); 262 printf("Pseudo thread-3\n"); 263 ps_preempt(); 264 printf("Pseudo thread-4\n"); 265 ps_preempt(); 266 printf("Pseudo finish\n"); 267 return 0; 268 } 256 269 257 270 int main(int argc, char *argv[]) 258 271 { 272 pstid_t ptid; 259 273 int tid; 274 260 275 version_print(); 261 276 … … 274 289 printf("Futex failed.\n"); 275 290 291 if ((tid = thread_create(utest, NULL, "utest") != -1)) { 292 printf("Created thread tid=%d\n", tid); 293 } 294 276 295 if (futex_down(&ftx) < 0) 277 296 printf("Futex failed.\n"); … … 289 308 printf("Futex failed.\n"); 290 309 310 ptid = psthread_create(ptest, NULL); 311 printf("Main thread-1\n"); 312 ps_preempt(); 313 printf("Main thread-2\n"); 314 ps_preempt(); 315 printf("main thread-3\n"); 316 317 ps_join(ptid); 318 printf("Main exiting\n"); 319 291 320 printf("Main thread exiting.\n"); 292 321 return 0; -
libc/Makefile
r1cef26f r29a9f62 50 50 generic/io/io.c \ 51 51 generic/io/print.c \ 52 malloc/malloc.c 52 malloc/malloc.c \ 53 generic/psthread.c 53 54 54 55 ARCH_SOURCES += \ … … 66 67 ln -sfn ../../../kernel/generic/include include/kernel 67 68 ln -sfn kernel/arch include/arch 69 ln -sfn ../arch/$(ARCH)/include include/libarch 70 ln -sfn ../../libipc/include include/libipc 71 ln -sfn ../../libadt/include include/libadt 68 72 69 73 -include Makefile.depend 70 74 71 75 clean: 72 -rm -f include/kernel include/arch libc.a arch/$(ARCH)/_link.ld Makefile.depend76 -rm -f include/kernel include/arch include/libarch include/libipc include/libadt libc.a arch/$(ARCH)/_link.ld Makefile.depend 73 77 find generic/ arch/$(ARCH)/ -name '*.o' -follow -exec rm \{\} \; 74 78 75 depend: 79 depend: kerninc 76 80 $(CC) $(DEFS) $(CFLAGS) -M $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 77 81 -
libc/Makefile.toolchain
r1cef26f r29a9f62 28 28 29 29 DEFS = -DARCH=$(ARCH) 30 CFLAGS = -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include -I$(LIBC_PREFIX)/arch/$(ARCH)/include30 CFLAGS = -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -nostdlib -nostdinc -I$(LIBC_PREFIX)/include 31 31 LFLAGS = -M -N $(SOFTINT_PREFIX)/softint.a 32 32 AFLAGS = -
libc/arch/amd64/Makefile.inc
r1cef26f r29a9f62 33 33 TOOLCHAIN_DIR = /usr/local/amd64/bin 34 34 35 ARCH_SOURCES += arch/$(ARCH)/src/syscall.S 35 ARCH_SOURCES += arch/$(ARCH)/src/syscall.S \ 36 arch/$(ARCH)/src/psthread.S 36 37 37 38 LFLAGS += -N -
libc/arch/amd64/src/entry.s
r1cef26f r29a9f62 37 37 # 38 38 __entry: 39 call __main 39 40 call main 40 41 call __exit -
libc/arch/amd64/src/thread_entry.s
r1cef26f r29a9f62 39 39 # 40 40 movq %rax, %rdi 41 call thread_main41 call __thread_main 42 42 43 43 .end __thread_entry -
libc/arch/ia32/Makefile.inc
r1cef26f r29a9f62 33 33 TOOLCHAIN_DIR = /usr/local/i686/bin 34 34 35 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c 35 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \ 36 arch/$(ARCH)/src/psthread.S 36 37 37 38 LFLAGS += -N -
libc/arch/ia32/src/entry.s
r1cef26f r29a9f62 41 41 mov %ax, %es 42 42 mov %ax, %fs 43 mov %ax, %gs43 # Do not set %gs, it contains descriptor that can see TLS 44 44 45 call __main 45 46 call main 46 47 call __exit -
libc/arch/ia32/src/thread_entry.s
r1cef26f r29a9f62 39 39 mov %dx, %es 40 40 mov %dx, %fs 41 mov %dx, %gs41 # Do not set %gs, it contains descriptor that can see TLS 42 42 43 43 # … … 45 45 # 46 46 pushl %eax 47 call thread_main 48 addl $4, %esp 47 call __thread_main 49 48 50 49 # -
libc/arch/ia64/src/entry.s
r1cef26f r29a9f62 39 39 alloc loc0 = ar.pfs, 0, 1, 2, 0 40 40 mov r1 = _gp 41 { br.call.sptk.many b0 = __main } 41 42 { br.call.sptk.many b0 = main } 42 43 { br.call.sptk.many b0 = __exit } -
libc/arch/ia64/src/thread_entry.s
r1cef26f r29a9f62 44 44 45 45 mov out0 = r8 46 { br.call.sptk.many b0 = thread_main }46 { br.call.sptk.many b0 = __thread_main } 47 47 48 48 # -
libc/arch/mips32/Makefile.inc
r1cef26f r29a9f62 32 32 TARGET = mipsel-linux-gnu 33 33 TOOLCHAIN_DIR = /usr/local/mipsel/bin 34 CFLAGS += -mno-abicalls -mips3 34 CFLAGS += -mno-abicalls -mips3 -ftls-model=global-dynamic 35 35 36 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c 36 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \ 37 arch/$(ARCH)/src/psthread.S 37 38 38 39 LFLAGS += -N -
libc/arch/mips32/src/entry.s
r1cef26f r29a9f62 37 37 # 38 38 # 39 .ent __entry 39 40 __entry: 40 41 lui $28, _gp 41 42 43 # Mips o32 may store its arguments on stack, make space, 44 # so that it could work with -O0 45 addiu $sp, -16 46 47 jal __main 48 42 49 jal main 43 nop44 50 45 51 jal __exit 46 nop47 52 48 53 .end __entry -
libc/arch/mips32/src/thread_entry.s
r1cef26f r29a9f62 38 38 # 39 39 # 40 .ent __thread_entry 40 41 __thread_entry: 41 42 lui $28, _gp … … 45 46 # 46 47 add $4, $2, 0 47 jal thread_main 48 # Mips o32 may store its arguments on stack, make space 49 addiu $sp, -16 50 51 j __thread_main 48 52 nop 49 53 50 54 # 51 55 # Not reached. 52 56 # 57 .end __thread_entry -
libc/generic/libc.c
r1cef26f r29a9f62 30 30 #include <unistd.h> 31 31 #include <thread.h> 32 #include <malloc.h> 33 #include <psthread.h> 32 34 33 35 void _exit(int status) { … … 36 38 37 39 void __main(void) { 40 __tls_set(__make_tls()); 38 41 } 39 42 40 43 void __exit(void) { 44 free(__tls_get()); 45 41 46 _exit(0); 42 47 } -
libc/generic/thread.c
r1cef26f r29a9f62 32 32 #include <arch/faddr.h> 33 33 #include <kernel/proc/uarg.h> 34 #include <psthread.h> 35 36 #include <stdio.h> 37 void * __make_tls(void) 38 { 39 psthread_data_t *pt; 40 41 pt = malloc(sizeof(psthread_data_t)); 42 pt->self = pt; 43 44 return pt; 45 } 46 47 void __free_tls(void *tls) 48 { 49 free(tls); 50 } 34 51 35 52 /** Main thread function. … … 42 59 * @param uarg Pointer to userspace argument structure. 43 60 */ 44 void thread_main(uspace_arg_t *uarg)61 void __thread_main(uspace_arg_t *uarg) 45 62 { 63 /* This should initialize the area according to TLS specicification */ 64 __tls_set(__make_tls()); 65 46 66 uarg->uspace_thread_function(uarg->uspace_thread_arg); 47 67 free(uarg->uspace_stack); 48 68 free(uarg); 69 70 __free_tls(__tls_get()); 71 49 72 thread_exit(0); 50 73 } -
libc/include/atomic.h
r1cef26f r29a9f62 34 34 } atomic_t; 35 35 36 #include < atomic_arch.h>36 #include <libarch/atomic.h> 37 37 38 38 static inline void atomic_set(atomic_t *val, long i) -
libc/include/io/io.h
r1cef26f r29a9f62 30 30 #define __LIBC__IO_IO_H__ 31 31 32 #include < types.h>32 #include <libarch/types.h> 33 33 34 34 int putnchars(const char * buf, size_t count); -
libc/include/libc.h
r1cef26f r29a9f62 31 31 32 32 #include <types.h> 33 34 33 #include <kernel/syscall/syscall.h> 35 #include <kernel/arch/mm/page.h>36 34 37 35 #define __SYSCALL0(id) __syscall(0, 0, 0, 0, id) … … 40 38 #define __SYSCALL3(id, p1, p2, p3) __syscall(p1,p2,p3, 0, id) 41 39 #define __SYSCALL4(id, p1, p2, p3, p4) __syscall(p1,p2,p3,p4,id) 42 43 #define getpagesize() (PAGE_SIZE)44 40 45 41 extern void __main(void); -
libc/include/stdarg.h
r1cef26f r29a9f62 30 30 #define __LIBC__STDARG_H__ 31 31 32 #include <types.h>33 #include <stackarg.h>32 #include <types.h> 33 #include <libarch/stackarg.h> 34 34 35 35 #ifndef __VARARGS_DEFINED -
libc/include/stdint.h
r1cef26f r29a9f62 31 31 32 32 /* Definitions of types with fixed size*/ 33 #include <types.h>33 #include <types.h> 34 34 35 35 #define MAX_INT8 (0x7F) -
libc/include/thread.h
r1cef26f r29a9f62 31 31 32 32 #include <kernel/proc/uarg.h> 33 #include <libarch/thread.h> 33 34 34 35 extern void __thread_entry(void); 35 extern void thread_main(uspace_arg_t *uarg);36 extern void __thread_main(uspace_arg_t *uarg); 36 37 37 38 extern int thread_create(void (* function)(void *arg), void *arg, char *name); 38 39 extern void thread_exit(int status); 40 void * __make_tls(void); 41 void __free_tls(void *); 39 42 40 43 #endif -
libc/include/unistd.h
r1cef26f r29a9f62 31 31 32 32 #include <types.h> 33 #include <arch/mm/page.h> 33 34 34 35 #define NULL 0 36 #define getpagesize() (PAGE_SIZE) 35 37 36 38 extern ssize_t write(int fd, const void * buf, size_t count); -
libc/malloc/malloc.c
r1cef26f r29a9f62 537 537 #ifdef DEBUG 538 538 #if ABORT_ON_ASSERT_FAILURE 539 #define assert(x) if(!(x)) ABORT539 #define assert(x) {if(!(x)) {printf(#x);ABORT;}} 540 540 #else /* ABORT_ON_ASSERT_FAILURE */ 541 541 #include <assert.h>
Note:
See TracChangeset
for help on using the changeset viewer.