Changeset cfa70add in mainline for uspace/libc/arch/sparc64/include/thread.h
- Timestamp:
- 2006-09-03T23:37:14Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fd85ae5
- Parents:
- 002e613
- File:
-
- 1 edited
-
uspace/libc/arch/sparc64/include/thread.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/arch/sparc64/include/thread.h
r002e613 rcfa70add 1 1 /* 2 * Copyright (C) 2006 Martin Decky 2 * Copyright (C) 2006 Ondrej Palkovsky 3 * Copyright (C) 2006 Jakub Jermar 3 4 * All rights reserved. 4 5 * … … 27 28 */ 28 29 29 /** @addtogroup libcsparc64 30 /** @addtogroup libcsparc64 30 31 * @{ 31 32 */ 32 /** @file 33 /** 34 * @file 35 * @brief sparc64 TLS functions. 36 * 37 * The implementation is based on the IA-32 implementation which was also 38 * designed by Sun and is virtually the same, except the TCB is stored in 39 * %g7 (of the normal set). 33 40 */ 34 41 35 #ifndef __LIBC__sparc64__THREAD_H__ 36 #define __LIBC__sparc64__THREAD_H__ 37 38 #define PPC_TP_OFFSET 0x7000 42 #ifndef LIBC_sparc64_THREAD_H_ 43 #define LIBC_sparc64_THREAD_H_ 39 44 40 45 typedef struct { 46 void *self; 41 47 void *pst_data; 42 48 } tcb_t; … … 44 50 static inline void __tcb_set(tcb_t *tcb) 45 51 { 46 void *tp = tcb; 47 tp += PPC_TP_OFFSET + sizeof(tcb_t); 52 __asm__ volatile ("mov %0, %%g7\n" : : "r" (tcb) : "g7"); 48 53 } 49 54 50 static inline tcb_t * __tcb_get(void)55 static inline tcb_t * __tcb_get(void) 51 56 { 52 return (tcb_t *)(PPC_TP_OFFSET - sizeof(tcb_t)); 57 void *retval; 58 59 __asm__ volatile ("mov %%g7, %0\n" : "=r" (retval)); 60 61 return retval; 53 62 } 54 63
Note:
See TracChangeset
for help on using the changeset viewer.
