pcpu.h (202175) | pcpu.h (203180) |
---|---|
1/*- 2 * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org> 3 * Copyright (c) Peter Wemm <peter@netplex.com.au> 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: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * from: src/sys/alpha/include/pcpu.h,v 1.15 2004/11/05 19:16:44 jhb | 1/*- 2 * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org> 3 * Copyright (c) Peter Wemm <peter@netplex.com.au> 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: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * from: src/sys/alpha/include/pcpu.h,v 1.15 2004/11/05 19:16:44 jhb |
28 * $FreeBSD: head/sys/mips/include/pcpu.h 202175 2010-01-12 21:36:08Z imp $ | 28 * $FreeBSD: head/sys/mips/include/pcpu.h 203180 2010-01-30 01:54:29Z neel $ |
29 */ 30 31#ifndef _MACHINE_PCPU_H_ 32#define _MACHINE_PCPU_H_ 33 34#include <machine/pte.h> 35 36#define PCPU_MD_FIELDS \ 37 pd_entry_t *pc_segbase; /* curthread segbase */ \ 38 struct pmap *pc_curpmap; /* pmap of curthread */ \ 39 u_int32_t pc_next_asid; /* next ASID to alloc */ \ 40 u_int32_t pc_asid_generation; /* current ASID generation */ \ | 29 */ 30 31#ifndef _MACHINE_PCPU_H_ 32#define _MACHINE_PCPU_H_ 33 34#include <machine/pte.h> 35 36#define PCPU_MD_FIELDS \ 37 pd_entry_t *pc_segbase; /* curthread segbase */ \ 38 struct pmap *pc_curpmap; /* pmap of curthread */ \ 39 u_int32_t pc_next_asid; /* next ASID to alloc */ \ 40 u_int32_t pc_asid_generation; /* current ASID generation */ \ |
41 u_int pc_pending_ipis; /* the IPIs pending to this CPU */ \ 42 void *pc_boot_stack; | 41 u_int pc_pending_ipis; /* IPIs pending to this CPU */ |
43 44#ifdef _KERNEL 45 | 42 43#ifdef _KERNEL 44 |
46#ifdef SMP 47static __inline struct pcpu* 48get_pcpup(void) 49{ 50 /* 51 * FREEBSD_DEVELOPERS_FIXME 52 * In multiprocessor case, store/retrieve the pcpu structure 53 * address for current CPU in scratch register for fast access. 54 * 55 * In this routine, read the scratch register to retrieve the PCPU 56 * structure for this CPU 57 */ 58 struct pcpu *ret; | 45extern char pcpu_space[MAXCPU][PAGE_SIZE * 2]; 46#define PCPU_ADDR(cpu) (struct pcpu *)(pcpu_space[(cpu)]) |
59 | 47 |
60 /* ret should contain the pointer to the PCPU structure for this CPU */ 61 return(ret); 62} 63 64#define PCPUP ((struct pcpu *)get_pcpup()) 65#else 66/* Uni processor systems */ | |
67extern struct pcpu *pcpup; 68#define PCPUP pcpup | 48extern struct pcpu *pcpup; 49#define PCPUP pcpup |
69#endif /* SMP */ | |
70 71#define PCPU_ADD(member, value) (PCPUP->pc_ ## member += (value)) 72#define PCPU_GET(member) (PCPUP->pc_ ## member) 73#define PCPU_INC(member) PCPU_ADD(member, 1) 74#define PCPU_PTR(member) (&PCPUP->pc_ ## member) 75#define PCPU_SET(member,value) (PCPUP->pc_ ## member = (value)) 76#define PCPU_LAZY_INC(member) (++PCPUP->pc_ ## member) 77 78#endif /* _KERNEL */ 79 80#endif /* !_MACHINE_PCPU_H_ */ | 50 51#define PCPU_ADD(member, value) (PCPUP->pc_ ## member += (value)) 52#define PCPU_GET(member) (PCPUP->pc_ ## member) 53#define PCPU_INC(member) PCPU_ADD(member, 1) 54#define PCPU_PTR(member) (&PCPUP->pc_ ## member) 55#define PCPU_SET(member,value) (PCPUP->pc_ ## member = (value)) 56#define PCPU_LAZY_INC(member) (++PCPUP->pc_ ## member) 57 58#endif /* _KERNEL */ 59 60#endif /* !_MACHINE_PCPU_H_ */ |