Deleted Added
full compact
pcpu.h (225736) pcpu.h (239996)
1/*-
2 * Copyright (c) Peter Wemm
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
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: stable/9/sys/i386/include/pcpu.h 216956 2011-01-04 14:49:54Z rwatson $
26 * $FreeBSD: stable/9/sys/i386/include/pcpu.h 239996 2012-09-01 15:59:09Z kib $
27 */
28
29#ifndef _MACHINE_PCPU_H_
30#define _MACHINE_PCPU_H_
31
32#ifndef _SYS_CDEFS_H_
33#error "sys/cdefs.h is a prerequisite for this file"
34#endif

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

231} while (0)
232
233#define PCPU_GET(member) __PCPU_GET(pc_ ## member)
234#define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val)
235#define PCPU_INC(member) __PCPU_INC(pc_ ## member)
236#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member)
237#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val)
238
27 */
28
29#ifndef _MACHINE_PCPU_H_
30#define _MACHINE_PCPU_H_
31
32#ifndef _SYS_CDEFS_H_
33#error "sys/cdefs.h is a prerequisite for this file"
34#endif

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

231} while (0)
232
233#define PCPU_GET(member) __PCPU_GET(pc_ ## member)
234#define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val)
235#define PCPU_INC(member) __PCPU_INC(pc_ ## member)
236#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member)
237#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val)
238
239#define OFFSETOF_CURTHREAD 0
240#ifdef __clang__
241#pragma clang diagnostic push
242#pragma clang diagnostic ignored "-Wnull-dereference"
243#endif
239static __inline __pure2 struct thread *
240__curthread(void)
241{
242 struct thread *td;
243
244static __inline __pure2 struct thread *
245__curthread(void)
246{
247 struct thread *td;
248
244 __asm("movl %%fs:0,%0" : "=r" (td));
249 __asm("movl %%fs:%1,%0" : "=r" (td)
250 : "m" (*(char *)OFFSETOF_CURTHREAD));
245 return (td);
246}
251 return (td);
252}
253#ifdef __clang__
254#pragma clang diagnostic pop
255#endif
247#define curthread (__curthread())
248
256#define curthread (__curthread())
257
258#define OFFSETOF_CURPCB 16
259static __inline __pure2 struct pcb *
260__curpcb(void)
261{
262 struct pcb *pcb;
263
264 __asm("movl %%fs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB));
265 return (pcb);
266}
267#define curpcb (__curpcb())
268
249#else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */
250
251#error "this file needs to be ported to your compiler"
252
253#endif /* lint, etc. */
254
255#endif /* _KERNEL */
256
257#endif /* !_MACHINE_PCPU_H_ */
269#else /* !lint || defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */
270
271#error "this file needs to be ported to your compiler"
272
273#endif /* lint, etc. */
274
275#endif /* _KERNEL */
276
277#endif /* !_MACHINE_PCPU_H_ */