Add test suite, fix a mountain of small errors.
diff --git a/sections/cper-section-generic.h b/sections/cper-section-generic.h
index 4a60791..f1e180e 100644
--- a/sections/cper-section-generic.h
+++ b/sections/cper-section-generic.h
@@ -11,7 +11,7 @@
#define GENERIC_ERROR_TYPES_KEYS (int []){0, 1, 2, 4, 8}
#define GENERIC_ERROR_TYPES_VALUES (const char*[]){"Unknown", "Cache Error", "TLB Error", "Bus Error", "Micro-Architectural Error"}
#define GENERIC_OPERATION_TYPES_KEYS (int []){0, 1, 2, 3}
-#define GENERIC_OPERATION_TYPES_VALUES (const char*[]){"Unknown or generic", "Data Read", "Data Write", "Instruction Execution"}
+#define GENERIC_OPERATION_TYPES_VALUES (const char*[]){"Unknown or Generic", "Data Read", "Data Write", "Instruction Execution"}
#define GENERIC_VALIDATION_BITFIELD_NAMES (const char*[]) \
{"processorTypeValid", "processorISAValid", "processorErrorTypeValid", "operationValid", "flagsValid", \
"levelValid", "cpuVersionValid", "cpuBrandInfoValid", "cpuIDValid", "targetAddressValid", "requestorIDValid", \
diff --git a/sections/cper-section-ia32x64.c b/sections/cper-section-ia32x64.c
index 784a25c..8c39ea8 100644
--- a/sections/cper-section-ia32x64.c
+++ b/sections/cper-section-ia32x64.c
@@ -99,17 +99,26 @@
//Add the check information on a per-structure basis.
//Cache and TLB check information are identical, so can be equated.
- json_object* checkInformation = NULL;
+ json_object* check_information = NULL;
if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeCacheCheckGuid)
|| guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeTlbCheckGuid))
{
- checkInformation = cper_ia32x64_cache_tlb_check_to_ir((EFI_IA32_X64_CACHE_CHECK_INFO*)&error_info->CheckInfo);
+ check_information = cper_ia32x64_cache_tlb_check_to_ir((EFI_IA32_X64_CACHE_CHECK_INFO*)&error_info->CheckInfo);
}
else if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeBusCheckGuid))
- checkInformation = cper_ia32x64_bus_check_to_ir((EFI_IA32_X64_BUS_CHECK_INFO*)&error_info->CheckInfo);
+ {
+ check_information = cper_ia32x64_bus_check_to_ir((EFI_IA32_X64_BUS_CHECK_INFO*)&error_info->CheckInfo);
+ }
else if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeMsCheckGuid))
- checkInformation = cper_ia32x64_ms_check_to_ir((EFI_IA32_X64_MS_CHECK_INFO*)&error_info->CheckInfo);
- json_object_object_add(error_info_ir, "checkInfo", checkInformation);
+ {
+ check_information = cper_ia32x64_ms_check_to_ir((EFI_IA32_X64_MS_CHECK_INFO*)&error_info->CheckInfo);
+ }
+ else
+ {
+ //Unknown check information.
+ printf("WARN: Invalid/unknown check information GUID found in IA32/x64 CPER section. Ignoring.\n");
+ }
+ json_object_object_add(error_info_ir, "checkInfo", check_information);
//Target, requestor, and responder identifiers.
json_object_object_add(error_info_ir, "targetAddressID", json_object_new_uint64(error_info->TargetId));
@@ -269,7 +278,7 @@
//No parseable data, just dump as base64 and shift the head to the next item.
*cur_pos = (void*)(context_info + 1);
- char* encoded = b64_encode((unsigned char*)cur_pos, context_info->ArraySize);
+ char* encoded = b64_encode((unsigned char*)*cur_pos, context_info->ArraySize);
register_array = json_object_new_object();
json_object_object_add(register_array, "data", json_object_new_string(encoded));
free(encoded);
diff --git a/sections/cper-section-ia32x64.h b/sections/cper-section-ia32x64.h
index d8c6825..a18e751 100644
--- a/sections/cper-section-ia32x64.h
+++ b/sections/cper-section-ia32x64.h
@@ -8,8 +8,8 @@
{"checkInfoValid", "targetAddressIDValid", "requestorIDValid", "responderIDValid", \
"instructionPointerValid"}
#define IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES (const char*[]) \
- {"transactionTypeValid", "operationValid", "levelValid", "processorContextCorruptValid", "uncorrectedValid" \
- "preciseIPValid", "restartableIPValid", "overflowValid", "participationTypeValid", "timedOutValid" \
+ {"transactionTypeValid", "operationValid", "levelValid", "processorContextCorruptValid", "uncorrectedValid", \
+ "preciseIPValid", "restartableIPValid", "overflowValid", "participationTypeValid", "timedOutValid", \
"addressSpaceValid"}
#define IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES (const char*[]) \
{"errorTypeValid", "processorContextCorruptValid", "uncorrectedValid", "preciseIPValid", "restartableIPValid", \