72 * Private seg op routines.
73 */
74 static void segmap_free(struct seg *seg);
75 faultcode_t segmap_fault(struct hat *hat, struct seg *seg, caddr_t addr,
76 size_t len, enum fault_type type, enum seg_rw rw);
77 static faultcode_t segmap_faulta(struct seg *seg, caddr_t addr);
78 static int segmap_checkprot(struct seg *seg, caddr_t addr, size_t len,
79 uint_t prot);
80 static int segmap_kluster(struct seg *seg, caddr_t addr, ssize_t);
81 static int segmap_getprot(struct seg *seg, caddr_t addr, size_t len,
82 uint_t *protv);
83 static u_offset_t segmap_getoffset(struct seg *seg, caddr_t addr);
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 };
128
129 /*
130 * Private segmap routines.
131 */
132 static void segmap_unlock(struct hat *hat, struct seg *seg, caddr_t addr,
133 size_t len, enum seg_rw rw, struct smap *smp);
134 static void segmap_smapadd(struct smap *smp);
135 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
136 u_offset_t off, int hashid);
137 static void segmap_hashout(struct smap *smp);
138
139
140 /*
141 * Statistics for segmap operations.
142 *
143 * No explicit locking to protect these stats.
144 */
145 struct segmapcnt segmapcnt = {
2171 addr += MAXBSIZE;
2172 }
2173 }
2174
2175 /*ARGSUSED*/
2176 static int
2177 segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
2178 struct page ***ppp, enum lock_type type, enum seg_rw rw)
2179 {
2180 return (ENOTSUP);
2181 }
2182
2183 static int
2184 segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp)
2185 {
2186 struct segmap_data *smd = (struct segmap_data *)seg->s_data;
2187
2188 memidp->val[0] = (uintptr_t)smd->smd_sm->sm_vp;
2189 memidp->val[1] = smd->smd_sm->sm_off + (uintptr_t)(addr - seg->s_base);
2190 return (0);
2191 }
2192
2193 /*ARGSUSED*/
2194 static lgrp_mem_policy_info_t *
2195 segmap_getpolicy(struct seg *seg, caddr_t addr)
2196 {
2197 return (NULL);
2198 }
2199
2200 /*ARGSUSED*/
2201 static int
2202 segmap_capable(struct seg *seg, segcapability_t capability)
2203 {
2204 return (0);
2205 }
2206
2207
2208 #ifdef SEGKPM_SUPPORT
2209
2210 /*
2211 * segkpm support routines
2212 */
2213
2214 static caddr_t
2215 segmap_pagecreate_kpm(struct seg *seg, vnode_t *vp, u_offset_t off,
2216 struct smap *smp, enum seg_rw rw)
2217 {
|
72 * Private seg op routines.
73 */
74 static void segmap_free(struct seg *seg);
75 faultcode_t segmap_fault(struct hat *hat, struct seg *seg, caddr_t addr,
76 size_t len, enum fault_type type, enum seg_rw rw);
77 static faultcode_t segmap_faulta(struct seg *seg, caddr_t addr);
78 static int segmap_checkprot(struct seg *seg, caddr_t addr, size_t len,
79 uint_t prot);
80 static int segmap_kluster(struct seg *seg, caddr_t addr, ssize_t);
81 static int segmap_getprot(struct seg *seg, caddr_t addr, size_t len,
82 uint_t *protv);
83 static u_offset_t segmap_getoffset(struct seg *seg, caddr_t addr);
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 int segmap_capable(struct seg *seg, segcapability_t capability);
93
94 /* segkpm support */
95 static caddr_t segmap_pagecreate_kpm(struct seg *, vnode_t *, u_offset_t,
96 struct smap *, enum seg_rw);
97 struct smap *get_smap_kpm(caddr_t, page_t **);
98
99 #define SEGMAP_BADOP(t) (t(*)())segmap_badop
100
101 static struct seg_ops segmap_ops = {
102 .dup = SEGMAP_BADOP(int),
103 .unmap = SEGMAP_BADOP(int),
104 .free = segmap_free,
105 .fault = segmap_fault,
106 .faulta = segmap_faulta,
107 .setprot = SEGMAP_BADOP(int),
108 .checkprot = segmap_checkprot,
109 .kluster = segmap_kluster,
110 .swapout = SEGMAP_BADOP(size_t),
111 .sync = SEGMAP_BADOP(int),
112 .incore = SEGMAP_BADOP(size_t),
113 .lockop = SEGMAP_BADOP(int),
114 .getprot = segmap_getprot,
115 .getoffset = segmap_getoffset,
116 .gettype = segmap_gettype,
117 .getvp = segmap_getvp,
118 .advise = SEGMAP_BADOP(int),
119 .dump = segmap_dump,
120 .pagelock = segmap_pagelock,
121 .setpagesize = SEGMAP_BADOP(int),
122 .getmemid = segmap_getmemid,
123 .capable = segmap_capable,
124 };
125
126 /*
127 * Private segmap routines.
128 */
129 static void segmap_unlock(struct hat *hat, struct seg *seg, caddr_t addr,
130 size_t len, enum seg_rw rw, struct smap *smp);
131 static void segmap_smapadd(struct smap *smp);
132 static struct smap *segmap_hashin(struct smap *smp, struct vnode *vp,
133 u_offset_t off, int hashid);
134 static void segmap_hashout(struct smap *smp);
135
136
137 /*
138 * Statistics for segmap operations.
139 *
140 * No explicit locking to protect these stats.
141 */
142 struct segmapcnt segmapcnt = {
2168 addr += MAXBSIZE;
2169 }
2170 }
2171
2172 /*ARGSUSED*/
2173 static int
2174 segmap_pagelock(struct seg *seg, caddr_t addr, size_t len,
2175 struct page ***ppp, enum lock_type type, enum seg_rw rw)
2176 {
2177 return (ENOTSUP);
2178 }
2179
2180 static int
2181 segmap_getmemid(struct seg *seg, caddr_t addr, memid_t *memidp)
2182 {
2183 struct segmap_data *smd = (struct segmap_data *)seg->s_data;
2184
2185 memidp->val[0] = (uintptr_t)smd->smd_sm->sm_vp;
2186 memidp->val[1] = smd->smd_sm->sm_off + (uintptr_t)(addr - seg->s_base);
2187 return (0);
2188 }
2189
2190 /*ARGSUSED*/
2191 static int
2192 segmap_capable(struct seg *seg, segcapability_t capability)
2193 {
2194 return (0);
2195 }
2196
2197
2198 #ifdef SEGKPM_SUPPORT
2199
2200 /*
2201 * segkpm support routines
2202 */
2203
2204 static caddr_t
2205 segmap_pagecreate_kpm(struct seg *seg, vnode_t *vp, u_offset_t off,
2206 struct smap *smp, enum seg_rw rw)
2207 {
|