/**
 * Describes functions for converting IA32/x64 CPER sections from binary and JSON format
 * into an intermediate format.
 * 
 * Author: Lawrence.Tang@arm.com
 **/

#include <stdio.h>
#include "json.h"
#include "b64.h"
#include "../edk/Cper.h"
#include "../cper-utils.h"
#include "cper-section-ia32x64.h"

//Private pre-definitions.
json_object* cper_ia32x64_processor_error_info_to_ir(EFI_IA32_X64_PROCESS_ERROR_INFO* error_info);
json_object* cper_ia32x64_cache_tlb_check_to_ir(EFI_IA32_X64_CACHE_CHECK_INFO* cache_tlb_check);
json_object* cper_ia32x64_bus_check_to_ir(EFI_IA32_X64_BUS_CHECK_INFO* bus_check);
json_object* cper_ia32x64_ms_check_to_ir(EFI_IA32_X64_MS_CHECK_INFO* ms_check);
json_object* cper_ia32x64_processor_context_info_to_ir(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* context_info, void** cur_pos);
json_object* cper_ia32x64_register_32bit_to_ir(EFI_CONTEXT_IA32_REGISTER_STATE* registers);
json_object* cper_ia32x64_register_64bit_to_ir(EFI_CONTEXT_X64_REGISTER_STATE* registers);
void ir_ia32x64_error_info_to_cper(json_object* error_info, FILE* out);
void ir_ia32x64_context_info_to_cper(json_object* context_info, FILE* out);
void ir_ia32x64_cache_tlb_check_error_to_cper(json_object* check_info, EFI_IA32_X64_CACHE_CHECK_INFO* check_info_cper);
void ir_ia32x64_bus_check_error_to_cper(json_object* check_info, EFI_IA32_X64_BUS_CHECK_INFO* check_info_cper);
void ir_ia32x64_ms_check_error_to_cper(json_object* check_info, EFI_IA32_X64_MS_CHECK_INFO* check_info_cper);
void ir_ia32x64_ia32_registers_to_cper(json_object* registers, FILE* out);
void ir_ia32x64_x64_registers_to_cper(json_object* registers, FILE* out);

//////////////////
/// CPER TO IR ///
//////////////////

//Converts the IA32/x64 error section described in the given descriptor into intermediate format.
json_object* cper_section_ia32x64_to_ir(void* section, EFI_ERROR_SECTION_DESCRIPTOR* descriptor)
{
    EFI_IA32_X64_PROCESSOR_ERROR_RECORD* record = (EFI_IA32_X64_PROCESSOR_ERROR_RECORD*)section;
    json_object* record_ir = json_object_new_object();

    //Validation bits.
    json_object* validationBits = json_object_new_object();
    json_object_object_add(validationBits, "localAPICIDValid", json_object_new_boolean(record->ValidFields & 0b1));
    json_object_object_add(validationBits, "cpuIDInfoValid", json_object_new_boolean((record->ValidFields >> 1) & 0b1));
    int processor_error_info_num = (record->ValidFields >> 2) & 0b111111;
    json_object_object_add(validationBits, "processorErrorInfoNum", json_object_new_int(processor_error_info_num));
    int processor_context_info_num = (record->ValidFields >> 8) & 0b111111;
    json_object_object_add(validationBits, "processorContextInfoNum", json_object_new_int(processor_context_info_num));
    json_object_object_add(record_ir, "validationBits", validationBits);

    //APIC ID.
    json_object_object_add(record_ir, "localAPICID", json_object_new_uint64(record->ApicId));

    //CPUID information.
    json_object* cpuid_info_ir = json_object_new_object();
    EFI_IA32_X64_CPU_ID* cpuid_info = (EFI_IA32_X64_CPU_ID*)record->CpuIdInfo;
    json_object_object_add(cpuid_info_ir, "eax", json_object_new_uint64(cpuid_info->Eax));
    json_object_object_add(cpuid_info_ir, "ebx", json_object_new_uint64(cpuid_info->Ebx));
    json_object_object_add(cpuid_info_ir, "ecx", json_object_new_uint64(cpuid_info->Ecx));
    json_object_object_add(cpuid_info_ir, "edx", json_object_new_uint64(cpuid_info->Edx));
    json_object_object_add(record_ir, "cpuidInfo", cpuid_info_ir);

    //Processor error information, of the amount described above.
    EFI_IA32_X64_PROCESS_ERROR_INFO* current_error_info = (EFI_IA32_X64_PROCESS_ERROR_INFO*)(record + 1);
    json_object* error_info_array = json_object_new_array();
    for (int i=0; i<processor_error_info_num; i++) 
    {
        json_object_array_add(error_info_array, cper_ia32x64_processor_error_info_to_ir(current_error_info));
        current_error_info++;
    }
    json_object_object_add(record_ir, "processorErrorInfo", error_info_array);

    //Processor context information, of the amount described above.
    EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* current_context_info = (EFI_IA32_X64_PROCESSOR_CONTEXT_INFO*)current_error_info;
    json_object* context_info_array = json_object_new_array();
    for (int i=0; i<processor_context_info_num; i++) 
    {
        json_object_array_add(context_info_array, cper_ia32x64_processor_context_info_to_ir(current_context_info, (void**)&current_context_info));
        //The context array is a non-fixed size, pointer is shifted within the above function.
    }
    json_object_object_add(record_ir, "processorContextInfo", context_info_array);

    return record_ir;
}

//Converts a single IA32/x64 processor error info block into JSON IR format.
json_object* cper_ia32x64_processor_error_info_to_ir(EFI_IA32_X64_PROCESS_ERROR_INFO* error_info)
{
    json_object* error_info_ir = json_object_new_object();

    //Error structure type (as GUID).
    char error_type[GUID_STRING_LENGTH];
    guid_to_string(error_type, &error_info->ErrorType);
    json_object_object_add(error_info_ir, "type", json_object_new_string(error_type));

    //Validation bits.
    json_object* validation = bitfield_to_ir(error_info->ValidFields, 5, IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES);
    json_object_object_add(error_info_ir, "validationBits", validation);

    //Add the check information on a per-structure basis.
    //Cache and TLB check information are identical, so can be equated.
    json_object* check_information = NULL;
    if (guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeCacheCheckGuid)
        || guid_equal(&error_info->ErrorType, &gEfiIa32x64ErrorTypeTlbCheckGuid))
    {
        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))
    {
        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))
    {
        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));
    json_object_object_add(error_info_ir, "requestorID", json_object_new_uint64(error_info->RequestorId));
    json_object_object_add(error_info_ir, "responderID", json_object_new_uint64(error_info->ResponderId));
    json_object_object_add(error_info_ir, "instructionPointer", json_object_new_uint64(error_info->InstructionIP));

    return error_info_ir;
}

//Converts a single IA32/x64 cache or TLB check check info block into JSON IR format.
json_object* cper_ia32x64_cache_tlb_check_to_ir(EFI_IA32_X64_CACHE_CHECK_INFO* cache_tlb_check)
{
    json_object* cache_tlb_check_ir = json_object_new_object();

    //Validation bits.
    json_object* validation = bitfield_to_ir(cache_tlb_check->ValidFields, 8, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
    json_object_object_add(cache_tlb_check_ir, "validationBits", validation);

    //Transaction type.
    json_object* transaction_type = integer_to_readable_pair(cache_tlb_check->TransactionType, 3,
        IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS,
        IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES,
        "Unknown (Reserved)");
    json_object_object_add(cache_tlb_check_ir, "transactionType", transaction_type);

    //Operation.
    json_object* operation = integer_to_readable_pair(cache_tlb_check->Operation, 9,
        IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS,
        IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES,
        "Unknown (Reserved)");
    json_object_object_add(cache_tlb_check_ir, "operation", operation);

    //Affected cache/TLB level.
    json_object_object_add(cache_tlb_check_ir, "level", json_object_new_uint64(cache_tlb_check->Level));

    //Miscellaneous boolean fields.
    json_object_object_add(cache_tlb_check_ir, "processorContextCorrupt", json_object_new_boolean(cache_tlb_check->ContextCorrupt));
    json_object_object_add(cache_tlb_check_ir, "uncorrected", json_object_new_boolean(cache_tlb_check->ErrorUncorrected));
    json_object_object_add(cache_tlb_check_ir, "preciseIP", json_object_new_boolean(cache_tlb_check->PreciseIp));
    json_object_object_add(cache_tlb_check_ir, "restartableIP", json_object_new_boolean(cache_tlb_check->RestartableIp));
    json_object_object_add(cache_tlb_check_ir, "overflow", json_object_new_boolean(cache_tlb_check->Overflow));

    return cache_tlb_check_ir;
}

//Converts a single IA32/x64 bus check check info block into JSON IR format.
json_object* cper_ia32x64_bus_check_to_ir(EFI_IA32_X64_BUS_CHECK_INFO* bus_check)
{ 
    json_object* bus_check_ir = json_object_new_object();

    //Validation bits.
    json_object* validation = bitfield_to_ir(bus_check->ValidFields, 11, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);
    json_object_object_add(bus_check_ir, "validationBits", validation);

    //Transaction type.
    json_object* transaction_type = integer_to_readable_pair(bus_check->TransactionType, 3,
        IA32X64_CHECK_INFO_TRANSACTION_TYPES_KEYS,
        IA32X64_CHECK_INFO_TRANSACTION_TYPES_VALUES,
        "Unknown (Reserved)");
    json_object_object_add(bus_check_ir, "transactionType", transaction_type);

    //Operation.
    json_object* operation = integer_to_readable_pair(bus_check->Operation, 9,
        IA32X64_CHECK_INFO_OPERATION_TYPES_KEYS,
        IA32X64_CHECK_INFO_OPERATION_TYPES_VALUES,
        "Unknown (Reserved)");
    json_object_object_add(bus_check_ir, "operation", operation);

    //Affected bus level.
    json_object_object_add(bus_check_ir, "level", json_object_new_uint64(bus_check->Level));

    //Miscellaneous boolean fields.
    json_object_object_add(bus_check_ir, "processorContextCorrupt", json_object_new_boolean(bus_check->ContextCorrupt));
    json_object_object_add(bus_check_ir, "uncorrected", json_object_new_boolean(bus_check->ErrorUncorrected));
    json_object_object_add(bus_check_ir, "preciseIP", json_object_new_boolean(bus_check->PreciseIp));
    json_object_object_add(bus_check_ir, "restartableIP", json_object_new_boolean(bus_check->RestartableIp));
    json_object_object_add(bus_check_ir, "overflow", json_object_new_boolean(bus_check->Overflow));
    json_object_object_add(bus_check_ir, "timedOut", json_object_new_boolean(bus_check->TimeOut));

    //Participation type.
    json_object* participation_type = integer_to_readable_pair(bus_check->ParticipationType, 4,
        IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_KEYS,
        IA32X64_BUS_CHECK_INFO_PARTICIPATION_TYPES_VALUES,
        "Unknown");
    json_object_object_add(bus_check_ir, "participationType", participation_type);

    //Address space.
    json_object* address_space = integer_to_readable_pair(bus_check->AddressSpace, 4,
        IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_KEYS,
        IA32X64_BUS_CHECK_INFO_ADDRESS_SPACE_TYPES_VALUES,
        "Unknown");
    json_object_object_add(bus_check_ir, "addressSpace", address_space);
    
    return bus_check_ir;
}

//Converts a single IA32/x64 MS check check info block into JSON IR format.
json_object* cper_ia32x64_ms_check_to_ir(EFI_IA32_X64_MS_CHECK_INFO* ms_check)
{
    json_object* ms_check_ir = json_object_new_object();

    //Validation bits.
    json_object* validation = bitfield_to_ir(ms_check->ValidFields, 6, IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES);
    json_object_object_add(ms_check_ir, "validationBits", validation);

    //Error type (operation that caused the error).
    json_object* error_type = integer_to_readable_pair(ms_check->ErrorType, 4,
        IA32X64_MS_CHECK_INFO_ERROR_TYPES_KEYS,
        IA32X64_MS_CHECK_INFO_ERROR_TYPES_VALUES,
        "Unknown (Processor Specific)");
    json_object_object_add(ms_check_ir, "errorType", error_type);
    
    //Miscellaneous fields.
    json_object_object_add(ms_check_ir, "processorContextCorrupt", json_object_new_boolean(ms_check->ContextCorrupt));
    json_object_object_add(ms_check_ir, "uncorrected", json_object_new_boolean(ms_check->ErrorUncorrected));
    json_object_object_add(ms_check_ir, "preciseIP", json_object_new_boolean(ms_check->PreciseIp));
    json_object_object_add(ms_check_ir, "restartableIP", json_object_new_boolean(ms_check->RestartableIp));
    json_object_object_add(ms_check_ir, "overflow", json_object_new_boolean(ms_check->Overflow));

    return ms_check_ir;
}

//Converts a single IA32/x64 processor context info entry into JSON IR format.
json_object* cper_ia32x64_processor_context_info_to_ir(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* context_info, void** cur_pos)
{
    json_object* context_info_ir = json_object_new_object();

    //Register context type.
    json_object* context_type = integer_to_readable_pair(context_info->RegisterType, 8,
        IA32X64_REGISTER_CONTEXT_TYPES_KEYS,
        IA32X64_REGISTER_CONTEXT_TYPES_VALUES,
        "Unknown (Reserved)");
    json_object_object_add(context_info_ir, "registerContextType", context_type);

    //Register array size, MSR and MM address.
    json_object_object_add(context_info_ir, "registerArraySize", json_object_new_uint64(context_info->ArraySize));
    json_object_object_add(context_info_ir, "msrAddress", json_object_new_uint64(context_info->MsrAddress));
    json_object_object_add(context_info_ir, "mmRegisterAddress", json_object_new_uint64(context_info->MmRegisterAddress));

    //Register array.
    json_object* register_array = NULL;
    if (context_info->RegisterType == EFI_REG_CONTEXT_TYPE_IA32) 
    {
        EFI_CONTEXT_IA32_REGISTER_STATE* register_state = (EFI_CONTEXT_IA32_REGISTER_STATE*)(context_info + 1);
        register_array = cper_ia32x64_register_32bit_to_ir(register_state);
        *cur_pos = (void*)(register_state + 1);
    }
    else if (context_info->RegisterType == EFI_REG_CONTEXT_TYPE_X64) 
    {
        EFI_CONTEXT_X64_REGISTER_STATE* register_state = (EFI_CONTEXT_X64_REGISTER_STATE*)(context_info + 1);
        register_array = cper_ia32x64_register_64bit_to_ir(register_state);
        *cur_pos = (void*)(register_state + 1);
    }
    else 
    {
        //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);
        register_array = json_object_new_object();
        json_object_object_add(register_array, "data", json_object_new_string(encoded));
        free(encoded);

        *cur_pos = (void*)(((char*)*cur_pos) + context_info->ArraySize);
    }
    json_object_object_add(context_info_ir, "registerArray", register_array);

    return context_info_ir;
}

//Converts a single CPER IA32 register state into JSON IR format.
json_object* cper_ia32x64_register_32bit_to_ir(EFI_CONTEXT_IA32_REGISTER_STATE* registers)
{
    json_object* ia32_registers = json_object_new_object();
    json_object_object_add(ia32_registers, "eax", json_object_new_uint64(registers->Eax));
    json_object_object_add(ia32_registers, "ebx", json_object_new_uint64(registers->Ebx));
    json_object_object_add(ia32_registers, "ecx", json_object_new_uint64(registers->Ecx));
    json_object_object_add(ia32_registers, "edx", json_object_new_uint64(registers->Edx));
    json_object_object_add(ia32_registers, "esi", json_object_new_uint64(registers->Esi));
    json_object_object_add(ia32_registers, "edi", json_object_new_uint64(registers->Edi));
    json_object_object_add(ia32_registers, "ebp", json_object_new_uint64(registers->Ebp));
    json_object_object_add(ia32_registers, "esp", json_object_new_uint64(registers->Esp));
    json_object_object_add(ia32_registers, "cs", json_object_new_uint64(registers->Cs));
    json_object_object_add(ia32_registers, "ds", json_object_new_uint64(registers->Ds));
    json_object_object_add(ia32_registers, "ss", json_object_new_uint64(registers->Ss));
    json_object_object_add(ia32_registers, "es", json_object_new_uint64(registers->Es));
    json_object_object_add(ia32_registers, "fs", json_object_new_uint64(registers->Fs));
    json_object_object_add(ia32_registers, "gs", json_object_new_uint64(registers->Gs));
    json_object_object_add(ia32_registers, "eflags", json_object_new_uint64(registers->Eflags));
    json_object_object_add(ia32_registers, "eip", json_object_new_uint64(registers->Eip));
    json_object_object_add(ia32_registers, "cr0", json_object_new_uint64(registers->Cr0));
    json_object_object_add(ia32_registers, "cr1", json_object_new_uint64(registers->Cr1));
    json_object_object_add(ia32_registers, "cr2", json_object_new_uint64(registers->Cr2));
    json_object_object_add(ia32_registers, "cr3", json_object_new_uint64(registers->Cr3));
    json_object_object_add(ia32_registers, "cr4", json_object_new_uint64(registers->Cr4));
    json_object_object_add(ia32_registers, "gdtr", json_object_new_uint64(registers->Gdtr[0] + ((UINT64)registers->Gdtr[1] << 32)));
    json_object_object_add(ia32_registers, "idtr", json_object_new_uint64(registers->Idtr[0] + ((UINT64)registers->Idtr[1] << 32)));
    json_object_object_add(ia32_registers, "ldtr", json_object_new_uint64(registers->Ldtr));
    json_object_object_add(ia32_registers, "tr", json_object_new_uint64(registers->Tr));

    return ia32_registers;
}

//Converts a single CPER x64 register state into JSON IR format.
json_object* cper_ia32x64_register_64bit_to_ir(EFI_CONTEXT_X64_REGISTER_STATE* registers)
{
    json_object* x64_registers = json_object_new_object();
    json_object_object_add(x64_registers, "rax", json_object_new_uint64(registers->Rax));
    json_object_object_add(x64_registers, "rbx", json_object_new_uint64(registers->Rbx));
    json_object_object_add(x64_registers, "rcx", json_object_new_uint64(registers->Rcx));
    json_object_object_add(x64_registers, "rdx", json_object_new_uint64(registers->Rdx));
    json_object_object_add(x64_registers, "rsi", json_object_new_uint64(registers->Rsi));
    json_object_object_add(x64_registers, "rdi", json_object_new_uint64(registers->Rdi));
    json_object_object_add(x64_registers, "rbp", json_object_new_uint64(registers->Rbp));
    json_object_object_add(x64_registers, "rsp", json_object_new_uint64(registers->Rsp));
    json_object_object_add(x64_registers, "r8", json_object_new_uint64(registers->R8));
    json_object_object_add(x64_registers, "r9", json_object_new_uint64(registers->R9));
    json_object_object_add(x64_registers, "r10", json_object_new_uint64(registers->R10));
    json_object_object_add(x64_registers, "r11", json_object_new_uint64(registers->R11));
    json_object_object_add(x64_registers, "r12", json_object_new_uint64(registers->R12));
    json_object_object_add(x64_registers, "r13", json_object_new_uint64(registers->R13));
    json_object_object_add(x64_registers, "r14", json_object_new_uint64(registers->R14));
    json_object_object_add(x64_registers, "r15", json_object_new_uint64(registers->R15));
    json_object_object_add(x64_registers, "cs", json_object_new_int(registers->Cs));
    json_object_object_add(x64_registers, "ds", json_object_new_int(registers->Ds));
    json_object_object_add(x64_registers, "ss", json_object_new_int(registers->Ss));
    json_object_object_add(x64_registers, "es", json_object_new_int(registers->Es));
    json_object_object_add(x64_registers, "fs", json_object_new_int(registers->Fs));
    json_object_object_add(x64_registers, "gs", json_object_new_int(registers->Gs));
    json_object_object_add(x64_registers, "rflags", json_object_new_uint64(registers->Rflags));
    json_object_object_add(x64_registers, "eip", json_object_new_uint64(registers->Rip));
    json_object_object_add(x64_registers, "cr0", json_object_new_uint64(registers->Cr0));
    json_object_object_add(x64_registers, "cr1", json_object_new_uint64(registers->Cr1));
    json_object_object_add(x64_registers, "cr2", json_object_new_uint64(registers->Cr2));
    json_object_object_add(x64_registers, "cr3", json_object_new_uint64(registers->Cr3));
    json_object_object_add(x64_registers, "cr4", json_object_new_uint64(registers->Cr4));
    json_object_object_add(x64_registers, "cr8", json_object_new_uint64(registers->Cr8));
    json_object_object_add(x64_registers, "gdtr_0", json_object_new_uint64(registers->Gdtr[0]));
    json_object_object_add(x64_registers, "gdtr_1", json_object_new_uint64(registers->Gdtr[1]));
    json_object_object_add(x64_registers, "idtr_0", json_object_new_uint64(registers->Idtr[0]));
    json_object_object_add(x64_registers, "idtr_1", json_object_new_uint64(registers->Idtr[1]));
    json_object_object_add(x64_registers, "ldtr", json_object_new_int(registers->Ldtr));
    json_object_object_add(x64_registers, "tr", json_object_new_int(registers->Tr));

    return x64_registers;
}

//////////////////
/// IR TO CPER ///
//////////////////

//Converts a single IA32/x64 CPER-JSON section into CPER binary, outputting to the provided stream.
void ir_section_ia32x64_to_cper(json_object* section, FILE* out)
{
    EFI_IA32_X64_PROCESSOR_ERROR_RECORD* section_cper = 
        (EFI_IA32_X64_PROCESSOR_ERROR_RECORD*)calloc(1, sizeof(EFI_IA32_X64_PROCESSOR_ERROR_RECORD));

    //Validation bits.
    json_object* validation = json_object_object_get(section, "validationBits");
    section_cper->ValidFields = 0x0;
    section_cper->ValidFields |= json_object_get_boolean(json_object_object_get(validation, "localAPICIDValid"));
    section_cper->ValidFields |= json_object_get_boolean(json_object_object_get(validation, "cpuIDInfoValid")) << 1;
    int proc_error_info_num = json_object_get_int(json_object_object_get(validation, "processorErrorInfoNum")) & 0b111111;
    int proc_ctx_info_num = json_object_get_int(json_object_object_get(validation, "processorContextInfoNum")) & 0b111111;
    section_cper->ValidFields |= proc_error_info_num << 2;
    section_cper->ValidFields |= proc_ctx_info_num << 8;

    //Local APIC ID.
    section_cper->ApicId = json_object_get_uint64(json_object_object_get(section, "localAPICID"));
    
    //CPUID info.
    json_object* cpuid_info = json_object_object_get(section, "cpuidInfo");
    EFI_IA32_X64_CPU_ID* cpuid_info_cper = (EFI_IA32_X64_CPU_ID*)section_cper->CpuIdInfo;
    cpuid_info_cper->Eax = json_object_get_uint64(json_object_object_get(cpuid_info, "eax"));
    cpuid_info_cper->Ebx = json_object_get_uint64(json_object_object_get(cpuid_info, "ebx"));
    cpuid_info_cper->Ecx = json_object_get_uint64(json_object_object_get(cpuid_info, "ecx"));
    cpuid_info_cper->Edx = json_object_get_uint64(json_object_object_get(cpuid_info, "edx"));

    //Flush the header to file before dealing w/ info sections.
    fwrite(section_cper, sizeof(EFI_IA32_X64_PROCESSOR_ERROR_RECORD), 1, out);
    fflush(out);
    free(section_cper);

    //Iterate and deal with sections.
    json_object* error_info = json_object_object_get(section, "processorErrorInfo");
    json_object* context_info = json_object_object_get(section, "processorContextInfo");
    for (int i=0; i<proc_error_info_num; i++)
        ir_ia32x64_error_info_to_cper(json_object_array_get_idx(error_info, i), out);
    for (int i=0; i<proc_ctx_info_num; i++)
        ir_ia32x64_context_info_to_cper(json_object_array_get_idx(context_info, i), out);
}

//Converts a single CPER-JSON IA32/x64 error information structure into CPER binary, outputting to the
//provided stream.
void ir_ia32x64_error_info_to_cper(json_object* error_info, FILE* out)
{
    EFI_IA32_X64_PROCESS_ERROR_INFO* error_info_cper = 
        (EFI_IA32_X64_PROCESS_ERROR_INFO*)calloc(1, sizeof(EFI_IA32_X64_PROCESS_ERROR_INFO));

    //Error structure type.
    string_to_guid(&error_info_cper->ErrorType, json_object_get_string(json_object_object_get(error_info, "type")));

    //Validation bits.
    error_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(error_info, "validationBits"), 
        5, IA32X64_PROCESSOR_ERROR_VALID_BITFIELD_NAMES);

    //Check information, parsed based on the error type.
    json_object* check_info = json_object_object_get(error_info, "checkInfo");
    if (guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeCacheCheckGuid)
        || guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeTlbCheckGuid))
    {
        ir_ia32x64_cache_tlb_check_error_to_cper(check_info, (EFI_IA32_X64_CACHE_CHECK_INFO*)&error_info_cper->CheckInfo);
    }
    else if (guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeBusCheckGuid))
        ir_ia32x64_bus_check_error_to_cper(check_info, (EFI_IA32_X64_BUS_CHECK_INFO*)&error_info_cper->CheckInfo);
    else if (guid_equal(&error_info_cper->ErrorType, &gEfiIa32x64ErrorTypeMsCheckGuid))
        ir_ia32x64_ms_check_error_to_cper(check_info, (EFI_IA32_X64_MS_CHECK_INFO*)&error_info_cper->CheckInfo);

    //Miscellaneous numeric fields.
    error_info_cper->TargetId = json_object_get_uint64(json_object_object_get(error_info, "targetAddressID"));
    error_info_cper->RequestorId = json_object_get_uint64(json_object_object_get(error_info, "requestorID"));
    error_info_cper->ResponderId = json_object_get_uint64(json_object_object_get(error_info, "responderID"));
    error_info_cper->InstructionIP = json_object_get_uint64(json_object_object_get(error_info, "instructionPointer"));

    //Write out to stream, then free resources.
    fwrite(error_info_cper, sizeof(EFI_IA32_X64_PROCESS_ERROR_INFO), 1, out);
    fflush(out);
    free(error_info_cper);
}

//Converts a single CPER-JSON IA32/x64 cache/TLB check error info structure to CPER binary.
void ir_ia32x64_cache_tlb_check_error_to_cper(json_object* check_info, EFI_IA32_X64_CACHE_CHECK_INFO* check_info_cper)
{
    //Validation bits.
    check_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(check_info, "validationBits"), 
        8, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);

    //Transaction type, operation.
    check_info_cper->TransactionType = readable_pair_to_integer(json_object_object_get(check_info, "transactionType"));
    check_info_cper->Operation = readable_pair_to_integer(json_object_object_get(check_info, "operation"));

    //Miscellaneous raw value fields.
    check_info_cper->Level = json_object_get_uint64(json_object_object_get(check_info, "level"));
    check_info_cper->ContextCorrupt = json_object_get_boolean(json_object_object_get(check_info, "processorContextCorrupt"));
    check_info_cper->ErrorUncorrected = json_object_get_boolean(json_object_object_get(check_info, "uncorrected"));
    check_info_cper->PreciseIp = json_object_get_boolean(json_object_object_get(check_info, "preciseIP"));
    check_info_cper->RestartableIp = json_object_get_boolean(json_object_object_get(check_info, "restartableIP"));
    check_info_cper->Overflow = json_object_get_boolean(json_object_object_get(check_info, "overflow"));
}

//Converts a single CPER-JSON IA32/x64 bus error info structure to CPER binary.
void ir_ia32x64_bus_check_error_to_cper(json_object* check_info, EFI_IA32_X64_BUS_CHECK_INFO* check_info_cper)
{
    //Validation bits.
    check_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(check_info, "validationBits"), 
        11, IA32X64_CHECK_INFO_VALID_BITFIELD_NAMES);

    //Readable pair fields.
    check_info_cper->TransactionType = readable_pair_to_integer(json_object_object_get(check_info, "transactionType"));
    check_info_cper->Operation = readable_pair_to_integer(json_object_object_get(check_info, "operation"));
    check_info_cper->ParticipationType = readable_pair_to_integer(json_object_object_get(check_info, "participationType"));
    check_info_cper->AddressSpace = readable_pair_to_integer(json_object_object_get(check_info, "addressSpace"));

    //Miscellaneous raw value fields.
    check_info_cper->Level = json_object_get_uint64(json_object_object_get(check_info, "level"));
    check_info_cper->ContextCorrupt = json_object_get_boolean(json_object_object_get(check_info, "processorContextCorrupt"));
    check_info_cper->ErrorUncorrected = json_object_get_boolean(json_object_object_get(check_info, "uncorrected"));
    check_info_cper->PreciseIp = json_object_get_boolean(json_object_object_get(check_info, "preciseIP"));
    check_info_cper->RestartableIp = json_object_get_boolean(json_object_object_get(check_info, "restartableIP"));
    check_info_cper->Overflow = json_object_get_boolean(json_object_object_get(check_info, "overflow"));
    check_info_cper->TimeOut = json_object_get_boolean(json_object_object_get(check_info, "timedOut"));
}

//Converts a single CPER-JSON IA32/x64 MS error info structure to CPER binary.
void ir_ia32x64_ms_check_error_to_cper(json_object* check_info, EFI_IA32_X64_MS_CHECK_INFO* check_info_cper)
{
    //Validation bits.
    check_info_cper->ValidFields = ir_to_bitfield(json_object_object_get(check_info, "validationBits"), 
        6, IA32X64_CHECK_INFO_MS_CHECK_VALID_BITFIELD_NAMES);

    //Type of MS check error.
    check_info_cper->ErrorType = readable_pair_to_integer(json_object_object_get(check_info, "errorType"));

    //Miscellaneous raw value fields.
    check_info_cper->ContextCorrupt = json_object_get_boolean(json_object_object_get(check_info, "processorContextCorrupt"));
    check_info_cper->ErrorUncorrected = json_object_get_boolean(json_object_object_get(check_info, "uncorrected"));
    check_info_cper->PreciseIp = json_object_get_boolean(json_object_object_get(check_info, "preciseIP"));
    check_info_cper->RestartableIp = json_object_get_boolean(json_object_object_get(check_info, "restartableIP"));
    check_info_cper->Overflow = json_object_get_boolean(json_object_object_get(check_info, "overflow"));
}

//Converts a single CPER-JSON IA32/x64 context information structure into CPER binary, outputting to the
//provided stream.
void ir_ia32x64_context_info_to_cper(json_object* context_info, FILE* out)
{
    EFI_IA32_X64_PROCESSOR_CONTEXT_INFO* context_info_cper = 
        (EFI_IA32_X64_PROCESSOR_CONTEXT_INFO*)calloc(1, sizeof(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO));

    //Register context type.
    context_info_cper->RegisterType = (UINT16)readable_pair_to_integer(json_object_object_get(context_info, "registerContextType"));

    //Miscellaneous numeric fields.
    context_info_cper->ArraySize = (UINT16)json_object_get_uint64(json_object_object_get(context_info, "registerArraySize"));
    context_info_cper->MsrAddress = (UINT32)json_object_get_uint64(json_object_object_get(context_info, "msrAddress"));
    context_info_cper->MmRegisterAddress = json_object_get_uint64(json_object_object_get(context_info, "mmRegisterAddress"));

    //Flush header to stream.
    fwrite(context_info_cper, sizeof(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO), 1, out);
    fflush(out);

    //Handle the register array, depending on type provided.
    json_object* register_array = json_object_object_get(context_info, "registerArray");
    if (context_info_cper->RegisterType == EFI_REG_CONTEXT_TYPE_IA32)
    {
        ir_ia32x64_ia32_registers_to_cper(register_array, out);
    }
    else if (context_info_cper->RegisterType == EFI_REG_CONTEXT_TYPE_X64)
    {
        ir_ia32x64_x64_registers_to_cper(register_array, out);
    }
    else 
    {
        //Unknown/structure is not defined.
        json_object* encoded = json_object_object_get(register_array, "data");
        char* decoded = b64_decode(json_object_get_string(encoded), json_object_get_string_len(encoded));
        fwrite(decoded, context_info_cper->ArraySize, 1, out);
        fflush(out);
    }

    //Free remaining resources.
    free(context_info_cper);
}

//Converts a single CPER-JSON IA32 register array into CPER binary, outputting to the given stream.
void ir_ia32x64_ia32_registers_to_cper(json_object* registers, FILE* out)
{
    EFI_CONTEXT_IA32_REGISTER_STATE register_state;
    register_state.Eax = (UINT32)json_object_get_uint64(json_object_object_get(registers, "eax"));
    register_state.Ebx = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ebx"));
    register_state.Ecx = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ecx"));
    register_state.Edx = (UINT32)json_object_get_uint64(json_object_object_get(registers, "edx"));
    register_state.Esi = (UINT32)json_object_get_uint64(json_object_object_get(registers, "esi"));
    register_state.Edi = (UINT32)json_object_get_uint64(json_object_object_get(registers, "edi"));
    register_state.Ebp = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ebp"));
    register_state.Esp = (UINT32)json_object_get_uint64(json_object_object_get(registers, "esp"));
    register_state.Cs = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cs"));
    register_state.Ds = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ds"));
    register_state.Ss = (UINT32)json_object_get_uint64(json_object_object_get(registers, "ss"));
    register_state.Es = (UINT32)json_object_get_uint64(json_object_object_get(registers, "es"));
    register_state.Fs = (UINT32)json_object_get_uint64(json_object_object_get(registers, "fs"));
    register_state.Gs = (UINT32)json_object_get_uint64(json_object_object_get(registers, "gs"));
    register_state.Eflags = (UINT32)json_object_get_uint64(json_object_object_get(registers, "eflags"));
    register_state.Eip = (UINT32)json_object_get_uint64(json_object_object_get(registers, "eip"));
    register_state.Cr0 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr0"));
    register_state.Cr1 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr1"));
    register_state.Cr2 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr2"));
    register_state.Cr3 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr3"));
    register_state.Cr4 = (UINT32)json_object_get_uint64(json_object_object_get(registers, "cr4"));

    //64-bit registers are split into two 32-bit parts.
    UINT64 gdtr = json_object_get_uint64(json_object_object_get(registers, "gdtr"));
    register_state.Gdtr[0] = gdtr >> 32;
    register_state.Gdtr[1] = gdtr & 0xFFFFFFFF;
    UINT64 idtr = json_object_get_uint64(json_object_object_get(registers, "idtr"));
    register_state.Idtr[0] = idtr >> 32;
    register_state.Idtr[1] = idtr & 0xFFFFFFFF;

    //16-bit registers.
    register_state.Ldtr = (UINT16)json_object_get_uint64(json_object_object_get(registers, "ldtr"));
    register_state.Tr = (UINT16)json_object_get_uint64(json_object_object_get(registers, "tr"));

    //Write out to stream.
    fwrite(&register_state, sizeof(EFI_CONTEXT_IA32_REGISTER_STATE), 1, out);
    fflush(out);
}

//Converts a single CPER-JSON x64 register array into CPER binary, outputting to the given stream.
void ir_ia32x64_x64_registers_to_cper(json_object* registers, FILE* out)
{
    EFI_CONTEXT_X64_REGISTER_STATE register_state;
    register_state.Rax = json_object_get_uint64(json_object_object_get(registers, "rax"));
    register_state.Rbx = json_object_get_uint64(json_object_object_get(registers, "rbx"));
    register_state.Rcx = json_object_get_uint64(json_object_object_get(registers, "rcx"));
    register_state.Rdx = json_object_get_uint64(json_object_object_get(registers, "rdx"));
    register_state.Rsi = json_object_get_uint64(json_object_object_get(registers, "rsi"));
    register_state.Rdi = json_object_get_uint64(json_object_object_get(registers, "rdi"));
    register_state.Rbp = json_object_get_uint64(json_object_object_get(registers, "rbp"));
    register_state.Rsp = json_object_get_uint64(json_object_object_get(registers, "rsp"));
    register_state.R8 = json_object_get_uint64(json_object_object_get(registers, "r8"));
    register_state.R9 = json_object_get_uint64(json_object_object_get(registers, "r9"));
    register_state.R10 = json_object_get_uint64(json_object_object_get(registers, "r10"));
    register_state.R11 = json_object_get_uint64(json_object_object_get(registers, "r11"));
    register_state.R12 = json_object_get_uint64(json_object_object_get(registers, "r12"));
    register_state.R13 = json_object_get_uint64(json_object_object_get(registers, "r13"));
    register_state.R14 = json_object_get_uint64(json_object_object_get(registers, "r14"));
    register_state.R15 = json_object_get_uint64(json_object_object_get(registers, "r15"));
    register_state.Cs = json_object_get_uint64(json_object_object_get(registers, "cs"));
    register_state.Ds = json_object_get_uint64(json_object_object_get(registers, "ds"));
    register_state.Ss = json_object_get_uint64(json_object_object_get(registers, "ss"));
    register_state.Es = json_object_get_uint64(json_object_object_get(registers, "es"));
    register_state.Fs = json_object_get_uint64(json_object_object_get(registers, "fs"));
    register_state.Gs = json_object_get_uint64(json_object_object_get(registers, "gs"));
    register_state.Rflags = json_object_get_uint64(json_object_object_get(registers, "rflags"));
    register_state.Rip = json_object_get_uint64(json_object_object_get(registers, "eip"));
    register_state.Cr0 = json_object_get_uint64(json_object_object_get(registers, "cr0"));
    register_state.Cr1 = json_object_get_uint64(json_object_object_get(registers, "cr1"));
    register_state.Cr2 = json_object_get_uint64(json_object_object_get(registers, "cr2"));
    register_state.Cr3 = json_object_get_uint64(json_object_object_get(registers, "cr3"));
    register_state.Cr4 = json_object_get_uint64(json_object_object_get(registers, "cr4"));
    register_state.Cr8 = json_object_get_uint64(json_object_object_get(registers, "cr8"));
    register_state.Gdtr[0] = json_object_get_uint64(json_object_object_get(registers, "gdtr_0"));
    register_state.Gdtr[1] = json_object_get_uint64(json_object_object_get(registers, "gdtr_1"));
    register_state.Idtr[0] = json_object_get_uint64(json_object_object_get(registers, "idtr_0"));
    register_state.Idtr[1] = json_object_get_uint64(json_object_object_get(registers, "idtr_1"));
    register_state.Ldtr = (UINT16)json_object_get_uint64(json_object_object_get(registers, "ldtr"));
    register_state.Tr = (UINT16)json_object_get_uint64(json_object_object_get(registers, "tr"));

    //Write out to stream.
    fwrite(&register_state, sizeof(EFI_CONTEXT_IA32_REGISTER_STATE), 1, out);
    fflush(out);
}