Deleted Added
full compact
pcpu.h (122932) 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/amd64/include/pcpu.h 122932 2003-11-20 23:49:28Z peter $
26 * $FreeBSD: head/sys/amd64/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/*
35 * The SMP parts are setup in pmap.c and locore.s for the BSP, and
36 * mp_machdep.c sets up the data for the AP's to "see" when they awake.
37 * The reason for doing it via a struct is so that an array of pointers
38 * to each CPU's data can be set up for things like "check curproc on all
39 * other processors"

--- 10 unchanged lines hidden (view full) ---

50#if defined(lint)
51
52extern struct pcpu *pcpup;
53
54#define PCPU_GET(member) (pcpup->pc_ ## member)
55#define PCPU_PTR(member) (&pcpup->pc_ ## member)
56#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value))
57
36#ifdef _KERNEL
37
38/*
39 * The SMP parts are setup in pmap.c and locore.s for the BSP, and
40 * mp_machdep.c sets up the data for the AP's to "see" when they awake.
41 * The reason for doing it via a struct is so that an array of pointers
42 * to each CPU's data can be set up for things like "check curproc on all
43 * other processors"

--- 10 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
58#elif defined(__GNUC__)
62#elif defined(__GNUCLIKE___TYPEOF) && defined(__GNUCLIKE___OFFSETOF) \
63 && defined(__GNUCLIKE_ASM)
59
60/*
61 * Evaluates to the byte offset of the per-cpu variable name.
62 */
63#define __pcpu_offset(name) \
64 __offsetof(struct pcpu, name)
65
66/*

--- 98 unchanged lines hidden (view full) ---

165 struct thread *td;
166
167 __asm __volatile("movq %%gs:0,%0" : "=r" (td));
168 return (td);
169}
170#define curthread (__curthread())
171
172#else
64
65/*
66 * Evaluates to the byte offset of the per-cpu variable name.
67 */
68#define __pcpu_offset(name) \
69 __offsetof(struct pcpu, name)
70
71/*

--- 98 unchanged lines hidden (view full) ---

170 struct thread *td;
171
172 __asm __volatile("movq %%gs:0,%0" : "=r" (td));
173 return (td);
174}
175#define curthread (__curthread())
176
177#else
173#error gcc or lint is required to use this file
178#error this file needs to be ported to your compiler
174#endif
175
176#endif /* _KERNEL */
177
178#endif /* ! _MACHINE_PCPU_H_ */
179#endif
180
181#endif /* _KERNEL */
182
183#endif /* ! _MACHINE_PCPU_H_ */