Skip to content

Commit f727c77

Browse files
authored
MCE v1.1.0.1 & DB r5.1
v1.1.0 Dev 1 Major performance improvement, up to x10 times faster Updated Microcode Repository Database to r5_Dev1 r5 Dev 1 cpu000506C9_plat01_ver00000018_date28-06-2016
1 parent 39ac328 commit f727c77

File tree

2 files changed

+20
-24
lines changed

2 files changed

+20
-24
lines changed

MCE.dat

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
*** MC Extractor Microcode Repository Database ***
2-
*** Revision r4 (11/09/2016 , 00:31) ***
2+
*** Revision r5_Dev1 (11/09/2016 , 21:13) ***
33

4-
*** INTEL (1317) ***
4+
*** INTEL (1318) ***
55

66
CPUID + PLATFORM + VERSION + MMDDYYYY + SIZE + CHECKSUM
77

8+
000506C90000000100000018062820160000340049DC98F6
89
00000F25000000020000000B0527200300000800367A0C30
910
00000F320000000D00000006100920030000080027C250C9
1011
000106C100000001000001081101200700001400CA586D26

MCE.py

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'''
2-
MC Extractor v1.0.3.0
2+
MC Extractor v1.1.0.1
33
Copyright (C) 2016 Plato Mavropoulos
44
Based on UEFIStrip v7.8.2 by Lordkag
55
'''
66

7-
title = 'MC Extractor v1.0.3'
7+
title = 'MC Extractor v1.1.0 Dev 1'
88

99
import sys
1010
import re
@@ -573,7 +573,7 @@ def mass_scan(f_path) :
573573
if param.conv_cont :
574574
mc_f_ex = open(in_file, "r")
575575

576-
temp_file = tempfile.NamedTemporaryFile(mode='ab',delete=False) # No auto delete for use at init_file
576+
temp_file = tempfile.NamedTemporaryFile(mode='ab', delete=False) # No auto delete for use at init_file
577577

578578
try :
579579
for line in mc_f_ex :
@@ -620,10 +620,10 @@ def mass_scan(f_path) :
620620
if not param.exp_check :
621621
# Intel 64 and IA-32 Architectures Software Developer's Manual [325462, 06/2016] (Vol 3A, Ch 9.11.1, Page 2954)
622622
# HeaderRev 01, LoaderRev 01, ProcesFlags xx00*3
623-
pat_icpu = re.compile(br'\x01\x00{3}.{4}[\x00-\x99](((\x19|\x20)[\x01-\x31][\x01-\x12])|(\x18\x07\x00)).{8}\x01\x00{3}.\x00{3}', re.DOTALL)
623+
pat_icpu = re.compile(br'\x01\x00{3}.{4}[\x00-\x99](([\x19-\x20][\x01-\x31][\x01-\x12])|(\x18\x07\x00)).{8}\x01\x00{3}.\x00{3}', re.DOTALL)
624624
else :
625625
# HeaderRev 01-02, LoaderRev 01-02, ProcesFlags xxxx00*2, Reserved xx*12
626-
pat_icpu = re.compile(br'(\x01|\x02)\x00{3}.{4}[\x00-\x99](((\x19|\x20)[\x01-\x31][\x01-\x12])|(\x18\x07\x00)).{8}(\x01|\x02)\x00{3}.{2}\x00{2}', re.DOTALL)
626+
pat_icpu = re.compile(br'(\x01|\x02)\x00{3}.{4}[\x00-\x99](([\x19-\x20][\x01-\x31][\x01-\x12])|(\x18\x07\x00)).{8}(\x01|\x02)\x00{3}.{2}\x00{2}', re.DOTALL)
627627

628628
match_list_i += pat_icpu.finditer(reading)
629629

@@ -743,20 +743,19 @@ def mass_scan(f_path) :
743743
# CPUID 610F21 = 61 + 0F + 21 = (1 + 4) + (2 + 5) + (3 + 6) = 6+F + 12 + 01 = 15 + 12 + 01 = MU 151201
744744
# MU 151201 = 15 + 12 + 01 = 6+F + 12 + 01 = (1 + 3 + 5) + (2 + 4 + 6) = 610 + F21 = CPUID 610F21
745745

746-
# General UEFI patterns, should be robust
746+
# UEFI patterns
747747
pat_acpu_1 = re.compile(br'\x24\x55\x43\x4F\x44\x45((\x56\x53)|(\x32\x4B)|(\x34\x4B))') # $UCODEVS, $UCODE2K, $UCODE4K
748748
match_list_a += pat_acpu_1.finditer(reading)
749749

750+
# 1st MC from 1999 (K7), 2000 due to K7 Erratum and performance
750751
if not param.exp_check :
751-
# General non-UEFI patterns, should be robust (2 -> CPUID = 6 , 3 -> CPUID != 6)
752-
pat_acpu_2 = re.compile(br'[\x00-\x99]\x20[\x01-\x31][\x01-\x13].{4}\x02\x80.{18}(\x00|\x01)\x00{3}', re.DOTALL) # 2000 & up
753-
pat_acpu_3 = re.compile(br'(([\x00-\x99](\x19|\x20)[\x01-\x31][\x01-\x12])|(\x11\x20\x09\x13)).{4}(\x00|\x01|\x03)\x80.{18}(\x00|\x01)\xAA{3}', re.DOTALL)
752+
# BIOS pattern
753+
pat_acpu_2 = re.compile(br'[\x00-\x18]\x20[\x01-\x31][\x01-\x13].{4}[\x00-\x03]\x80.{18}[\x00-\x01](\xAA|\x00){3}', re.DOTALL)
754754
match_list_a += pat_acpu_2.finditer(reading)
755-
match_list_a += pat_acpu_3.finditer(reading)
756755
else :
757756
# Data Rev 00-09, Reserved AA or 00, API 00-09
758-
pat_acpu_4 = re.compile(br'(([\x00-\x99](\x19|\x20)[\x01-\x31][\x01-\x13])|(\x11\x20\x09\x13)).{4}[\x00-\x09]\x80.{18}[\x00-\x09](\x00{3}|\xAA{3})', re.DOTALL)
759-
match_list_a += pat_acpu_4.finditer(reading)
757+
pat_acpu_3 = re.compile(br'[\x00-\x18]\x20[\x01-\x31][\x01-\x13].{4}[\x00-\x09]\x80.{18}[\x00-\x09](\xAA|\x00){3}', re.DOTALL)
758+
match_list_a += pat_acpu_3.finditer(reading)
760759

761760
for match_ucode in match_list_a :
762761

@@ -792,17 +791,13 @@ def mass_scan(f_path) :
792791
nbsb_rev_id = '%0.2X' % mc_hdr.NbRevId + '%0.2X' % mc_hdr.SbRevId
793792

794793
full_date = "%s-%s-%s" % (day, month, year)
795-
794+
796795
# Remove false results, based on Date
797-
try:
798-
date_chk = datetime.datetime.strptime(full_date, '%d-%m-%Y')
799-
if date_chk.year > 2016 or date_chk.year < 1997 : raise DateErr('WrongDate') # 1st MC from 1999 (K7), 1997 for safety
800-
except :
801-
if full_date == '09-13-2011' and patch == '03000027' : pass # Drunk employee #2, Happy 13th month from AMD!
802-
else :
803-
print(col_magenta + "\nWarning: Skipped microcode at 0x%0.2X, invalid Date of %s!\n" % (mc_bgn, full_date) + col_end)
804-
continue
805-
796+
if full_date == '09-13-2011' and patch == '03000027' : pass # Drunk employee #2, Happy 13th month from AMD!
797+
elif month == '13' or year > '2016' :
798+
print(col_magenta + "\nWarning: Skipped microcode at 0x%0.2X, invalid Date of %s!\n" % (mc_bgn, full_date) + col_end)
799+
continue
800+
806801
# Remove false results, based on VEN_IDs
807802
if (nb_id != '0'*8 and '1002' not in nb_id[4:8] and '1022' not in nb_id[4:8]) \
808803
or (sb_id != '0'*8 and '1002' not in sb_id[4:8] and '1022' not in sb_id[4:8]) :

0 commit comments

Comments
 (0)