/**
 * 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 "base64.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_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 &
						       0x1));
	json_object_object_add(
		validationBits, "cpuIDInfoValid",
		json_object_new_boolean((record->ValidFields >> 1) & 0x1));
	int processor_error_info_num = (record->ValidFields >> 2) & 0x3F;
	json_object_object_add(validationBits, "processorErrorInfoNum",
			       json_object_new_int(processor_error_info_num));
	int processor_context_info_num = (record->ValidFields >> 8) & 0x3F;
	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;
	void *cur_pos = (void *)current_context_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, &cur_pos));
		current_context_info =
			(EFI_IA32_X64_PROCESSOR_CONTEXT_INFO *)cur_pos;
		//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 *type = json_object_new_object();
	json_object_object_add(type, "guid",
			       json_object_new_string(error_type));

	//Get the error structure type as a readable string.
	const char *readable_type = "Unknown";
	if (guid_equal(&error_info->ErrorType,
		       &gEfiIa32x64ErrorTypeCacheCheckGuid)) {
		readable_type = "Cache Check Error";
	} else if (guid_equal(&error_info->ErrorType,
			      &gEfiIa32x64ErrorTypeTlbCheckGuid)) {
		readable_type = "TLB Check Error";
	} else if (guid_equal(&error_info->ErrorType,
			      &gEfiIa32x64ErrorTypeBusCheckGuid)) {
		readable_type = "Bus Check Error";
	} else if (guid_equal(&error_info->ErrorType,
			      &gEfiIa32x64ErrorTypeMsCheckGuid)) {
		readable_type = "MS Check Error";
	}
	json_object_object_add(type, "name",
			       json_object_new_string(readable_type));
	json_object_object_add(error_info_ir, "type", 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);

		int32_t encoded_len = 0;
		char *encoded = base64_encode((UINT8 *)*cur_pos,
					      context_info->ArraySize,
					      &encoded_len);
		if (encoded == NULL) {
			printf("Failed to allocate encode output buffer. \n");
		} else {
			register_array = json_object_new_object();
			json_object_object_add(register_array, "data",
					       json_object_new_string_len(
						       encoded, encoded_len));
			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")) &
		0x3F;
	int proc_ctx_info_num =
		json_object_get_int(json_object_object_get(
			validation, "processorContextInfoNum")) &
		0x3F;
	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.
	json_object *type = json_object_object_get(error_info, "type");
	string_to_guid(
		&error_info_cper->ErrorType,
		json_object_get_string(json_object_object_get(type, "guid")));

	//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");
		int32_t decoded_len = 0;
		const char *j_string = json_object_get_string(encoded);
		int j_size = json_object_get_string_len(encoded);
		UINT8 *decoded = base64_decode(j_string, j_size, &decoded_len);
		if (decoded == NULL) {
			printf("Failed to allocate decode output buffer. \n");
		} else {
			fwrite(decoded, decoded_len, 1, out);
			fflush(out);
			free(decoded);
		}
	}

	//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 = (UINT16)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 = (UINT16)json_object_get_uint64(
		json_object_object_get(registers, "ss"));
	register_state.Es = (UINT16)json_object_get_uint64(
		json_object_object_get(registers, "es"));
	register_state.Fs = (UINT16)json_object_get_uint64(
		json_object_object_get(registers, "fs"));
	register_state.Gs = (UINT16)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 & 0xFFFFFFFF;
	register_state.Gdtr[1] = gdtr >> 32;
	UINT64 idtr = json_object_get_uint64(
		json_object_object_get(registers, "idtr"));
	register_state.Idtr[0] = idtr & 0xFFFFFFFF;
	register_state.Idtr[1] = idtr >> 32;

	//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 = (UINT16)json_object_get_int(
		json_object_object_get(registers, "cs"));
	register_state.Ds = (UINT16)json_object_get_int(
		json_object_object_get(registers, "ds"));
	register_state.Ss = (UINT16)json_object_get_int(
		json_object_object_get(registers, "ss"));
	register_state.Es = (UINT16)json_object_get_int(
		json_object_object_get(registers, "es"));
	register_state.Fs = (UINT16)json_object_get_int(
		json_object_object_get(registers, "fs"));
	register_state.Gs = (UINT16)json_object_get_int(
		json_object_object_get(registers, "gs"));
	register_state.Resv1 = 0;
	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_int(
		json_object_object_get(registers, "ldtr"));
	register_state.Tr = (UINT16)json_object_get_int(
		json_object_object_get(registers, "tr"));

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