84 static int segmap_gettype(struct seg *seg, caddr_t addr);
85 static int segmap_getvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
86 static void segmap_dump(struct seg *seg);
87 static int segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
88 struct page ***ppp, enum lock_type type,
89 enum seg_rw rw);
90 static void segmap_badop(void);
91 static int segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp);
92 static lgrp_mem_policy_info_t *segmap_getpolicy(struct seg *seg,
93 caddr_t addr);
94 static int segmap_capable(struct seg *seg, segcapability_t capability);
95
96 /* segkpm support */
97 static caddr_t segmap_pagecreate_kpm(struct seg *, vnode_t *, u_offset_t,
98 struct smap *, enum seg_rw);
99 struct smap *get_smap_kpm(caddr_t, page_t **);
100
101 #define SEGMAP_BADOP(t) (t(*)())segmap_badop
102
103 static struct seg_ops segmap_ops = {
104 SEGMAP_BADOP(int), /* dup */
105 SEGMAP_BADOP(int), /* unmap */
106 segmap_free,
107 segmap_fault,
108 segmap_faulta,
109 SEGMAP_BADOP(int), /* setprot */
110 segmap_checkprot,
111 segmap_kluster,
112 SEGMAP_BADOP(size_t), /* swapout */
113 SEGMAP_BADOP(int), /* sync */
114 SEGMAP_BADOP(size_t), /* incore */
115 SEGMAP_BADOP(int), /* lockop */
116 segmap_getprot,
117 segmap_getoffset,
118 segmap_gettype,
119 segmap_getvp,
120 SEGMAP_BADOP(int), /* advise */
121 segmap_dump,
122 segmap_pagelock, /* pagelock */
123 SEGMAP_BADOP(int), /* setpgsz */
124 segmap_getmemid, /* getmemid */
125 segmap_getpolicy, /* getpolicy */
126 segmap_capable, /* capable */
127 seg_inherit_notsup /* inherit */
128 };
129
130 /*
131 * Private segmap routines.
132 */
133 static void segmap_unlock(struct hat *hat, struct seg *seg, caddr_t addr,
134 size_t len, enum seg_rw rw, struct smap *smp);
135 static void segmap_smapadd(struct smap *smp);
136 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
137 u_offset_t off, int hashid);
138 static void segmap_hashout(struct smap *smp);
139
140
141 /*
142 * Statistics for segmap operations.
143 *
144 * No explicit locking to protect these stats.
145 */
146 struct segmapcnt segmapcnt = {
147 { "fault", KSTAT_DATA_ULONG },
|
84 static int segmap_gettype(struct seg *seg, caddr_t addr);
85 static int segmap_getvp(struct seg *seg, caddr_t addr, struct vnode **vpp);
86 static void segmap_dump(struct seg *seg);
87 static int segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
88 struct page ***ppp, enum lock_type type,
89 enum seg_rw rw);
90 static void segmap_badop(void);
91 static int segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp);
92 static lgrp_mem_policy_info_t *segmap_getpolicy(struct seg *seg,
93 caddr_t addr);
94 static int segmap_capable(struct seg *seg, segcapability_t capability);
95
96 /* segkpm support */
97 static caddr_t segmap_pagecreate_kpm(struct seg *, vnode_t *, u_offset_t,
98 struct smap *, enum seg_rw);
99 struct smap *get_smap_kpm(caddr_t, page_t **);
100
101 #define SEGMAP_BADOP(t) (t(*)())segmap_badop
102
103 static struct seg_ops segmap_ops = {
104 .dup = SEGMAP_BADOP(int),
105 .unmap = SEGMAP_BADOP(int),
106 .free = segmap_free,
107 .fault = segmap_fault,
108 .faulta = segmap_faulta,
109 .setprot = SEGMAP_BADOP(int),
110 .checkprot = segmap_checkprot,
111 .kluster = segmap_kluster,
112 .swapout = SEGMAP_BADOP(size_t),
113 .sync = SEGMAP_BADOP(int),
114 .incore = SEGMAP_BADOP(size_t),
115 .lockop = SEGMAP_BADOP(int),
116 .getprot = segmap_getprot,
117 .getoffset = segmap_getoffset,
118 .gettype = segmap_gettype,
119 .getvp = segmap_getvp,
120 .advise = SEGMAP_BADOP(int),
121 .dump = segmap_dump,
122 .pagelock = segmap_pagelock,
123 .setpagesize = SEGMAP_BADOP(int),
124 .getmemid = segmap_getmemid,
125 .getpolicy = segmap_getpolicy,
126 .capable = segmap_capable,
127 .inherit = seg_inherit_notsup,
128 };
129
130 /*
131 * Private segmap routines.
132 */
133 static void segmap_unlock(struct hat *hat, struct seg *seg, caddr_t addr,
134 size_t len, enum seg_rw rw, struct smap *smp);
135 static void segmap_smapadd(struct smap *smp);
136 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
137 u_offset_t off, int hashid);
138 static void segmap_hashout(struct smap *smp);
139
140
141 /*
142 * Statistics for segmap operations.
143 *
144 * No explicit locking to protect these stats.
145 */
146 struct segmapcnt segmapcnt = {
147 { "fault", KSTAT_DATA_ULONG },
|