pcpu.h (126891) | pcpu.h (143063) |
---|---|
1/*- 2 * Copyright (c) Peter Wemm <peter@netplex.com.au> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) Peter Wemm <peter@netplex.com.au> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/i386/include/pcpu.h 126891 2004-03-12 21:45:33Z trhodes $ | 26 * $FreeBSD: head/sys/i386/include/pcpu.h 143063 2005-03-02 21:33:29Z joerg $ |
27 */ 28 29#ifndef _MACHINE_PCPU_H_ 30#define _MACHINE_PCPU_H_ 31 | 27 */ 28 29#ifndef _MACHINE_PCPU_H_ 30#define _MACHINE_PCPU_H_ 31 |
32#ifndef _SYS_CDEFS_H_ 33#error this file needs sys/cdefs.h as a prerequisite 34#endif 35 |
|
32#ifdef _KERNEL 33 34#include <machine/segments.h> 35#include <machine/tss.h> 36 37/* 38 * The SMP parts are setup in pmap.c and locore.s for the BSP, and 39 * mp_machdep.c sets up the data for the AP's to "see" when they awake. --- 14 unchanged lines hidden (view full) --- 54#if defined(lint) 55 56extern struct pcpu *pcpup; 57 58#define PCPU_GET(member) (pcpup->pc_ ## member) 59#define PCPU_PTR(member) (&pcpup->pc_ ## member) 60#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) 61 | 36#ifdef _KERNEL 37 38#include <machine/segments.h> 39#include <machine/tss.h> 40 41/* 42 * The SMP parts are setup in pmap.c and locore.s for the BSP, and 43 * mp_machdep.c sets up the data for the AP's to "see" when they awake. --- 14 unchanged lines hidden (view full) --- 58#if defined(lint) 59 60extern struct pcpu *pcpup; 61 62#define PCPU_GET(member) (pcpup->pc_ ## member) 63#define PCPU_PTR(member) (&pcpup->pc_ ## member) 64#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) 65 |
62#elif defined(__GNUC__) || defined (__INTEL_COMPILER) | 66#elif defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) \ 67 && defined(__GNUCLIKE___OFFSETOF) |
63 64/* 65 * Evaluates to the byte offset of the per-cpu variable name. 66 */ 67#define __pcpu_offset(name) \ 68 __offsetof(struct pcpu, name) 69 70/* --- 86 unchanged lines hidden (view full) --- 157 struct thread *td; 158 159 __asm __volatile("movl %%fs:0,%0" : "=r" (td)); 160 return (td); 161} 162#define curthread (__curthread()) 163 164#else | 68 69/* 70 * Evaluates to the byte offset of the per-cpu variable name. 71 */ 72#define __pcpu_offset(name) \ 73 __offsetof(struct pcpu, name) 74 75/* --- 86 unchanged lines hidden (view full) --- 162 struct thread *td; 163 164 __asm __volatile("movl %%fs:0,%0" : "=r" (td)); 165 return (td); 166} 167#define curthread (__curthread()) 168 169#else |
165#error gcc or lint is required to use this file | 170#error this file needs to be ported to your compiler |
166#endif 167 168#endif /* _KERNEL */ 169 170#endif /* ! _MACHINE_PCPU_H_ */ | 171#endif 172 173#endif /* _KERNEL */ 174 175#endif /* ! _MACHINE_PCPU_H_ */ |