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_ppc32_THREAD_H_ |
35 | #ifndef LIBC_ppc32_THREAD_H_ |
36 | #define LIBC_ppc32_THREAD_H_ |
36 | #define LIBC_ppc32_THREAD_H_ |
37 | 37 | ||
38 | #define PPC_TP_OFFSET 0x7000 |
- | |
39 | - | ||
40 | typedef struct { |
- | |
41 | void *fibril_data; |
- | |
42 | } tcb_t; |
- | |
43 | - | ||
44 | static inline void __tcb_set(tcb_t *tcb) |
- | |
45 | { |
- | |
46 | void *tp = tcb; |
- | |
47 | tp += PPC_TP_OFFSET + sizeof(tcb_t); |
- | |
48 | - | ||
49 | asm volatile ( |
- | |
50 | "mr %%r2, %0\n" |
- | |
51 | : |
- | |
52 | : "r" (tp) |
- | |
53 | ); |
- | |
54 | } |
- | |
55 | - | ||
56 | static inline tcb_t * __tcb_get(void) |
- | |
57 | { |
- | |
58 | void * retval; |
- | |
59 | - | ||
60 | asm volatile ( |
- | |
61 | "mr %0, %%r2\n" |
- | |
62 | : "=r" (retval) |
- | |
63 | ); |
- | |
64 | - | ||
65 | return (tcb_t *)(retval - PPC_TP_OFFSET - sizeof(tcb_t)); |
- | |
66 | } |
- | |
67 | - | ||
68 | #endif |
38 | #endif |
69 | 39 | ||
70 | /** @} |
40 | /** @} |
71 | */ |
41 | */ |