3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 /*
26 * UNIX machine dependent virtual memory support.
27 */
28
29 #ifndef _VM_DEP_H
30 #define _VM_DEP_H
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #include <vm/hat_sfmmu.h>
37 #include <sys/archsystm.h>
38 #include <sys/memnode.h>
39
40 #define GETTICK() gettick()
41
42 /* tick value that should be used for random values */
43 extern u_longlong_t randtick(void);
44
45 /*
46 * Per page size free lists. Allocated dynamically.
47 */
48 #define MAX_MEM_TYPES 2 /* 0 = reloc, 1 = noreloc */
49 #define MTYPE_RELOC 0
50 #define MTYPE_NORELOC 1
51
52 #define PP_2_MTYPE(pp) (PP_ISNORELOC(pp) ? MTYPE_NORELOC : MTYPE_RELOC)
53
54 #define MTYPE_INIT(mtype, vp, vaddr, flags, pgsz) \
55 mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC;
56
57 /* mtype init for page_get_replacement_page */
58 #define MTYPE_PGR_INIT(mtype, flags, pp, mnode, pgcnt) \
59 mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC;
60
61 #define MNODETYPE_2_PFN(mnode, mtype, pfnlo, pfnhi) \
62 pfnlo = mem_node_config[mnode].physbase; \
63 pfnhi = mem_node_config[mnode].physmax;
64
65 /*
66 * candidate counters in vm_pagelist.c are indexed by color and range
67 */
68 #define MAX_MNODE_MRANGES MAX_MEM_TYPES
69 #define MNODE_RANGE_CNT(mnode) MAX_MNODE_MRANGES
70 #define MNODE_MAX_MRANGE(mnode) (MAX_MEM_TYPES - 1)
71 #define MTYPE_2_MRANGE(mnode, mtype) (mtype)
72
73 /*
74 * Internal PG_ flags.
75 */
76 #define PGI_RELOCONLY 0x10000 /* acts in the opposite sense to PG_NORELOC */
77 #define PGI_NOCAGE 0x20000 /* indicates Cage is disabled */
78 #define PGI_PGCPHIPRI 0x40000 /* page_get_contig_page priority allocation */
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2019 Joyent, Inc.
24 */
25
26 /*
27 * UNIX machine dependent virtual memory support.
28 */
29
30 #ifndef _VM_DEP_H
31 #define _VM_DEP_H
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include <vm/hat_sfmmu.h>
38 #include <sys/archsystm.h>
39 #include <sys/memnode.h>
40
41 #define GETTICK() gettick()
42
43 /* tick value that should be used for random values */
44 extern u_longlong_t randtick(void);
45
46 /*
47 * Per page size free lists. Allocated dynamically.
48 */
49 #define MAX_MEM_TYPES 2 /* 0 = reloc, 1 = noreloc */
50 #define MTYPE_RELOC 0
51 #define MTYPE_NORELOC 1
52
53 #define PP_2_MTYPE(pp) (PP_ISNORELOC(pp) ? MTYPE_NORELOC : MTYPE_RELOC)
54
55 #define MTYPE_INIT(mtype, vp, vaddr, flags, pgsz) \
56 mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC;
57
58 /* mtype init for page_get_replacement_page */
59 #define MTYPE_PGR_INIT(mtype, flags, pp, pgcnt) \
60 mtype = (flags & PG_NORELOC) ? MTYPE_NORELOC : MTYPE_RELOC;
61
62 #define MNODETYPE_2_PFN(mnode, mtype, pfnlo, pfnhi) \
63 pfnlo = mem_node_config[mnode].physbase; \
64 pfnhi = mem_node_config[mnode].physmax;
65
66 /*
67 * candidate counters in vm_pagelist.c are indexed by color and range
68 */
69 #define MAX_MNODE_MRANGES MAX_MEM_TYPES
70 #define MNODE_RANGE_CNT(mnode) MAX_MNODE_MRANGES
71 #define MNODE_MAX_MRANGE(mnode) (MAX_MEM_TYPES - 1)
72 #define MTYPE_2_MRANGE(mnode, mtype) (mtype)
73
74 /*
75 * Internal PG_ flags.
76 */
77 #define PGI_RELOCONLY 0x10000 /* acts in the opposite sense to PG_NORELOC */
78 #define PGI_NOCAGE 0x20000 /* indicates Cage is disabled */
79 #define PGI_PGCPHIPRI 0x40000 /* page_get_contig_page priority allocation */
|