Lines Matching defs:sptd
243 struct spt_data *sptd = (struct spt_data *)seg->s_data;
247 if (sptd != NULL) {
248 if (sptd->spt_realsize)
249 segspt_free_pages(seg, seg->s_base, sptd->spt_realsize);
251 if (sptd->spt_ppa_lckcnt)
252 kmem_free(sptd->spt_ppa_lckcnt,
253 sizeof (*sptd->spt_ppa_lckcnt)
254 * btopr(sptd->spt_amp->size));
255 kmem_free(sptd->spt_vp, sizeof (*sptd->spt_vp));
256 cv_destroy(&sptd->spt_cv);
257 mutex_destroy(&sptd->spt_lock);
258 kmem_free(sptd, sizeof (*sptd));
280 struct spt_data *sptd;
287 sptd = sptseg->s_data;
289 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
374 struct spt_data *sptd;
410 if ((sptd = kmem_zalloc(sizeof (*sptd), KM_NOSLEEP)) == NULL)
419 mutex_init(&sptd->spt_lock, NULL, MUTEX_DEFAULT, NULL);
425 sptd->spt_vp = vp;
426 sptd->spt_amp = amp;
427 sptd->spt_prot = sptcargs->prot;
428 sptd->spt_flags = sptcargs->flags;
429 seg->s_data = (caddr_t)sptd;
430 sptd->spt_ppa = NULL;
431 sptd->spt_ppa_lckcnt = NULL;
433 cv_init(&sptd->spt_cv, NULL, CV_DEFAULT, NULL);
434 sptd->spt_gen = 0;
491 sptd->spt_ppa_lckcnt = kmem_zalloc(npages *
492 sizeof (*sptd->spt_ppa_lckcnt), KM_SLEEP);
493 sptd->spt_pcachecnt = 0;
494 sptd->spt_realsize = ptob(npages);
571 &ppa[pidx], sptd->spt_prot, hat_flags);
590 sptd->spt_pcachecnt = 0;
592 sptd->spt_realsize = ptob(npages);
600 cv_destroy(&sptd->spt_cv);
602 mutex_destroy(&sptd->spt_lock);
606 kmem_free(sptd, sizeof (*sptd));
618 struct spt_data *sptd = (struct spt_data *)seg->s_data;
641 (sptd->spt_flags & SHM_PAGEABLE)) {
647 amp = sptd->spt_amp;
648 if (sptd->spt_flags & SHM_PAGEABLE)
653 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
659 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
684 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
754 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
767 sptd->spt_realsize = 0;
769 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
829 struct spt_data *sptd = sptseg->s_data;
851 ASSERT(sptd);
860 if (pg_idx + npages > btopr(sptd->spt_amp->size)) {
866 ASSERT(sptd->spt_ppa != NULL);
868 seg_pinactive(seg, NULL, seg->s_base, sptd->spt_amp->size,
869 sptd->spt_ppa, S_WRITE, SEGP_FORCE_WIRED, segspt_reclaim);
879 if ((sptd->spt_flags & DISM_PPA_CHANGED) ||
889 if (sptd->spt_flags & DISM_PPA_CHANGED) {
903 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size,
906 ASSERT(sptd->spt_ppa != NULL);
907 ASSERT(sptd->spt_ppa == pplist);
908 ppa = sptd->spt_ppa;
912 sptd->spt_amp->size, ppa,
929 *ppp = &(sptd->spt_ppa[pg_idx]);
933 mutex_enter(&sptd->spt_lock);
937 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size,
940 ASSERT(sptd->spt_ppa != NULL);
941 ASSERT(sptd->spt_ppa == pplist);
942 ppa = sptd->spt_ppa;
945 mutex_exit(&sptd->spt_lock);
947 sptd->spt_amp->size, ppa,
964 mutex_exit(&sptd->spt_lock);
965 *ppp = &(sptd->spt_ppa[pg_idx]);
968 if (seg_pinsert_check(seg, NULL, seg->s_base, sptd->spt_amp->size,
970 mutex_exit(&sptd->spt_lock);
979 amp = sptd->spt_amp;
984 if (sptd->spt_ppa == NULL) {
988 tot_npages = btopr(sptd->spt_amp->size);
990 ASSERT(sptd->spt_pcachecnt == 0);
1005 (sptd->spt_ppa_lckcnt[an_idx] != 0))) {
1039 if (sptd->spt_ppa_lckcnt[an_idx] == 0)
1060 sptd->spt_ppa = pl;
1065 pl = sptd->spt_ppa;
1070 ret = seg_pinsert(seg, NULL, seg->s_base, sptd->spt_amp->size,
1071 sptd->spt_amp->size, pl, S_WRITE, SEGP_FORCE_WIRED,
1084 sptd->spt_ppa = NULL;
1093 sptd->spt_pcachecnt++;
1096 ppa = sptd->spt_ppa;
1099 mutex_exit(&sptd->spt_lock);
1101 sptd->spt_amp->size,
1114 * We can now drop the sptd->spt_lock since the ppa[]
1117 mutex_exit(&sptd->spt_lock);
1124 *ppp = &(sptd->spt_ppa[pg_idx]);
1134 mutex_exit(&sptd->spt_lock);
1185 struct spt_data *sptd = sptseg->s_data;
1207 ASSERT(sptd);
1209 if (sptd->spt_flags & SHM_PAGEABLE) {
1220 if (page_index + npages > btopr(sptd->spt_amp->size)) {
1227 ASSERT(sptd->spt_ppa != NULL);
1229 seg_pinactive(seg, NULL, seg->s_base, sptd->spt_amp->size,
1230 sptd->spt_ppa, S_WRITE, SEGP_FORCE_WIRED, segspt_reclaim);
1252 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size,
1255 ASSERT(sptd->spt_ppa == pplist);
1256 ASSERT(sptd->spt_ppa[page_index]);
1262 *ppp = &(sptd->spt_ppa[page_index]);
1266 mutex_enter(&sptd->spt_lock);
1271 pplist = seg_plookup(seg, NULL, seg->s_base, sptd->spt_amp->size,
1274 ASSERT(sptd->spt_ppa == pplist);
1280 mutex_exit(&sptd->spt_lock);
1281 *ppp = &(sptd->spt_ppa[page_index]);
1285 if (seg_pinsert_check(seg, NULL, seg->s_base, sptd->spt_amp->size,
1287 mutex_exit(&sptd->spt_lock);
1301 if (sptd->spt_ppa == NULL) {
1302 ASSERT(sptd->spt_ppa == pplist);
1312 amp = sptd->spt_amp;
1315 /* pcachecnt is protected by sptd->spt_lock */
1316 ASSERT(sptd->spt_pcachecnt == 0);
1318 * btopr(sptd->spt_amp->size), KM_SLEEP);
1324 for (a = spt_base; a < (spt_base + sptd->spt_amp->size);
1335 if (a < (spt_base + sptd->spt_amp->size)) {
1339 sptd->spt_ppa = pl;
1344 pl = sptd->spt_ppa;
1349 ret = seg_pinsert(seg, NULL, seg->s_base, sptd->spt_amp->size,
1350 sptd->spt_amp->size, pl, S_WRITE, SEGP_FORCE_WIRED,
1363 sptd->spt_ppa = NULL;
1372 sptd->spt_pcachecnt++;
1376 * We can now drop the sptd->spt_lock since the ppa[]
1379 mutex_exit(&sptd->spt_lock);
1386 *ppp = &(sptd->spt_ppa[page_index]);
1396 mutex_exit(&sptd->spt_lock);
1409 kmem_free(pl, sizeof (page_t *) * btopr(sptd->spt_amp->size));
1441 struct spt_data *sptd;
1449 sptd = sptseg->s_data;
1452 ASSERT(sptd->spt_pcachecnt != 0);
1453 ASSERT(sptd->spt_ppa == pplist);
1454 ASSERT(npages == btopr(sptd->spt_amp->size));
1461 mutex_enter(&sptd->spt_lock);
1462 if (--sptd->spt_pcachecnt == 0) {
1472 if ((sptd->spt_flags & SHM_PAGEABLE) &&
1473 (sptd->spt_ppa_lckcnt[i] == 0))
1477 if ((sptd->spt_flags & SHM_PAGEABLE) && free_availrmem) {
1488 ASSERT(sptd->spt_pcachecnt == 0);
1490 sptd->spt_ppa = NULL;
1491 sptd->spt_flags &= ~DISM_PPA_CHANGED;
1492 sptd->spt_gen++;
1493 cv_broadcast(&sptd->spt_cv);
1496 mutex_exit(&sptd->spt_lock);
1579 struct spt_data *sptd;
1592 sptd = sptseg->s_data;
1600 ((sptd->spt_flags & SHM_PAGEABLE) == 0)) {
1617 amp = sptd->spt_amp;
1677 struct spt_data *sptd;
1698 sptd = shmd->shm_sptseg->s_data;
1700 if (sptd->spt_flags & SHM_PAGEABLE) {
1827 struct spt_data *sptd = sptseg->s_data;
1857 if (((addr + len) - seg->s_base) > sptd->spt_realsize)
1885 (sptseg->s_base + sptd->spt_realsize));
1900 if ((rw == S_EXEC) && !(sptd->spt_prot & PROT_EXEC))
1924 a, pgsz, &ppa[pidx], sptd->spt_prot,
1937 sptd->spt_prot,
2010 struct spt_data *sptd = sptseg->s_data;
2033 if (sptd->spt_flags & SHM_PAGEABLE) {
2048 if (((addr + len) - seg->s_base) > sptd->spt_realsize)
2081 (sptseg->s_base + sptd->spt_realsize))
2082 size = (sptseg->s_base + sptd->spt_realsize) - sptseg_addr;
2087 ASSERT((sptd->spt_flags & SHM_PAGEABLE) == 0);
2113 if ((rw == S_EXEC) && !(sptd->spt_prot & PROT_EXEC))
2141 amp = sptd->spt_amp;
2174 sz, &ppa[pidx], sptd->spt_prot,
2188 sptd->spt_prot, HAT_LOAD_SHARE);
2264 struct spt_data *sptd = spt_seg->s_data;
2282 if (sptd->spt_flags & SHM_PAGEABLE) {
2307 struct spt_data *sptd = (struct spt_data *)shmd->shm_sptseg->s_data;
2314 return (((sptd->spt_prot & prot) != prot) ? EACCES : 0);
2328 struct spt_data *sptd = sptseg->s_data;
2329 struct anon_map *amp = sptd->spt_amp;
2330 enum seg_rw rw = sptd->spt_prot;
2378 lp_addr, sptd->spt_prot, &vpprot, &ppa[ppa_idx],
2484 struct spt_data *sptd = shmd->shm_sptseg->s_data;
2525 if (sptd->spt_ppa_lckcnt[anon_index] <
2527 if (++sptd->spt_ppa_lckcnt[anon_index] ==
2534 kernel = (sptd->spt_ppa &&
2535 sptd->spt_ppa[anon_index]);
2538 sptd->spt_ppa_lckcnt[anon_index]--;
2571 struct spt_data *sptd = shmd->shm_sptseg->s_data;
2572 struct anon_map *amp = sptd->spt_amp;
2599 kernel = (sptd->spt_ppa && sptd->spt_ppa[anon_index]);
2614 sptd->spt_ppa_lckcnt[anon_index]--;
2645 struct spt_data *sptd = sptseg->s_data;
2646 struct kshmid *sp = sptd->spt_amp->a_sp;
2663 if ((sptd->spt_flags & SHM_PAGEABLE) == 0) {
2708 mutex_enter(&sptd->spt_lock);
2709 if (sptd->spt_ppa != NULL)
2710 sptd->spt_flags |= DISM_PPA_CHANGED;
2714 mutex_exit(&sptd->spt_lock);
2746 if (sptd->spt_ppa != NULL)
2747 sptd->spt_flags |= DISM_PPA_CHANGED;
2749 mutex_exit(&sptd->spt_lock);
2756 mutex_enter(&sptd->spt_lock);
2758 mutex_exit(&sptd->spt_lock);
2764 if (sptd->spt_ppa != NULL)
2765 sptd->spt_flags |= DISM_PPA_CHANGED;
2769 if ((ppa = sptd->spt_ppa) != NULL)
2770 sptd->spt_flags |= DISM_PPA_CHANGED;
2771 mutex_exit(&sptd->spt_lock);
2787 struct spt_data *sptd = (struct spt_data *)shmd->shm_sptseg->s_data;
2796 *protv++ = sptd->spt_prot;
2816 struct spt_data *sptd = (struct spt_data *)shmd->shm_sptseg->s_data;
2825 ((sptd->spt_flags & SHM_PAGEABLE) ? 0 : MAP_NORESERVE));
2833 struct spt_data *sptd = (struct spt_data *)shmd->shm_sptseg->s_data;
2837 *vpp = sptd->spt_vp;
2853 struct spt_data *sptd = (struct spt_data *)shmd->shm_sptseg->s_data;
2864 if ((sptd->spt_flags & SHM_PAGEABLE) == 0)
2867 amp = sptd->spt_amp;
2870 mutex_enter(&sptd->spt_lock);
2871 if ((ppa = sptd->spt_ppa) == NULL) {
2872 mutex_exit(&sptd->spt_lock);
2879 sptd->spt_flags |= DISM_PPA_CHANGED;
2880 gen = sptd->spt_gen;
2882 mutex_exit(&sptd->spt_lock);
2899 mutex_enter(&sptd->spt_lock);
2906 while (sptd->spt_gen == gen &&
2907 (sptd->spt_flags & DISM_PPA_CHANGED) &&
2909 if (!cv_timedwait_sig(&sptd->spt_cv,
2910 &sptd->spt_lock, end_lbolt)) {
2915 mutex_exit(&sptd->spt_lock);
2963 (sptseg->s_base + sptd->spt_realsize))
2964 size = (sptseg->s_base + sptd->spt_realsize) -
3020 struct spt_data *sptd = shmd->shm_sptseg->s_data;
3026 if (addr > (seg->s_base + sptd->spt_realsize)) {