]> git.saurik.com Git - apple/xnu.git/blobdiff - san/tools/generate_dynamic_blacklist.py
xnu-6153.11.26.tar.gz
[apple/xnu.git] / san / tools / generate_dynamic_blacklist.py
index 3f4c06bedcb10d9bbe59c3af88c60a6317be9a28..c71d9c4fbe1f4f39798f2316ba65cba3a360aedf 100755 (executable)
@@ -8,6 +8,8 @@ def type_map(x):
 
 re_comments=re.compile(r'#.*$')
 
+nentries = 0
+extra_entries = 5
 bl = file(sys.argv[1])
 
 print r'struct blacklist_entry blacklist[] = {'
@@ -35,12 +37,27 @@ for line in bl.readlines():
                func = '"' + func + '"'
 
        if ty == "":
-               ty = "all";
+               ty = "normal";
 
        print """       {{
                .kext_name = {},
                .func_name = {},
                .type_mask = {},
        }},""".format(kext, func, type_map(ty))
+       nentries += 1
+
+# add space for new entries added at runtime
+print ''
+print r'       /* Unused entries that can be populated at runtime */'
+for i in xrange(0, extra_entries):
+       print """       {{
+               .kext_name = {},
+               .func_name = {},
+               .type_mask = {},
+       }},""".format("NULL", "NULL", 0)
 
 print r'};'
+print
+
+print 'static size_t blacklist_entries = {};'.format(nentries)
+print 'static const size_t blacklist_max_entries = {};'.format(nentries + extra_entries)