mirror of
https://github.com/LongSoft/UEFITool.git
synced 2025-05-13 06:34:42 -04:00
Add Intel uCode parser
This commit is contained in:
parent
b3c68b7006
commit
3b1fc8f24c
1 changed files with 36 additions and 0 deletions
|
@ -1221,6 +1221,42 @@ USTATUS NvramParser::parseNvramVolumeBody(const UModelIndex & index,const UINT32
|
||||||
// Phoenix SLIC Pubkey/Marker
|
// Phoenix SLIC Pubkey/Marker
|
||||||
|
|
||||||
// Intel uCode
|
// Intel uCode
|
||||||
|
try {
|
||||||
|
// Check data size
|
||||||
|
if (volumeBodySize - storeOffset < sizeof(INTEL_MICROCODE_HEADER)) {
|
||||||
|
throw 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const UINT32 currentUint32 = readUnaligned((const UINT32*)(volumeBody.constData() + storeOffset));
|
||||||
|
|
||||||
|
if (currentUint32 != INTEL_MICROCODE_HEADER_VERSION_1) {
|
||||||
|
throw 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check microcode header candidate
|
||||||
|
const INTEL_MICROCODE_HEADER* ucodeHeader = (const INTEL_MICROCODE_HEADER*)(volumeBody.constData() + storeOffset);
|
||||||
|
if (FALSE == ffsParser->microcodeHeaderValid(ucodeHeader)) {
|
||||||
|
throw 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check size candidate
|
||||||
|
if (ucodeHeader->TotalSize == 0) {
|
||||||
|
throw 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// All checks passed, microcode found
|
||||||
|
UByteArray ucode = volumeBody.mid(storeOffset);
|
||||||
|
UModelIndex ucodeIndex;
|
||||||
|
if (U_SUCCESS != ffsParser->parseIntelMicrocodeHeader(ucode, storeOffset, index, ucodeIndex)) {
|
||||||
|
throw 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
storeOffset += ucodeHeader->TotalSize - 1;
|
||||||
|
previousStoreEndOffset = storeOffset + 1;
|
||||||
|
continue;
|
||||||
|
} catch (...) {
|
||||||
|
// Parsing failed, try something else
|
||||||
|
}
|
||||||
|
|
||||||
// Padding
|
// Padding
|
||||||
if (storeOffset < volumeBodySize) {
|
if (storeOffset < volumeBodySize) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue