+def GetMbufMcaPtr(m, cl):
+ pgshift = int(kern.globals.page_shift)
+ ix = int((m - Cast(kern.globals.mbutl, 'char *')) >> pgshift)
+ page_addr = (Cast(kern.globals.mbutl, 'char *') + (ix << pgshift))
+
+ if (int(cl) == 0):
+ midx = int((m - page_addr) >> 8)
+ mca = kern.globals.mclaudit[ix].cl_audit[midx]
+ elif (int(cl) == 1):
+ midx = int((m - page_addr) >> 11)
+ mca = kern.globals.mclaudit[ix].cl_audit[midx]
+ elif (int(cl) == 2):
+ midx = int((m - page_addr) >> 12)
+ mca = kern.globals.mclaudit[ix].cl_audit[midx]
+ else:
+ mca = kern.globals.mclaudit[ix].cl_audit[0]
+ return Cast(mca, 'mcache_audit_t *')
+
+def GetMbufSlab(m):
+ pgshift = int(kern.globals.page_shift)
+ gix = int((Cast(m, 'char *') - Cast(kern.globals.mbutl, 'char *')) >> MBSHIFT)
+ slabstbl = kern.globals.slabstbl
+ ix = int((Cast(m, 'char *') - Cast(slabstbl[gix].slg_slab[0].sl_base, 'char *')) >> pgshift)
+ return addressof(slabstbl[gix].slg_slab[ix])