pthread_md.h (174112) | pthread_md.h (174127) |
---|---|
1/* 2 * Copyright 2004 by Peter Grehan. 3 * Copyright 2006 Marcel Moolenaar 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/* 2 * Copyright 2004 by Peter Grehan. 3 * Copyright 2006 Marcel Moolenaar 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 22 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $FreeBSD: head/lib/libkse/arch/powerpc/include/pthread_md.h 174112 2007-11-30 17:20:29Z deischen $ | 29 * $FreeBSD: head/lib/libkse/arch/powerpc/include/pthread_md.h 174127 2007-12-01 14:23:29Z rwatson $ |
30 */ 31 32/* 33 * Machine-dependent thread prototypes/definitions for the thread kernel. 34 */ 35#ifndef _PTHREAD_MD_H_ 36#define _PTHREAD_MD_H_ 37 --- 47 unchanged lines hidden (view full) --- 85 * From the PowerPC32 TLS spec: 86 * 87 * "r2 is the thread pointer, and points 0x7000 past the end of the 88 * thread control block." Or, 0x7008 past the start of the 8-byte tcb 89 */ 90#define TP_OFFSET 0x7008 91 92static __inline char * | 30 */ 31 32/* 33 * Machine-dependent thread prototypes/definitions for the thread kernel. 34 */ 35#ifndef _PTHREAD_MD_H_ 36#define _PTHREAD_MD_H_ 37 --- 47 unchanged lines hidden (view full) --- 85 * From the PowerPC32 TLS spec: 86 * 87 * "r2 is the thread pointer, and points 0x7000 past the end of the 88 * thread control block." Or, 0x7008 past the start of the 8-byte tcb 89 */ 90#define TP_OFFSET 0x7008 91 92static __inline char * |
93ppc_get_tp() | 93ppc_get_tp(void) |
94{ 95 register char *r2 __asm__("%r2"); 96 97 return (r2 - TP_OFFSET); 98} 99 100static __inline void 101ppc_set_tp(char *tp) 102{ 103 register char *r2 __asm__("%r2"); 104 __asm __volatile("mr %0,%1" : "=r"(r2) : "r"(tp + TP_OFFSET)); 105} 106 107static __inline struct tcb * | 94{ 95 register char *r2 __asm__("%r2"); 96 97 return (r2 - TP_OFFSET); 98} 99 100static __inline void 101ppc_set_tp(char *tp) 102{ 103 register char *r2 __asm__("%r2"); 104 __asm __volatile("mr %0,%1" : "=r"(r2) : "r"(tp + TP_OFFSET)); 105} 106 107static __inline struct tcb * |
108ppc_get_tcb() | 108ppc_get_tcb(void) |
109{ 110 return ((struct tcb *)(ppc_get_tp() - offsetof(struct tcb, tcb_tp))); 111} 112 113static __inline void 114ppc_set_tcb(struct tcb *tcb) 115{ 116 ppc_set_tp((char*)&tcb->tcb_tp); --- 176 unchanged lines hidden --- | 109{ 110 return ((struct tcb *)(ppc_get_tp() - offsetof(struct tcb, tcb_tp))); 111} 112 113static __inline void 114ppc_set_tcb(struct tcb *tcb) 115{ 116 ppc_set_tp((char*)&tcb->tcb_tp); --- 176 unchanged lines hidden --- |