Changeset c4c5de5 in mainline for libc/arch/mips32
- Timestamp:
- 2006-03-24T14:29:19Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8fe1cdb
- Parents:
- 520492a
- Location:
- libc/arch/mips32
- Files:
-
- 1 added
- 4 edited
-
Makefile.inc (modified) (1 diff)
-
_link.ld.in (modified) (1 diff)
-
include/psthread.h (modified) (1 diff)
-
include/thread.h (modified) (1 diff)
-
src/thread.c (added)
Legend:
- Unmodified
- Added
- Removed
-
libc/arch/mips32/Makefile.inc
r520492a rc4c5de5 35 35 36 36 ARCH_SOURCES += arch/$(ARCH)/src/syscall.c \ 37 arch/$(ARCH)/src/psthread.S 37 arch/$(ARCH)/src/psthread.S \ 38 arch/$(ARCH)/src/thread.c 38 39 39 40 -
libc/arch/mips32/_link.ld.in
r520492a rc4c5de5 22 22 *(.data.rel*); 23 23 } :data 24 24 25 .got : { 25 26 _gp = .; 26 27 *(.got); 27 28 } :data 29 30 .tdata : { 31 _tdata_start = .; 32 *(.tdata); 33 _tdata_end = .; 34 } :data 35 .tbss : { 36 _tbss_start = .; 37 *(.tbss); 38 _tbss_end = .; 39 } :data 40 28 41 .sbss : { 29 42 *(.scommon); -
libc/arch/mips32/include/psthread.h
r520492a rc4c5de5 32 32 #include <types.h> 33 33 34 /* We define our own context_set, because we need to set 35 * the TLS pointer to the tcb+0x7000 36 * 37 * See tls_set in thread.h 38 */ 39 #define context_set(c, _pc, stack, size, ptls) \ 40 (c)->pc = (sysarg_t) (_pc); \ 41 (c)->sp = ((sysarg_t) (stack)) + (size) - SP_DELTA; \ 42 (c)->tls = ((sysarg_t)(ptls)) + 0x7000 + sizeof(tcb_t); 43 44 34 45 /* +16 is just for sure that the called function 35 46 * have space to store it's arguments -
libc/arch/mips32/include/thread.h
r520492a rc4c5de5 32 32 #define __LIBC__mips32THREAD_H__ 33 33 34 static inline void __tls_set(void *tls) 34 /* I did not find any specification (neither MIPS nor PowerPC), but 35 * as I found it 36 * - it uses Variant II 37 * - TCB is at Address(First TLS Block)+0x7000. 38 * - DTV is at Address(First TLS Block)+0x8000 39 * - What would happen if the TLS data was larger then 0x7000? 40 * - The linker never accesses DTV directly, has the second definition any 41 * sense? 42 * We will make it this way: 43 * - TCB is at TP-0x7000-sizeof(tcb) 44 * - No assumption about DTV etc., but it will not have a fixed address 45 */ 46 #define MIPS_TP_OFFSET 0x7000 47 48 typedef struct { 49 void *pst_data; 50 } tcb_t; 51 52 static inline void __tcb_set(tcb_t *tcb) 35 53 { 36 __asm__ volatile ("add $27, %0, $0" : : "r"(tls)); /* Move tls to K1 */ 54 void *tp = tcb; 55 tp += MIPS_TP_OFFSET + sizeof(tcb_t); 56 57 __asm__ volatile ("add $27, %0, $0" : : "r"(tp)); /* Move tls to K1 */ 37 58 } 38 59 39 static inline void * __tls_get(void)60 static inline tcb_t * __tcb_get(void) 40 61 { 41 62 void * retval; 42 63 43 64 __asm__ volatile("add %0, $27, $0" : "=r"(retval)); 44 return retval; 65 66 return (tcb_t *)(retval - MIPS_TP_OFFSET - sizeof(tcb_t)); 45 67 } 46 68
Note:
See TracChangeset
for help on using the changeset viewer.
