Changeset 1ea99cc in mainline
- Timestamp:
- 2009-08-20T20:47:35Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b50b5af2
- Parents:
- 24edc18
- Files:
-
- 58 added
- 40 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r24edc18 r1ea99cc 477 477 ! [PLATFORM=sparc64] CONFIG_RD_EXTERNAL (y/n) 478 478 479 % Build shared C library 480 ! CONFIG_BUILD_SHARED_LIBC (y/n) 481 482 % Link against shared C library 483 ! [CONFIG_BUILD_SHARED_LIBC=y] CONFIG_USE_SHARED_LIBC (n/y) 484 ! [CONFIG_BUILD_SHARED_LIBC=n] CONFIG_USE_SHARED_LIBC (n) 485 479 486 % Load disk drivers on startup 480 487 ! CONFIG_START_BD (n/y) -
boot/arch/ia32/Makefile.inc
r24edc18 r1ea99cc 58 58 $(USPACEDIR)/app/tetris/tetris \ 59 59 $(USPACEDIR)/app/tester/tester \ 60 $(USPACEDIR)/app/dltest2/dltest2 \ 61 $(USPACEDIR)/app/dload/dload \ 60 62 $(USPACEDIR)/app/trace/trace \ 61 63 $(USPACEDIR)/app/klog/klog \ 62 64 $(USPACEDIR)/app/bdsh/bdsh 63 65 66 RD_LIBS = \ 67 $(USPACEDIR)/lib/libtest/libtest.so.0 68 69 ifeq ($(CONFIG_BUILD_SHARED_LIBC), y) 70 RD_LIBS += $(USPACEDIR)/lib/libc/shared/libc.so.0 71 RD_APPS += $(USPACEDIR)/app/dltest/dltest 72 endif 73 64 74 build: $(BASE)/image.iso 65 75 66 $(BASE)/image.iso: arch/$(BARCH)/grub/stage2_eltorito arch/$(BARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_ APPS)76 $(BASE)/image.iso: arch/$(BARCH)/grub/stage2_eltorito arch/$(BARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_LIBS) $(RD_APPS) 67 77 mkdir -p $(TMP)/boot/grub 68 78 cp arch/$(BARCH)/grub/stage2_eltorito $(TMP)/boot/grub/ … … 79 89 for file in $(RD_SRVS) ; do \ 80 90 cp $$file $(USPACEDIR)/dist/srv/ ; \ 91 done 92 for lib in $(RD_LIBS) ; do \ 93 cp $$lib $(USPACEDIR)/dist/lib/ ; \ 81 94 done 82 95 for file in $(RD_APPS) ; do \ … … 97 110 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ 98 111 done 112 -for lib in $(RD_LIBS) ; do \ 113 rm -f $(USPACEDIR)/dist/lib/`basename $$lib` ; \ 114 done 99 115 -for file in $(RD_APPS) ; do \ 100 116 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ -
boot/arch/mips32/loader/Makefile
r24edc18 r1ea99cc 112 112 $(USPACEDIR)/app/tetris/tetris \ 113 113 $(USPACEDIR)/app/tester/tester \ 114 $(USPACEDIR)/app/dload/dload \ 115 $(USPACEDIR)/app/dltest/dltest \ 116 $(USPACEDIR)/app/dltest2/dltest2 \ 114 117 $(USPACEDIR)/app/trace/trace \ 115 118 $(USPACEDIR)/app/bdsh/bdsh \ 116 119 $(USPACEDIR)/app/klog/klog 120 121 RD_LIBS = \ 122 $(USPACEDIR)/lib/libc/shared/libc.so.0 \ 123 $(USPACEDIR)/lib/libtest/libtest.so.0 117 124 118 125 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) … … 143 150 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.raw image.boot Makefile.depend 144 151 145 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_ APPS) _link.ld.in152 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_LIBS) $(RD_APPS) _link.ld.in 146 153 for file in $(RD_SRVS) ; do \ 147 154 cp $$file $(USPACEDIR)/dist/srv/ ; \ 155 done 156 for lib in $(RD_LIBS) ; do \ 157 cp $$lib $(USPACEDIR)/dist/lib/ ; \ 148 158 done 149 159 for file in $(RD_APPS) ; do \ -
boot/arch/ppc32/loader/Makefile
r24edc18 r1ea99cc 98 98 $(USPACEDIR)/app/tetris/tetris \ 99 99 $(USPACEDIR)/app/tester/tester \ 100 $(USPACEDIR)/app/dload/dload \ 101 $(USPACEDIR)/app/dltest/dltest \ 102 $(USPACEDIR)/app/dltest2/dltest2 \ 100 103 $(USPACEDIR)/app/trace/trace \ 101 104 $(USPACEDIR)/app/klog/klog \ 102 105 $(USPACEDIR)/app/bdsh/bdsh 106 107 RD_LIBS = \ 108 $(USPACEDIR)/lib/libc/shared/libc.so.0 \ 109 $(USPACEDIR)/lib/libtest/libtest.so.0 103 110 104 111 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) … … 121 128 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ 122 129 done 130 -for lib in $(RD_LIBS) ; do \ 131 rm -f $(USPACEDIR)/dist/lib/`basename $$lib` ; \ 132 done 123 133 -for file in $(RD_APPS) ; do \ 124 134 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ … … 126 136 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend 127 137 128 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_ APPS) _link.ld.in138 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_LIBS) $(RD_APPS) _link.ld.in 129 139 for file in $(RD_SRVS) ; do \ 130 140 cp $$file $(USPACEDIR)/dist/srv/ ; \ 141 done 142 for lib in $(RD_LIBS) ; do \ 143 cp $$lib $(USPACEDIR)/dist/lib/ ; \ 131 144 done 132 145 for file in $(RD_APPS) ; do \ -
boot/arch/sparc64/loader/main.c
r24edc18 r1ea99cc 210 210 (void) ofw_map(bootinfo.physmem_start + base + top, base + top, 211 211 silo_ramdisk_size, -1); 212 memmove(base + top, (void *)((uintptr_t)silo_ramdisk_image), 212 /* 213 * FIXME If the source and destination overlap, it may be 214 * desirable to copy in reverse order, depending on how the two 215 * regions overlap. 216 */ 217 memcpy(base + top, (void *)((uintptr_t)silo_ramdisk_image), 213 218 silo_ramdisk_size); 214 219 printf("done.\n"); -
defaults/amd64/Makefile.config
r24edc18 r1ea99cc 3 3 4 4 # Ramdisk format 5 RDFMT = fat5 RDFMT = tmpfs 6 6 7 7 # Compiler … … 56 56 CONFIG_VESA_BPP = 16 57 57 58 # Use shared C library 59 CONFIG_SHARED_LIBC = n 60 58 61 # Load disk drivers on startup 59 62 CONFIG_START_BD = n -
defaults/arm32/Makefile.config
r24edc18 r1ea99cc 3 3 4 4 # Ramdisk format 5 RDFMT = fat5 RDFMT = tmpfs 6 6 7 7 # Compiler … … 32 32 CONFIG_HID_OUT = generic 33 33 34 # Use shared C library 35 CONFIG_SHARED_LIBC = n 36 34 37 # Load disk drivers on startup 35 38 CONFIG_START_BD = n -
defaults/ia32/Makefile.config
r24edc18 r1ea99cc 6 6 7 7 # Ramdisk format 8 RDFMT = fat8 RDFMT = tmpfs 9 9 10 10 # Compiler … … 62 62 CONFIG_VESA_BPP = 16 63 63 64 # Use shared C library 65 CONFIG_SHARED_LIBC = n 66 64 67 # Load disk drivers on startup 65 68 CONFIG_START_BD = n -
defaults/ia64/Makefile.config
r24edc18 r1ea99cc 3 3 4 4 # Ramdisk format 5 RDFMT = fat5 RDFMT = tmpfs 6 6 7 7 # Compiler … … 44 44 CONFIG_HID_OUT = generic 45 45 46 # Use shared C library 47 CONFIG_SHARED_LIBC = n 48 46 49 # Load disk drivers on startup 47 50 CONFIG_START_BD = n -
defaults/mips32/Makefile.config
r24edc18 r1ea99cc 3 3 4 4 # Ramdisk format 5 RDFMT = fat5 RDFMT = tmpfs 6 6 7 7 # Compiler … … 38 38 CONFIG_HID_OUT = generic 39 39 40 # Use shared C library 41 CONFIG_SHARED_LIBC = n 42 40 43 # Load disk drivers on startup 41 44 CONFIG_START_BD = n -
defaults/ppc32/Makefile.config
r24edc18 r1ea99cc 3 3 4 4 # Ramdisk format 5 RDFMT = fat5 RDFMT = tmpfs 6 6 7 7 # Compiler … … 38 38 CONFIG_BAT = y 39 39 40 # Use shared C library 41 CONFIG_SHARED_LIBC = n 42 40 43 # Load disk drivers on startup 41 44 CONFIG_START_BD = n -
defaults/sparc64/Makefile.config
r24edc18 r1ea99cc 3 3 4 4 # Ramdisk format 5 RDFMT = fat5 RDFMT = tmpfs 6 6 7 7 # Compiler … … 56 56 CONFIG_RD_EXTERNAL = y 57 57 58 # Use shared C library 59 CONFIG_SHARED_LIBC = n 60 58 61 # Load disk drivers on startup 59 62 CONFIG_START_BD = n -
kernel/arch/ia32/include/barrier.h
r24edc18 r1ea99cc 52 52 static inline void cpuid_serialization(void) 53 53 { 54 #ifndef __IN_SHARED_LIBC__ 54 55 asm volatile ( 55 56 "xorl %%eax, %%eax\n" … … 57 58 ::: "eax", "ebx", "ecx", "edx", "memory" 58 59 ); 60 #else 61 /* Must not clobber PIC register ebx */ 62 asm volatile ( 63 "movl %%ebx, %%esi\n" 64 "xorl %%eax, %%eax\n" 65 "cpuid\n" 66 "movl %%esi, %%ebx\n" 67 ::: "eax", "ecx", "edx", "esi", "memory" 68 ); 69 #endif 59 70 } 60 71 -
kernel/generic/include/syscall/syscall.h
r24edc18 r1ea99cc 82 82 SYS_SYSINFO_VALID, 83 83 SYS_SYSINFO_VALUE, 84 84 85 SYS_DEBUG_PUTINT, 85 86 SYS_DEBUG_ENABLE_CONSOLE, 86 87 SYS_DEBUG_DISABLE_CONSOLE, -
kernel/generic/src/lib/elf.c
r24edc18 r1ea99cc 167 167 case PT_INTERP: 168 168 interp = (char *)elf + entry->p_offset; 169 /* FIXME */169 /* DO NOT COMMIT ME */ 170 170 /*if (memcmp((uintptr_t)interp, (uintptr_t)ELF_INTERP_ZSTR, 171 171 ELF_INTERP_ZLEN) != 0) { -
kernel/generic/src/proc/program.c
r24edc18 r1ea99cc 50 50 #include <lib/elf.h> 51 51 #include <errno.h> 52 #include <print.h>53 52 #include <syscall/copy.h> 54 53 #include <proc/program.h> … … 134 133 ASSERT(program_loader == NULL); 135 134 program_loader = image_addr; 136 LOG("Registered program loader at 0x%" PRIp "\n",137 image_addr);138 135 return EOK; 139 136 } … … 161 158 162 159 loader = program_loader; 163 if (!loader) { 164 printf("Cannot spawn loader as none was registered\n"); 165 return ENOENT; 166 } 160 if (!loader) return ENOENT; 167 161 168 162 rc = elf_load((elf_header_t *) program_loader, as, ELD_F_LOADER); -
kernel/generic/src/syscall/syscall.c
r24edc18 r1ea99cc 54 54 #include <console/console.h> 55 55 #include <udebug/udebug.h> 56 57 /** Print a hex integer into klog */ 58 static unative_t sys_debug_putint(unative_t i) 59 { 60 printf("[task:0x%x]", i); 61 return 0; 62 } 56 63 57 64 /** Dispatch system call */ … … 159 166 160 167 /* Debug calls */ 168 (syshandler_t) sys_debug_putint, 161 169 (syshandler_t) sys_debug_enable_console, 162 170 (syshandler_t) sys_debug_disable_console, -
uspace/Makefile
r24edc18 r1ea99cc 38 38 lib/softint \ 39 39 lib/softfloat \ 40 lib/libtest \ 40 41 srv/bd/ata_bd \ 41 42 srv/bd/file_bd \ … … 54 55 app/tetris \ 55 56 app/tester \ 57 app/dltest2 \ 58 app/dload \ 56 59 app/trace \ 57 60 app/klog \ … … 74 77 endif 75 78 79 ifeq ($(CONFIG_BUILD_SHARED_LIBC), y) 80 DIRS += \ 81 lib/libc/shared \ 82 app/dltest 83 endif 84 85 76 86 BUILDS := $(addsuffix .build,$(DIRS)) 77 87 CLEANS := $(addsuffix .clean,$(DIRS)) 78 88 79 .PHONY: all $(BUILDS) $(CLEANS) clean 89 .PHONY: all $(BUILDS) $(CLEANS) clean kerninc 80 90 81 91 all: ../Makefile.config ../config.h ../config.defs $(BUILDS) -
uspace/app/bdsh/Makefile
r24edc18 r1ea99cc 37 37 38 38 include $(LIBC_PREFIX)/Makefile.toolchain 39 include $(LIBC_PREFIX)/Makefile.app 39 40 40 41 CFLAGS += -I../../srv/kbd/include -I$(LIBBLOCK_PREFIX) 41 42 42 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a43 LIBS += $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a 43 44 DEFS += -DRELEASE=$(RELEASE) 44 45 … … 114 115 115 116 $(PROGRAM): $(OBJECTS) $(LIBS) 116 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(PROGRAM).map117 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(PROGRAM).map 117 118 118 119 # Everything else is a phony target -
uspace/app/klog/Makefile
r24edc18 r1ea99cc 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 37 LIBS = $(LIBC_PREFIX)/libc.a 36 include $(LIBC_PREFIX)/Makefile.app 38 37 39 38 ## Sources … … 60 59 61 60 $(OUTPUT): $(OBJECTS) $(LIBS) 62 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map61 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 63 62 64 63 disasm: $(OUTPUT).disasm -
uspace/app/klog/klog.c
r24edc18 r1ea99cc 73 73 return -1; 74 74 } 75 76 printf("got area at 0x%08lx, length %lx byes\n", klog, klog_size); 75 77 76 78 int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog, -
uspace/app/tester/Makefile
r24edc18 r1ea99cc 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app 36 37 37 38 CFLAGS += -I../../srv/kbd/include 38 39 LIBS = $(LIBC_PREFIX)/libc.a40 39 41 40 ## Sources … … 76 75 77 76 $(OUTPUT): $(OBJECTS) $(LIBS) 78 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map77 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 79 78 80 79 disasm: $(OUTPUT).disasm -
uspace/app/tetris/Makefile
r24edc18 r1ea99cc 3 3 4 4 include $(LIBC_PREFIX)/Makefile.toolchain 5 6 LIBS = $(LIBC_PREFIX)/libc.a 5 include $(LIBC_PREFIX)/Makefile.app 7 6 8 7 OUTPUT = tetris … … 20 19 21 20 $(OUTPUT): $(OBJECTS) $(LIBS) 22 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map21 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 23 22 24 23 clean: -
uspace/app/trace/Makefile
r24edc18 r1ea99cc 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app 36 37 37 38 CFLAGS += -I../../srv/kbd/include 38 39 LIBS = $(LIBC_PREFIX)/libc.a40 39 41 40 ## Sources … … 65 64 66 65 $(OUTPUT): $(OBJECTS) $(LIBS) 67 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map66 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 68 67 69 68 disasm: -
uspace/lib/libc/Makefile
r24edc18 r1ea99cc 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2008 Jiri Svoboda 3 4 # All rights reserved. 4 5 # … … 38 39 39 40 include $(LIBC_PREFIX)/Makefile.toolchain 41 -include rtld/arch/$(UARCH)/Makefile.inc 40 42 43 CFLAGS += -Irtld/include -I../../srv/loader/include -D__32_BITS__ 44 PIC_CFLAGS := $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__ 41 45 42 46 ## Sources … … 74 78 generic/ipc.c \ 75 79 generic/async.c \ 80 generic/dlfcn.c \ 76 81 generic/loader.c \ 77 82 generic/getopt.c \ … … 84 89 generic/udebug.c \ 85 90 generic/vfs/vfs.c \ 86 generic/vfs/canonify.c 91 generic/vfs/canonify.c \ 92 rtld/rtld.c \ 93 rtld/elf_load.c \ 94 rtld/dynamic.c \ 95 rtld/module.c \ 96 rtld/symbol.c 97 87 98 88 99 ARCH_SOURCES += \ … … 93 104 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 94 105 OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) 106 PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS))) 107 108 OUTPUT := libc.a 109 110 ifeq ($(CONFIG_BUILD_SHARED_LIBC), y) 111 OUTPUT += libc.pic.a 112 endif 95 113 96 114 .PHONY: all clean depend kerninc 97 115 98 all: kerninc libc.aarch/$(UARCH)/_link.ld116 all: kerninc $(OUTPUT) arch/$(UARCH)/_link.ld 99 117 100 118 kerninc: … … 102 120 ln -sfn kernel/arch include/arch 103 121 ln -sfn ../arch/$(UARCH)/include include/libarch 122 ln -sfn ../arch/$(UARCH)/include rtld/include/arch 104 123 105 124 -include Makefile.depend 106 125 107 126 clean: 108 -rm -f include/kernel include/arch include/libarch libc.a arch/$(UARCH)/_link.ld Makefile.depend109 find generic/ arch/$(UARCH)/ -name '*.o'-follow -exec rm \{\} \;127 -rm -f include/kernel include/arch include/libarch rtld/include/arch libc.a libc.pic.a arch/$(UARCH)/_link.ld Makefile.depend 128 find . \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \; 110 129 111 130 depend: kerninc 112 131 -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null 132 -makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(ARCH_SOURCES) $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null 113 133 114 libc.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 115 $(AR) rc libc.a $(LIBS) $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 134 libc.a: depend $(OBJECTS) 135 $(AR) rc $@ $(LIBS) $(OBJECTS) 136 137 libc.pic.a: depend $(PIC_OBJECTS) 138 $(AR) rc $@ $(LIBS) $(PIC_OBJECTS) 116 139 117 140 arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in … … 126 149 %.o: %.c 127 150 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 151 152 %.pio: %.S 153 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 154 155 %.pio: %.s 156 $(AS) $(AFLAGS) $< -o $@ 157 158 %.pio: %.c 159 $(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@ -
uspace/lib/libc/arch/ia32/src/syscall.S
r24edc18 r1ea99cc 65 65 */ 66 66 .global __syscall_sysenter 67 .type __syscall_sysenter, @function 68 67 69 __syscall_sysenter: 68 70 pushl %ebx … … 89 91 popl %ebx 90 92 ret 93 94 .size __syscall_sysenter, . - __syscall_sysenter -
uspace/lib/libc/arch/ia32/src/tls.c
r24edc18 r1ea99cc 37 37 #include <tls.h> 38 38 #include <sys/types.h> 39 #include <align.h> 39 40 40 41 tcb_t * __alloc_tls(void **data, size_t size) … … 48 49 } 49 50 51 //#ifdef __SHARED__ 52 53 typedef struct { 54 unsigned long int ti_module; 55 unsigned long int ti_offset; 56 } tls_index; 57 58 void __attribute__ ((__regparm__ (1))) 59 *___tls_get_addr(tls_index *ti); 60 61 void __attribute__ ((__regparm__ (1))) 62 *___tls_get_addr(tls_index *ti) 63 { 64 size_t tls_size; 65 uint8_t *tls; 66 67 /* Calculate size of TLS block */ 68 tls_size = ALIGN_UP(&_tbss_end - &_tdata_start, &_tls_alignment); 69 70 /* The TLS block is just before TCB */ 71 tls = (uint8_t *)__tcb_get() - tls_size; 72 73 return tls + ti->ti_offset; 74 } 75 76 //#endif 77 50 78 /** @} 51 79 */ -
uspace/lib/libc/arch/mips32/src/tls.c
r24edc18 r1ea99cc 47 47 } 48 48 49 typedef struct { 50 unsigned long ti_module; 51 unsigned long ti_offset; 52 } tls_index; 53 54 void *__tls_get_addr(tls_index *ti); 55 56 /* mips32 uses TLS variant 1 */ 57 void *__tls_get_addr(tls_index *ti) 58 { 59 uint8_t *tls; 60 uint32_t v; 61 62 tls = (uint8_t *)__tcb_get() + sizeof(tcb_t); 63 64 /* Hopefully this is right. No docs found. */ 65 v = (uint32_t) (tls + ti->ti_offset + 0x8000); 66 return (void *) v; 67 } 68 49 69 /** @} 50 70 */ -
uspace/lib/libc/arch/ppc32/src/tls.c
r24edc18 r1ea99cc 1 1 /* 2 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 34 35 35 36 #include <tls.h> 37 #include <align.h> 36 38 #include <sys/types.h> 37 39 … … 46 48 } 47 49 50 static void kputint(unsigned i) 51 { 52 asm volatile ( 53 "mr %%r3, %0\n" 54 "li %%r9, 32\n" 55 "sc\n" 56 : 57 : "r" (i) 58 : "%r3","%r9" 59 ) ; 60 } 61 62 typedef struct { 63 unsigned long int ti_module; 64 unsigned long int ti_offset; 65 } tls_index; 66 67 void *__tls_get_addr(tls_index *ti); 68 69 /* ppc32 uses TLS variant 1 */ 70 void *__tls_get_addr(tls_index *ti) 71 { 72 uint8_t *tls; 73 74 /* The TLS section is just after TCB */ 75 tls = (uint8_t *)__tcb_get() + sizeof(tcb_t); 76 77 /* Hopefully this is right. No docs found. */ 78 return tls + ti->ti_offset + 32768; 79 } 80 48 81 /** @} 49 82 */ -
uspace/lib/libc/generic/async.c
r24edc18 r1ea99cc 175 175 176 176 /** Identifier of the incoming connection handled by the current fibril. */ 177 fibril_local connection_t *FIBRIL_connection;177 static fibril_local connection_t *FIBRIL_connection; 178 178 179 179 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call); -
uspace/lib/libc/generic/libc.c
r24edc18 r1ea99cc 53 53 #include <loader/pcb.h> 54 54 55 /* From librtld. */ 56 #include <rtld.h> 57 #include <string.h> 58 55 59 extern int main(int argc, char *argv[]); 56 60 … … 75 79 char **argv; 76 80 81 #ifdef __IN_SHARED_LIBC__ 82 if (__pcb != NULL && __pcb->rtld_runtime != NULL) { 83 runtime_env = (runtime_env_t *) __pcb->rtld_runtime; 84 } 85 #endif 86 77 87 if (__pcb == NULL) { 78 88 argc = 0; -
uspace/lib/libc/generic/time.c
r24edc18 r1ea99cc 148 148 if (res) { 149 149 printf("Failed to initialize timeofday memarea\n"); 150 printf("Address was 0x%x\n", (unsigned)mapping); 150 151 _exit(1); 151 152 } -
uspace/lib/libc/include/as.h
r24edc18 r1ea99cc 43 43 extern void *as_area_create(void *address, size_t size, int flags); 44 44 extern int as_area_resize(void *address, size_t size, int flags); 45 externint as_area_change_flags(void *address, int flags);45 int as_area_change_flags(void *address, int flags); 46 46 extern int as_area_destroy(void *address); 47 47 extern void *set_maxheapsize(size_t mhs); -
uspace/lib/libc/include/loader/pcb.h
r24edc18 r1ea99cc 69 69 /** Pointer to ELF dynamic section of the program. */ 70 70 void *dynamic; 71 /** Pointer to dynamic linker state structure (runtime_env_t). */ 72 void *rtld_runtime; 71 73 } pcb_t; 72 74 -
uspace/lib/softint/Makefile
r24edc18 r1ea99cc 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2008 Jiri Svoboda 3 4 # All rights reserved. 4 5 # … … 38 39 39 40 CFLAGS += -Iinclude 41 PIC_CFLAGS := $(CFLAGS) -fPIC -D__PIC__ 40 42 41 43 ## Sources … … 49 51 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 50 52 53 OBJECTS := $(GENERIC_OBJECTS) 54 PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS))) 55 51 56 .PHONY: all clean depend 52 57 53 all: libsoftint.a 58 all: libsoftint.a libsoftint.pic.a 54 59 55 60 -include Makefile.depend 56 61 57 62 clean: 58 -rm -f libsoftint.a Makefile.depend59 find generic/ -name '*.o'-follow -exec rm \{\} \;63 -rm -f libsoftint.a libsoftint.pic.a Makefile.depend 64 find generic/ \( -name '*.o' -o -name '*.pio' \) -follow -exec rm \{\} \; 60 65 61 66 depend: 62 67 -makedepend -f - -- $(DEPEMD_DEFS) $(CFLAGS) -- $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null 68 -makedepend $(DEFS) $(PIC_CFLAGS) -o.pio -f - $(GENERIC_SOURCES) >> Makefile.depend 2> /dev/null 63 69 64 libsoftint.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 65 $(AR) rc libsoftint.a $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 70 libsoftint.a: depend $(OBJECTS) 71 $(AR) rc $@ $(OBJECTS) 72 73 libsoftint.pic.a: depend $(PIC_OBJECTS) 74 $(AR) rc $@ $(PIC_OBJECTS) 66 75 67 76 %.o: %.S … … 73 82 %.o: %.c 74 83 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 84 85 %.pio: %.S 86 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@ 87 88 %.pio: %.s 89 $(AS) $(AFLAGS) $< -o $@ 90 91 %.pio: %.c 92 $(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@ -
uspace/srv/kbd/Makefile
r24edc18 r1ea99cc 33 33 SOFTINT_PREFIX = ../../lib/softint 34 34 35 include $(LIBC_PREFIX)/Makefile.toolchain 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app 36 37 37 38 CFLAGS += -Iinclude 38 39 LIBS = $(LIBC_PREFIX)/libc.a40 39 41 40 ## Sources … … 170 169 171 170 $(OUTPUT): $(OBJECTS) $(LIBS) 172 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map171 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 173 172 174 173 disasm: $(OUTPUT).disasm -
uspace/srv/loader/elf_load.c
r24edc18 r1ea99cc 102 102 * @return EOK on success or negative error code. 103 103 */ 104 int elf_load_file(char *file_name, size_t so_bias, elf_info_t *info) 104 int elf_load_file(char *file_name, size_t so_bias, eld_flags_t flags, 105 elf_info_t *info) 105 106 { 106 107 elf_ld_t elf; … … 117 118 elf.fd = fd; 118 119 elf.info = info; 120 elf.flags = flags; 119 121 120 122 rc = elf_load(&elf, so_bias); … … 123 125 124 126 return rc; 125 }126 127 /** Run an ELF executable.128 *129 * Transfers control to the entry point of an ELF executable loaded130 * earlier with elf_load_file(). This function does not return.131 *132 * @param info Info structure filled earlier by elf_load_file()133 */134 void elf_run(elf_info_t *info, pcb_t *pcb)135 {136 program_run(info->entry, pcb);137 138 /* not reached */139 127 } 140 128 … … 151 139 pcb->entry = info->entry; 152 140 pcb->dynamic = info->dynamic; 141 pcb->rtld_runtime = NULL; 153 142 } 154 143 … … 303 292 break; 304 293 case PT_INTERP: 305 /* Assume silently interp == "/ rtld.so" */306 elf->info->interp = "/ rtld.so";294 /* Assume silently interp == "/app/dload" */ 295 elf->info->interp = "/app/dload"; 307 296 break; 308 297 case PT_DYNAMIC: 298 /* Record pointer to dynamic section into info structure */ 299 elf->info->dynamic = 300 (void *)((uint8_t *)entry->p_vaddr + elf->bias); 301 DPRINTF("dynamic section found at 0x%x\n", 302 (uintptr_t)elf->info->dynamic); 303 break; 304 case 0x70000000: 305 /* FIXME: MIPS reginfo */ 306 break; 309 307 case PT_SHLIB: 310 308 case PT_NOTE: 311 case PT_LOPROC:312 case PT_HIPROC:309 // case PT_LOPROC: 310 // case PT_HIPROC: 313 311 default: 314 312 DPRINTF("Segment p_type %d unknown.\n", entry->p_type); … … 380 378 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 381 379 if (a == (void *)(-1)) { 382 DPRINTF("Memory mapping failed.\n"); 380 DPRINTF("memory mapping failed (0x%x, %d)\n", 381 base+bias, mem_sz); 383 382 return EE_MEMORY; 384 383 } … … 422 421 } 423 422 423 /* 424 * The caller wants to modify the segments first. He will then 425 * need to set the right access mode and ensure SMC coherence. 426 */ 427 if ((elf->flags & ELDF_RW) != 0) return EE_OK; 428 429 // printf("set area flags to %d\n", flags); 424 430 rc = as_area_change_flags(seg_ptr, flags); 425 431 if (rc != 0) { … … 458 464 break; 459 465 case SHT_DYNAMIC: 460 /* Record pointer to dynamic section into info structure */461 elf->info->dynamic =462 (void *)((uint8_t *)entry->sh_addr + elf->bias);463 DPRINTF("Dynamic section found at 0x%x.\n",464 (uintptr_t)elf->info->dynamic);465 466 break; 466 467 default: -
uspace/srv/loader/include/elf_load.h
r24edc18 r1ea99cc 43 43 #include "elf.h" 44 44 45 typedef enum { 46 /** Leave all segments in RW access mode. */ 47 ELDF_RW = 1 48 } eld_flags_t; 49 45 50 /** 46 51 * Some data extracted from the headers are stored here … … 67 72 uintptr_t bias; 68 73 74 /** Flags passed to the ELF loader. */ 75 eld_flags_t flags; 76 69 77 /** A copy of the ELF file header */ 70 78 elf_header_t *header; … … 74 82 } elf_ld_t; 75 83 76 int elf_load_file(char *file_name, size_t so_bias, el f_info_t *info);77 void elf_run(elf_info_t *info, pcb_t *pcb);84 int elf_load_file(char *file_name, size_t so_bias, eld_flags_t flags, 85 elf_info_t *info); 78 86 void elf_create_pcb(elf_info_t *info, pcb_t *pcb); 79 87 -
uspace/srv/loader/main.c
r24edc18 r1ea99cc 66 66 #define DPRINTF(...) 67 67 68 void program_run(void *entry, pcb_t *pcb); 69 68 70 /** Pathname of the file that will be loaded */ 69 71 static char *pathname = NULL; … … 304 306 int rc; 305 307 306 rc = elf_load_file(pathname, 0, &prog_info);308 rc = elf_load_file(pathname, 0, 0, &prog_info); 307 309 if (rc != EE_OK) { 308 310 DPRINTF("Failed to load executable '%s'.\n", pathname); … … 326 328 } 327 329 328 rc = elf_load_file(prog_info.interp, 0, &interp_info); 330 printf("Load ELF interpreter '%s'\n", prog_info.interp); 331 rc = elf_load_file(prog_info.interp, 0, 0, &interp_info); 329 332 if (rc != EE_OK) { 330 333 DPRINTF("Failed to load interpreter '%s.'\n", … … 334 337 } 335 338 339 printf("Run interpreter.\n"); 340 printf("entry point: 0x%lx\n", interp_info.entry); 341 printf("pcb address: 0x%lx\n", &pcb); 342 printf("prog dynamic: 0x%lx\n", prog_info.dynamic); 343 336 344 is_dyn_linked = true; 337 345 ipc_answer_0(rid, EOK); … … 362 370 363 371 ipc_answer_0(rid, EOK); 364 elf_run(&interp_info, &pcb);372 program_run(interp_info.entry, &pcb); 365 373 } else { 366 374 /* Statically linked program */ 367 375 ipc_answer_0(rid, EOK); 368 elf_run(&prog_info, &pcb);376 program_run(prog_info.entry, &pcb); 369 377 } 370 378 -
uspace/srv/pci/Makefile
r24edc18 r1ea99cc 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app 36 37 37 38 LIBS = libpci/libpci.a $(LIBC_PREFIX)/libc.a 38 LIBS := libpci/libpci.a $(LIBS) 39 39 40 40 ## Sources … … 62 62 $(OUTPUT): $(OBJECTS) $(LIBS) 63 63 $(MAKE) -C libpci 64 $(LD) -T $(L IBC_PREFIX)/arch/$(UARCH)/_link.ld$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map64 $(LD) -T $(LD_SCRIPT) $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 65 65 66 66 disasm:
Note:
See TracChangeset
for help on using the changeset viewer.