Changeset fa23560 in mainline for uspace/lib/libc/arch/mips32
- Timestamp:
- 2007-10-30T22:54:11Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4d21cf8
- Parents:
- b2a0f6dd
- Location:
- uspace/lib/libc/arch/mips32
- Files:
-
- 1 added
- 2 edited
- 1 moved
-
Makefile.inc (modified) (1 diff)
-
include/thread.h (modified) (1 diff)
-
include/tls.h (added)
-
src/tls.c (moved) (moved from uspace/lib/libc/arch/mips32/src/thread.c ) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/arch/mips32/Makefile.inc
rb2a0f6dd rfa23560 41 41 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \ 42 42 arch/$(ARCH)/src/fibril.S \ 43 arch/$(ARCH)/src/t hread.c43 arch/$(ARCH)/src/tls.c 44 44 45 45 -
uspace/lib/libc/arch/mips32/include/thread.h
rb2a0f6dd rfa23560 34 34 */ 35 35 36 /* TLS for MIPS is described in http://www.linux-mips.org/wiki/NPTL */37 38 36 #ifndef LIBC_mips32_THREAD_H_ 39 37 #define LIBC_mips32_THREAD_H_ 40 41 /* I did not find any specification (neither MIPS nor PowerPC), but42 * as I found it43 * - it uses Variant II44 * - TCB is at Address(First TLS Block)+0x7000.45 * - DTV is at Address(First TLS Block)+0x800046 * - What would happen if the TLS data was larger then 0x7000?47 * - The linker never accesses DTV directly, has the second definition any48 * sense?49 * We will make it this way:50 * - TCB is at TP-0x7000-sizeof(tcb)51 * - No assumption about DTV etc., but it will not have a fixed address52 */53 #define MIPS_TP_OFFSET 0x700054 55 typedef struct {56 void *fibril_data;57 } tcb_t;58 59 static inline void __tcb_set(tcb_t *tcb)60 {61 void *tp = tcb;62 tp += MIPS_TP_OFFSET + sizeof(tcb_t);63 64 asm volatile ("add $27, %0, $0" : : "r"(tp)); /* Move tls to K1 */65 }66 67 static inline tcb_t * __tcb_get(void)68 {69 void * retval;70 71 asm volatile("add %0, $27, $0" : "=r"(retval));72 73 return (tcb_t *)(retval - MIPS_TP_OFFSET - sizeof(tcb_t));74 }75 38 76 39 #endif -
uspace/lib/libc/arch/mips32/src/tls.c
rb2a0f6dd rfa23560 34 34 */ 35 35 36 #include <t hread.h>37 #include < malloc.h>36 #include <tls.h> 37 #include <sys/types.h> 38 38 39 /** Allocate TLS & TCB for initial module threads40 *41 * @param data (out) Start of TLS section42 * @param size Size of tdata+tbss section43 * @return pointer to tcb_t structure44 */45 39 tcb_t * __alloc_tls(void **data, size_t size) 46 40 { 47 tcb_t *result; 48 49 result = malloc(sizeof(tcb_t) + size); 50 *data = ((void *)result) + sizeof(tcb_t); 51 return result; 41 return tls_alloc_variant_1(data, size); 52 42 } 53 43 54 44 void __free_tls_arch(tcb_t *tcb, size_t size) 55 45 { 56 free(tcb);46 tls_free_variant_1(tcb, size); 57 47 } 58 48
Note:
See TracChangeset
for help on using the changeset viewer.
