Changes in / [b50b5af2:a71c158] in mainline
- Files:
-
- 58 deleted
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
rb50b5af2 ra71c158 480 480 ! [PLATFORM=sparc64] CONFIG_RD_EXTERNAL (y/n) 481 481 482 % Build shared C library483 ! CONFIG_BUILD_SHARED_LIBC (y/n)484 485 % Link against shared C library486 ! [CONFIG_BUILD_SHARED_LIBC=y] CONFIG_USE_SHARED_LIBC (n/y)487 ! [CONFIG_BUILD_SHARED_LIBC=n] CONFIG_USE_SHARED_LIBC (n)488 489 482 % Load disk drivers on startup 490 483 ! CONFIG_START_BD (n/y) -
boot/arch/ia32/Makefile.inc
rb50b5af2 ra71c158 58 58 $(USPACEDIR)/app/tetris/tetris \ 59 59 $(USPACEDIR)/app/tester/tester \ 60 $(USPACEDIR)/app/dltest2/dltest2 \61 $(USPACEDIR)/app/dload/dload \62 60 $(USPACEDIR)/app/trace/trace \ 63 61 $(USPACEDIR)/app/klog/klog \ 64 62 $(USPACEDIR)/app/bdsh/bdsh 65 63 66 RD_LIBS = \67 $(USPACEDIR)/lib/libtest/libtest.so.068 69 ifeq ($(CONFIG_BUILD_SHARED_LIBC), y)70 RD_LIBS += $(USPACEDIR)/lib/libc/shared/libc.so.071 RD_APPS += $(USPACEDIR)/app/dltest/dltest72 endif73 74 64 build: $(BASE)/image.iso 75 65 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)66 $(BASE)/image.iso: arch/$(BARCH)/grub/stage2_eltorito arch/$(BARCH)/grub/menu.lst $(KERNELDIR)/kernel.bin $(INIT_TASKS) $(RD_SRVS) $(RD_APPS) 77 67 mkdir -p $(TMP)/boot/grub 78 68 cp arch/$(BARCH)/grub/stage2_eltorito $(TMP)/boot/grub/ … … 89 79 for file in $(RD_SRVS) ; do \ 90 80 cp $$file $(USPACEDIR)/dist/srv/ ; \ 91 done92 for lib in $(RD_LIBS) ; do \93 cp $$lib $(USPACEDIR)/dist/lib/ ; \94 81 done 95 82 for file in $(RD_APPS) ; do \ … … 110 97 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ 111 98 done 112 -for lib in $(RD_LIBS) ; do \113 rm -f $(USPACEDIR)/dist/lib/`basename $$lib` ; \114 done115 99 -for file in $(RD_APPS) ; do \ 116 100 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ -
boot/arch/mips32/loader/Makefile
rb50b5af2 ra71c158 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 \117 114 $(USPACEDIR)/app/trace/trace \ 118 115 $(USPACEDIR)/app/bdsh/bdsh \ 119 116 $(USPACEDIR)/app/klog/klog 120 121 RD_LIBS = \122 $(USPACEDIR)/lib/libc/shared/libc.so.0 \123 $(USPACEDIR)/lib/libtest/libtest.so.0124 117 125 118 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) … … 150 143 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.raw image.boot Makefile.depend 151 144 152 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_ LIBS) $(RD_APPS) _link.ld.in145 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in 153 146 for file in $(RD_SRVS) ; do \ 154 147 cp $$file $(USPACEDIR)/dist/srv/ ; \ 155 done156 for lib in $(RD_LIBS) ; do \157 cp $$lib $(USPACEDIR)/dist/lib/ ; \158 148 done 159 149 for file in $(RD_APPS) ; do \ -
boot/arch/ppc32/loader/Makefile
rb50b5af2 ra71c158 100 100 $(USPACEDIR)/app/tetris/tetris \ 101 101 $(USPACEDIR)/app/tester/tester \ 102 $(USPACEDIR)/app/dload/dload \103 $(USPACEDIR)/app/dltest/dltest \104 $(USPACEDIR)/app/dltest2/dltest2 \105 102 $(USPACEDIR)/app/trace/trace \ 106 103 $(USPACEDIR)/app/bdsh/bdsh \ 107 104 $(USPACEDIR)/app/klog/klog 108 109 RD_LIBS = \110 $(USPACEDIR)/lib/libc/shared/libc.so.0 \111 $(USPACEDIR)/lib/libtest/libtest.so.0112 105 113 106 OBJECTS := $(addsuffix .o,$(basename $(SOURCES))) … … 130 123 rm -f $(USPACEDIR)/dist/srv/`basename $$file` ; \ 131 124 done 132 -for lib in $(RD_LIBS) ; do \133 rm -f $(USPACEDIR)/dist/lib/`basename $$lib` ; \134 done135 125 -for file in $(RD_APPS) ; do \ 136 126 rm -f $(USPACEDIR)/dist/app/`basename $$file` ; \ … … 138 128 -rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o $(OBJECTS) initrd.img image.boot Makefile.depend 139 129 140 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_ LIBS) $(RD_APPS) _link.ld.in130 _components.h _components.c _link.ld $(COMPONENT_OBJECTS) initrd.o: $(COMPONENTS) $(RD_SRVS) $(RD_APPS) _link.ld.in 141 131 for file in $(RD_SRVS) ; do \ 142 132 cp $$file $(USPACEDIR)/dist/srv/ ; \ 143 done144 for lib in $(RD_LIBS) ; do \145 cp $$lib $(USPACEDIR)/dist/lib/ ; \146 133 done 147 134 for file in $(RD_APPS) ; do \ -
defaults/amd64/Makefile.config
rb50b5af2 ra71c158 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 56 56 CONFIG_VESA_BPP = 16 57 57 58 # Use shared C library59 CONFIG_SHARED_LIBC = n60 61 58 # Load disk drivers on startup 62 59 CONFIG_START_BD = n -
defaults/arm32/Makefile.config
rb50b5af2 ra71c158 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 32 32 CONFIG_HID_OUT = generic 33 33 34 # Use shared C library35 CONFIG_SHARED_LIBC = n36 37 34 # Load disk drivers on startup 38 35 CONFIG_START_BD = n -
defaults/ia32/Makefile.config
rb50b5af2 ra71c158 6 6 7 7 # Ramdisk format 8 RDFMT = tmpfs8 RDFMT = fat 9 9 10 10 # Compiler … … 62 62 CONFIG_VESA_BPP = 16 63 63 64 # Use shared C library65 CONFIG_SHARED_LIBC = n66 67 64 # Load disk drivers on startup 68 65 CONFIG_START_BD = n -
defaults/ia64/Makefile.config
rb50b5af2 ra71c158 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 44 44 CONFIG_HID_OUT = generic 45 45 46 # Use shared C library47 CONFIG_SHARED_LIBC = n48 49 46 # Load disk drivers on startup 50 47 CONFIG_START_BD = n -
defaults/mips32/Makefile.config
rb50b5af2 ra71c158 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 38 38 CONFIG_HID_OUT = generic 39 39 40 # Use shared C library41 CONFIG_SHARED_LIBC = n42 43 40 # Load disk drivers on startup 44 41 CONFIG_START_BD = n -
defaults/ppc32/Makefile.config
rb50b5af2 ra71c158 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 38 38 CONFIG_BAT = y 39 39 40 # Use shared C library41 CONFIG_SHARED_LIBC = n42 43 40 # Load disk drivers on startup 44 41 CONFIG_START_BD = n -
defaults/sparc64/Makefile.config
rb50b5af2 ra71c158 3 3 4 4 # Ramdisk format 5 RDFMT = tmpfs5 RDFMT = fat 6 6 7 7 # Compiler … … 56 56 CONFIG_RD_EXTERNAL = y 57 57 58 # Use shared C library59 CONFIG_SHARED_LIBC = n60 61 58 # Load disk drivers on startup 62 59 CONFIG_START_BD = n -
kernel/arch/ia32/include/barrier.h
rb50b5af2 ra71c158 52 52 static inline void cpuid_serialization(void) 53 53 { 54 #ifndef __IN_SHARED_LIBC__55 54 asm volatile ( 56 55 "xorl %%eax, %%eax\n" … … 58 57 ::: "eax", "ebx", "ecx", "edx", "memory" 59 58 ); 60 #else61 /* 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 #endif70 59 } 71 60 -
kernel/generic/include/syscall/syscall.h
rb50b5af2 ra71c158 83 83 SYS_SYSINFO_VALID, 84 84 SYS_SYSINFO_VALUE, 85 86 SYS_DEBUG_PUTINT, 85 87 86 SYS_DEBUG_ENABLE_CONSOLE, 88 87 SYS_DEBUG_DISABLE_CONSOLE, -
kernel/generic/src/lib/elf.c
rb50b5af2 ra71c158 167 167 case PT_INTERP: 168 168 interp = (char *)elf + entry->p_offset; 169 /* DO NOT COMMITME */169 /* FIXME */ 170 170 /*if (memcmp((uintptr_t)interp, (uintptr_t)ELF_INTERP_ZSTR, 171 171 ELF_INTERP_ZLEN) != 0) { -
kernel/generic/src/proc/program.c
rb50b5af2 ra71c158 50 50 #include <lib/elf.h> 51 51 #include <errno.h> 52 #include <print.h> 52 53 #include <syscall/copy.h> 53 54 #include <proc/program.h> … … 133 134 ASSERT(program_loader == NULL); 134 135 program_loader = image_addr; 136 LOG("Registered program loader at 0x%" PRIp "\n", 137 image_addr); 135 138 return EOK; 136 139 } … … 158 161 159 162 loader = program_loader; 160 if (!loader) return ENOENT; 163 if (!loader) { 164 printf("Cannot spawn loader as none was registered\n"); 165 return ENOENT; 166 } 161 167 162 168 rc = elf_load((elf_header_t *) program_loader, as, ELD_F_LOADER); -
kernel/generic/src/syscall/syscall.c
rb50b5af2 ra71c158 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 }63 56 64 57 /** Dispatch system call */ … … 167 160 168 161 /* Debug calls */ 169 (syshandler_t) sys_debug_putint,170 162 (syshandler_t) sys_debug_enable_console, 171 163 (syshandler_t) sys_debug_disable_console, -
uspace/Makefile
rb50b5af2 ra71c158 38 38 lib/softint \ 39 39 lib/softfloat \ 40 lib/libtest \41 40 srv/bd/ata_bd \ 42 41 srv/bd/file_bd \ … … 55 54 app/tetris \ 56 55 app/tester \ 57 app/dltest2 \58 app/dload \59 56 app/trace \ 60 57 app/klog \ … … 77 74 endif 78 75 79 ifeq ($(CONFIG_BUILD_SHARED_LIBC), y)80 DIRS += \81 lib/libc/shared \82 app/dltest83 endif84 85 86 76 BUILDS := $(addsuffix .build,$(DIRS)) 87 77 CLEANS := $(addsuffix .clean,$(DIRS)) 88 78 89 .PHONY: all $(BUILDS) $(CLEANS) clean kerninc79 .PHONY: all $(BUILDS) $(CLEANS) clean 90 80 91 81 all: ../Makefile.config ../config.h ../config.defs $(BUILDS) -
uspace/app/bdsh/Makefile
rb50b5af2 ra71c158 37 37 38 38 include $(LIBC_PREFIX)/Makefile.toolchain 39 include $(LIBC_PREFIX)/Makefile.app40 39 41 40 CFLAGS += -I../../srv/kbd/include -I$(LIBBLOCK_PREFIX) 42 41 43 LIBS += $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a42 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBC_PREFIX)/libc.a 44 43 DEFS += -DRELEASE=$(RELEASE) 45 44 … … 115 114 116 115 $(PROGRAM): $(OBJECTS) $(LIBS) 117 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(PROGRAM).map116 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(PROGRAM).map 118 117 119 118 # Everything else is a phony target -
uspace/app/klog/Makefile
rb50b5af2 ra71c158 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app 36 37 LIBS = $(LIBC_PREFIX)/libc.a 37 38 38 39 ## Sources … … 59 60 60 61 $(OUTPUT): $(OBJECTS) $(LIBS) 61 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map62 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 62 63 63 64 disasm: $(OUTPUT).disasm -
uspace/app/klog/klog.c
rb50b5af2 ra71c158 73 73 return -1; 74 74 } 75 76 printf("got area at 0x%08lx, length %lx byes\n", klog, klog_size);77 75 78 76 int res = ipc_share_in_start_1_0(PHONE_NS, (void *) klog, -
uspace/app/tester/Makefile
rb50b5af2 ra71c158 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app37 36 38 37 CFLAGS += -I../../srv/kbd/include 38 39 LIBS = $(LIBC_PREFIX)/libc.a 39 40 40 41 ## Sources … … 75 76 76 77 $(OUTPUT): $(OBJECTS) $(LIBS) 77 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map78 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 78 79 79 80 disasm: $(OUTPUT).disasm -
uspace/app/tetris/Makefile
rb50b5af2 ra71c158 3 3 4 4 include $(LIBC_PREFIX)/Makefile.toolchain 5 include $(LIBC_PREFIX)/Makefile.app 5 6 LIBS = $(LIBC_PREFIX)/libc.a 6 7 7 8 OUTPUT = tetris … … 19 20 20 21 $(OUTPUT): $(OBJECTS) $(LIBS) 21 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map22 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 22 23 23 24 clean: -
uspace/app/trace/Makefile
rb50b5af2 ra71c158 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app37 36 38 37 CFLAGS += -I../../srv/kbd/include 38 39 LIBS = $(LIBC_PREFIX)/libc.a 39 40 40 41 ## Sources … … 64 65 65 66 $(OUTPUT): $(OBJECTS) $(LIBS) 66 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map67 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 67 68 68 69 disasm: -
uspace/lib/libc/Makefile
rb50b5af2 ra71c158 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2008 Jiri Svoboda4 3 # All rights reserved. 5 4 # … … 39 38 40 39 include $(LIBC_PREFIX)/Makefile.toolchain 41 -include rtld/arch/$(UARCH)/Makefile.inc42 40 43 CFLAGS += -Irtld/include -I../../srv/loader/include -D__32_BITS__44 PIC_CFLAGS := $(CFLAGS) -fPIC -D__IN_SHARED_LIBC__45 41 46 42 ## Sources … … 78 74 generic/ipc.c \ 79 75 generic/async.c \ 80 generic/dlfcn.c \81 76 generic/loader.c \ 82 77 generic/getopt.c \ … … 89 84 generic/udebug.c \ 90 85 generic/vfs/vfs.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 86 generic/vfs/canonify.c 98 87 99 88 ARCH_SOURCES += \ … … 104 93 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 105 94 OBJECTS := $(GENERIC_OBJECTS) $(ARCH_OBJECTS) 106 PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS)))107 108 OUTPUT := libc.a109 110 ifeq ($(CONFIG_BUILD_SHARED_LIBC), y)111 OUTPUT += libc.pic.a112 endif113 95 114 96 .PHONY: all clean depend kerninc 115 97 116 all: kerninc $(OUTPUT)arch/$(UARCH)/_link.ld98 all: kerninc libc.a arch/$(UARCH)/_link.ld 117 99 118 100 kerninc: … … 120 102 ln -sfn kernel/arch include/arch 121 103 ln -sfn ../arch/$(UARCH)/include include/libarch 122 ln -sfn ../arch/$(UARCH)/include rtld/include/arch123 104 124 105 -include Makefile.depend 125 106 126 107 clean: 127 -rm -f include/kernel include/arch include/libarch rtld/include/arch libc.a libc.pic.a arch/$(UARCH)/_link.ld Makefile.depend128 find . \( -name '*.o' -o -name '*.pio' \)-follow -exec rm \{\} \;108 -rm -f include/kernel include/arch include/libarch libc.a arch/$(UARCH)/_link.ld Makefile.depend 109 find generic/ arch/$(UARCH)/ -name '*.o' -follow -exec rm \{\} \; 129 110 130 111 depend: kerninc 131 112 -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/null133 113 134 libc.a: depend $(OBJECTS) 135 $(AR) rc $@ $(LIBS) $(OBJECTS) 136 137 libc.pic.a: depend $(PIC_OBJECTS) 138 $(AR) rc $@ $(LIBS) $(PIC_OBJECTS) 114 libc.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 115 $(AR) rc libc.a $(LIBS) $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 139 116 140 117 arch/$(UARCH)/_link.ld: arch/$(UARCH)/_link.ld.in … … 149 126 %.o: %.c 150 127 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 151 152 %.pio: %.S153 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@154 155 %.pio: %.s156 $(AS) $(AFLAGS) $< -o $@157 158 %.pio: %.c159 $(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@ -
uspace/lib/libc/arch/ia32/src/syscall.S
rb50b5af2 ra71c158 65 65 */ 66 66 .global __syscall_sysenter 67 .type __syscall_sysenter, @function68 69 67 __syscall_sysenter: 70 68 pushl %ebx … … 91 89 popl %ebx 92 90 ret 93 94 .size __syscall_sysenter, . - __syscall_sysenter -
uspace/lib/libc/arch/ia32/src/tls.c
rb50b5af2 ra71c158 37 37 #include <tls.h> 38 38 #include <sys/types.h> 39 #include <align.h>40 39 41 40 tcb_t * __alloc_tls(void **data, size_t size) … … 49 48 } 50 49 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 //#endif77 78 50 /** @} 79 51 */ -
uspace/lib/libc/arch/mips32/src/tls.c
rb50b5af2 ra71c158 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 69 49 /** @} 70 50 */ -
uspace/lib/libc/arch/ppc32/src/tls.c
rb50b5af2 ra71c158 1 1 /* 2 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Jiri Svoboda4 3 * All rights reserved. 5 4 * … … 35 34 36 35 #include <tls.h> 37 #include <align.h>38 36 #include <sys/types.h> 39 37 … … 48 46 } 49 47 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 81 48 /** @} 82 49 */ -
uspace/lib/libc/generic/async.c
rb50b5af2 ra71c158 178 178 179 179 /** Identifier of the incoming connection handled by the current fibril. */ 180 staticfibril_local connection_t *FIBRIL_connection;180 fibril_local connection_t *FIBRIL_connection; 181 181 182 182 static void default_client_connection(ipc_callid_t callid, ipc_call_t *call); -
uspace/lib/libc/generic/libc.c
rb50b5af2 ra71c158 53 53 #include <loader/pcb.h> 54 54 55 /* From librtld. */56 #include <rtld.h>57 #include <string.h>58 59 55 extern int main(int argc, char *argv[]); 60 56 … … 79 75 char **argv; 80 76 81 #ifdef __IN_SHARED_LIBC__82 if (__pcb != NULL && __pcb->rtld_runtime != NULL) {83 runtime_env = (runtime_env_t *) __pcb->rtld_runtime;84 }85 #endif86 87 77 if (__pcb == NULL) { 88 78 argc = 0; -
uspace/lib/libc/generic/time.c
rb50b5af2 ra71c158 148 148 if (res) { 149 149 printf("Failed to initialize timeofday memarea\n"); 150 printf("Address was 0x%x\n", (unsigned)mapping);151 150 _exit(1); 152 151 } -
uspace/lib/libc/include/as.h
rb50b5af2 ra71c158 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 int as_area_change_flags(void *address, int flags);45 extern 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
rb50b5af2 ra71c158 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;73 71 } pcb_t; 74 72 -
uspace/lib/softint/Makefile
rb50b5af2 ra71c158 1 1 # 2 2 # Copyright (c) 2005 Martin Decky 3 # Copyright (c) 2008 Jiri Svoboda4 3 # All rights reserved. 5 4 # … … 39 38 40 39 CFLAGS += -Iinclude 41 PIC_CFLAGS := $(CFLAGS) -fPIC -D__PIC__42 40 43 41 ## Sources … … 51 49 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 52 50 53 OBJECTS := $(GENERIC_OBJECTS)54 PIC_OBJECTS := $(addsuffix .pio,$(basename $(OBJECTS)))55 56 51 .PHONY: all clean depend 57 52 58 all: libsoftint.a libsoftint.pic.a53 all: libsoftint.a 59 54 60 55 -include Makefile.depend 61 56 62 57 clean: 63 -rm -f libsoftint.a libsoftint.pic.aMakefile.depend64 find generic/ \( -name '*.o' -o -name '*.pio' \)-follow -exec rm \{\} \;58 -rm -f libsoftint.a Makefile.depend 59 find generic/ -name '*.o' -follow -exec rm \{\} \; 65 60 66 61 depend: 67 62 -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/null69 63 70 libsoftint.a: depend $(OBJECTS) 71 $(AR) rc $@ $(OBJECTS) 72 73 libsoftint.pic.a: depend $(PIC_OBJECTS) 74 $(AR) rc $@ $(PIC_OBJECTS) 64 libsoftint.a: depend $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 65 $(AR) rc libsoftint.a $(ARCH_OBJECTS) $(GENERIC_OBJECTS) 75 66 76 67 %.o: %.S … … 82 73 %.o: %.c 83 74 $(CC) $(DEFS) $(CFLAGS) -c $< -o $@ 84 85 %.pio: %.S86 $(CC) $(DEFS) $(AFLAGS) $(CFLAGS) -D__ASM__ -c $< -o $@87 88 %.pio: %.s89 $(AS) $(AFLAGS) $< -o $@90 91 %.pio: %.c92 $(CC) $(DEFS) $(PIC_CFLAGS) -c $< -o $@ -
uspace/srv/kbd/Makefile
rb50b5af2 ra71c158 33 33 SOFTINT_PREFIX = ../../lib/softint 34 34 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app 35 include $(LIBC_PREFIX)/Makefile.toolchain 37 36 38 37 CFLAGS += -Iinclude 38 39 LIBS = $(LIBC_PREFIX)/libc.a 39 40 40 41 ## Sources … … 168 169 169 170 $(OUTPUT): $(OBJECTS) $(LIBS) 170 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map171 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 171 172 172 173 disasm: $(OUTPUT).disasm -
uspace/srv/loader/elf_load.c
rb50b5af2 ra71c158 102 102 * @return EOK on success or negative error code. 103 103 */ 104 int elf_load_file(char *file_name, size_t so_bias, eld_flags_t flags, 105 elf_info_t *info) 104 int elf_load_file(char *file_name, size_t so_bias, elf_info_t *info) 106 105 { 107 106 elf_ld_t elf; … … 118 117 elf.fd = fd; 119 118 elf.info = info; 120 elf.flags = flags;121 119 122 120 rc = elf_load(&elf, so_bias); … … 125 123 126 124 return rc; 125 } 126 127 /** Run an ELF executable. 128 * 129 * Transfers control to the entry point of an ELF executable loaded 130 * 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 */ 127 139 } 128 140 … … 139 151 pcb->entry = info->entry; 140 152 pcb->dynamic = info->dynamic; 141 pcb->rtld_runtime = NULL;142 153 } 143 154 … … 292 303 break; 293 304 case PT_INTERP: 294 /* Assume silently interp == "/ app/dload" */295 elf->info->interp = "/ app/dload";305 /* Assume silently interp == "/rtld.so" */ 306 elf->info->interp = "/rtld.so"; 296 307 break; 297 308 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;307 309 case PT_SHLIB: 308 310 case PT_NOTE: 309 //case PT_LOPROC:310 //case PT_HIPROC:311 case PT_LOPROC: 312 case PT_HIPROC: 311 313 default: 312 314 DPRINTF("Segment p_type %d unknown.\n", entry->p_type); … … 378 380 AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE); 379 381 if (a == (void *)(-1)) { 380 DPRINTF("memory mapping failed (0x%x, %d)\n", 381 base+bias, mem_sz); 382 DPRINTF("Memory mapping failed.\n"); 382 383 return EE_MEMORY; 383 384 } … … 421 422 } 422 423 423 /*424 * The caller wants to modify the segments first. He will then425 * 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);430 424 rc = as_area_change_flags(seg_ptr, flags); 431 425 if (rc != 0) { … … 464 458 break; 465 459 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); 466 465 break; 467 466 default: -
uspace/srv/loader/include/elf_load.h
rb50b5af2 ra71c158 43 43 #include "elf.h" 44 44 45 typedef enum {46 /** Leave all segments in RW access mode. */47 ELDF_RW = 148 } eld_flags_t;49 50 45 /** 51 46 * Some data extracted from the headers are stored here … … 72 67 uintptr_t bias; 73 68 74 /** Flags passed to the ELF loader. */75 eld_flags_t flags;76 77 69 /** A copy of the ELF file header */ 78 70 elf_header_t *header; … … 82 74 } elf_ld_t; 83 75 84 int elf_load_file(char *file_name, size_t so_bias, el d_flags_t flags,85 elf_info_t *info);76 int elf_load_file(char *file_name, size_t so_bias, elf_info_t *info); 77 void elf_run(elf_info_t *info, pcb_t *pcb); 86 78 void elf_create_pcb(elf_info_t *info, pcb_t *pcb); 87 79 -
uspace/srv/loader/main.c
rb50b5af2 ra71c158 66 66 #define DPRINTF(...) 67 67 68 void program_run(void *entry, pcb_t *pcb);69 70 68 /** Pathname of the file that will be loaded */ 71 69 static char *pathname = NULL; … … 306 304 int rc; 307 305 308 rc = elf_load_file(pathname, 0, 0,&prog_info);306 rc = elf_load_file(pathname, 0, &prog_info); 309 307 if (rc != EE_OK) { 310 308 DPRINTF("Failed to load executable '%s'.\n", pathname); … … 328 326 } 329 327 330 printf("Load ELF interpreter '%s'\n", prog_info.interp); 331 rc = elf_load_file(prog_info.interp, 0, 0, &interp_info); 328 rc = elf_load_file(prog_info.interp, 0, &interp_info); 332 329 if (rc != EE_OK) { 333 330 DPRINTF("Failed to load interpreter '%s.'\n", … … 337 334 } 338 335 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 344 336 is_dyn_linked = true; 345 337 ipc_answer_0(rid, EOK); … … 370 362 371 363 ipc_answer_0(rid, EOK); 372 program_run(interp_info.entry, &pcb);364 elf_run(&interp_info, &pcb); 373 365 } else { 374 366 /* Statically linked program */ 375 367 ipc_answer_0(rid, EOK); 376 program_run(prog_info.entry, &pcb);368 elf_run(&prog_info, &pcb); 377 369 } 378 370 -
uspace/srv/pci/Makefile
rb50b5af2 ra71c158 34 34 35 35 include $(LIBC_PREFIX)/Makefile.toolchain 36 include $(LIBC_PREFIX)/Makefile.app37 36 38 LIBS := libpci/libpci.a $(LIBS) 37 38 LIBS = libpci/libpci.a $(LIBC_PREFIX)/libc.a 39 39 40 40 ## Sources … … 62 62 $(OUTPUT): $(OBJECTS) $(LIBS) 63 63 $(MAKE) -C libpci 64 $(LD) -T $(L D_SCRIPT)$(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map64 $(LD) -T $(LIBC_PREFIX)/arch/$(UARCH)/_link.ld $(OBJECTS) $(LIBS) $(LFLAGS) -o $@ -Map $(OUTPUT).map 65 65 66 66 disasm:
Note:
See TracChangeset
for help on using the changeset viewer.