Print this page
patch as-lock-macro-simplification


 193 
 194         p = skd->skd_va_select =
 195             kmem_zalloc(NCPU * b->nvcolors * sizeof (ushort_t), KM_SLEEP);
 196 
 197         for (i = 0; i < NCPU; i++)
 198                 for (j = 0; j < b->nvcolors; j++, p++)
 199                         *p = j;
 200 
 201         return (0);
 202 }
 203 
 204 /*
 205  * This routine is called via a machine specific fault handling
 206  * routine.
 207  */
 208 /* ARGSUSED */
 209 faultcode_t
 210 segkpm_fault(struct hat *hat, struct seg *seg, caddr_t addr, size_t len,
 211         enum fault_type type, enum seg_rw rw)
 212 {
 213         ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as, &seg->s_as->a_lock));
 214 
 215         switch (type) {
 216         case F_INVAL:
 217                 return (hat_kpm_fault(hat, addr));
 218         case F_SOFTLOCK:
 219         case F_SOFTUNLOCK:
 220                 return (0);
 221         default:
 222                 return (FC_NOSUPPORT);
 223         }
 224         /*NOTREACHED*/
 225 }
 226 
 227 #define addr_to_vcolor(addr, vcolors) \
 228         ((int)(((uintptr_t)(addr) & ((vcolors << PAGESHIFT) - 1)) >> PAGESHIFT))
 229 
 230 /*
 231  * Create a virtual address that can be used for invocations of
 232  * page_create_va. Goal is to utilize the cache hierarchy (round
 233  * robin bins) and to select the right color for virtual indexed




 193 
 194         p = skd->skd_va_select =
 195             kmem_zalloc(NCPU * b->nvcolors * sizeof (ushort_t), KM_SLEEP);
 196 
 197         for (i = 0; i < NCPU; i++)
 198                 for (j = 0; j < b->nvcolors; j++, p++)
 199                         *p = j;
 200 
 201         return (0);
 202 }
 203 
 204 /*
 205  * This routine is called via a machine specific fault handling
 206  * routine.
 207  */
 208 /* ARGSUSED */
 209 faultcode_t
 210 segkpm_fault(struct hat *hat, struct seg *seg, caddr_t addr, size_t len,
 211         enum fault_type type, enum seg_rw rw)
 212 {
 213         ASSERT(seg->s_as && AS_LOCK_HELD(seg->s_as));
 214 
 215         switch (type) {
 216         case F_INVAL:
 217                 return (hat_kpm_fault(hat, addr));
 218         case F_SOFTLOCK:
 219         case F_SOFTUNLOCK:
 220                 return (0);
 221         default:
 222                 return (FC_NOSUPPORT);
 223         }
 224         /*NOTREACHED*/
 225 }
 226 
 227 #define addr_to_vcolor(addr, vcolors) \
 228         ((int)(((uintptr_t)(addr) & ((vcolors << PAGESHIFT) - 1)) >> PAGESHIFT))
 229 
 230 /*
 231  * Create a virtual address that can be used for invocations of
 232  * page_create_va. Goal is to utilize the cache hierarchy (round
 233  * robin bins) and to select the right color for virtual indexed