Rev 2482 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2482 | Rev 2586 | ||
|---|---|---|---|
| Line 33... | Line 33... | ||
| 33 | */ |
33 | */ |
| 34 | 34 | ||
| 35 | #ifndef LIBC_amd64_THREAD_H_ |
35 | #ifndef LIBC_amd64_THREAD_H_ |
| 36 | #define LIBC_amd64_THREAD_H_ |
36 | #define LIBC_amd64_THREAD_H_ |
| 37 | 37 | ||
| 38 | #include <libc.h> |
- | |
| 39 | - | ||
| 40 | typedef struct { |
- | |
| 41 | void *self; |
- | |
| 42 | void *fibril_data; |
- | |
| 43 | } tcb_t; |
- | |
| 44 | - | ||
| 45 | static inline void __tcb_set(tcb_t *tcb) |
- | |
| 46 | { |
- | |
| 47 | __SYSCALL1(SYS_TLS_SET, (sysarg_t) tcb); |
- | |
| 48 | } |
- | |
| 49 | - | ||
| 50 | static inline tcb_t * __tcb_get(void) |
- | |
| 51 | { |
- | |
| 52 | void * retval; |
- | |
| 53 | - | ||
| 54 | asm ("movq %%fs:0, %0" : "=r"(retval)); |
- | |
| 55 | return retval; |
- | |
| 56 | } |
- | |
| 57 | - | ||
| 58 | #endif |
38 | #endif |
| 59 | 39 | ||
| 60 | /** @} |
40 | /** @} |
| 61 | */ |
41 | */ |