2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * @(#)types.h 8.3 (Berkeley) 1/5/94
34 * $FreeBSD: src/sys/i386/include/types.h,v 1.19.2.1 2001/03/21 10:50:58 peter Exp $
40 #include <machine/stdint.h>
42 typedef unsigned long vm_offset_t; /* address space bounded offset */
43 typedef unsigned long vm_size_t; /* address space bounded size */
44 typedef __int64_t vm_ooffset_t; /* VM object bounded offset */
45 typedef __uint64_t vm_pindex_t; /* physical page index */
46 typedef __uint64_t vm_poff_t; /* physical offset */
47 typedef __uint64_t vm_paddr_t; /* physical addr (same as vm_poff_t) */
49 typedef __int32_t __segsz_t; /* segment size */
51 typedef __int32_t register_t;
52 typedef __uint32_t u_register_t;
55 typedef int intfptr_t;
56 typedef unsigned int uintfptr_t;
62 typedef __uint32_t pd_entry_t;
63 typedef __uint32_t pt_entry_t;
64 typedef __uint32_t cpumask_t; /* mask representing a set of cpus */
65 typedef __uint32_t cpulock_t; /* count and exclusive lock */
67 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
70 * NOTE! CPUMASK_TESTMASK() - caller should only test == 0 or != 0
73 #define CPUMASK_INITIALIZER_ALLONES (cpumask_t)-1
74 #define CPUMASK_INITIALIZER_ONLYONE (cpumask_t)1
76 #define CPUMASK_SIMPLE(cpu) (1U << (cpu))
77 #define BSRCPUMASK(mask) bsrl(mask)
78 #define BSFCPUMASK(mask) bsfl(mask)
80 #define CPUMASK_CMPMASKEQ(mask1, mask2) ((mask1) == (mask2))
81 #define CPUMASK_CMPMASKNEQ(mask1, mask2) ((mask1) != (mask2))
82 #define CPUMASK_ISUP(mask) ((mask) == 1)
84 #define CPUMASK_TESTZERO(mask) ((mask) == 0)
85 #define CPUMASK_TESTNZERO(mask) ((mask) != 0)
86 #define CPUMASK_TESTBIT(mask, i) ((mask) & CPUMASK_SIMPLE(i))
87 #define CPUMASK_TESTMASK(mask1, mask2) ((mask1) & (mask2))
88 #define CPUMASK_LOWMASK(mask) (mask)
90 #define CPUMASK_ORBIT(mask, i) mask |= CPUMASK_SIMPLE(i)
91 #define CPUMASK_ANDBIT(mask, i) mask &= CPUMASK_SIMPLE(i)
92 #define CPUMASK_NANDBIT(mask, i) mask &= ~CPUMASK_SIMPLE(i)
94 #define CPUMASK_ASSZERO(mask) mask = 0
95 #define CPUMASK_ASSALLONES(mask) mask = (cpumask_t)-1
96 #define CPUMASK_ASSBIT(mask, i) mask = CPUMASK_SIMPLE(i)
97 #define CPUMASK_ASSBMASK(mask, i) mask = (CPUMASK_SIMPLE(i) - 1)
98 #define CPUMASK_ASSNBMASK(mask, i) mask = ~(CPUMASK_SIMPLE(i) - 1)
100 #define CPUMASK_ANDMASK(mask, m1) mask &= (m1)
101 #define CPUMASK_NANDMASK(mask, m1) mask &= ~(m1)
102 #define CPUMASK_ORMASK(mask, m1) mask |= (m1)
104 #define ATOMIC_CPUMASK_ORBIT(mask, i) \
105 atomic_set_cpumask(&(mask), CPUMASK_SIMPLE(i))
106 #define ATOMIC_CPUMASK_NANDBIT(mask, i) \
107 atomic_clear_cpumask(&(mask), CPUMASK_SIMPLE(i))
108 #define ATOMIC_CPUMASK_ORMASK(mask, m1) \
109 atomic_set_cpumask(&(mask), m1)
110 #define ATOMIC_CPUMASK_NANDMASK(mask, m1) \
111 atomic_clear_cpumask(&(mask), m1)
115 #define CPULOCK_EXCLBIT 0 /* exclusive lock bit number */
116 #define CPULOCK_EXCL 0x00000001 /* exclusive lock */
117 #define CPULOCK_INCR 0x00000002 /* auxillary counter add/sub */
118 #define CPULOCK_CNTMASK 0x7FFFFFFE
120 #define PDESIZE sizeof(pd_entry_t) /* for assembly files */
121 #define PTESIZE sizeof(pt_entry_t) /* for assembly files */
123 #endif /* !_CPU_TYPES_H_ */