/**
 * Functions for generating pseudo-random CPER generic processor sections.
 * 
 * Author: Lawrence.Tang@arm.com
 **/

#include <stdlib.h>
#include "../../edk/BaseTypes.h"
#include "../gen-utils.h"
#include "gen-sections.h"

//Generates a single pseudo-random generic processor section, saving the resulting address to the given
//location. Returns the size of the newly created section.
size_t generate_section_generic(void** location)
{
    //Create random bytes.
    size_t size = generate_random_section(location, 192);

    //Set reserved locations to zero.
    UINT8* start_byte = (UINT8*)*location;
    *((UINT64*)start_byte) &= 0xFFF;
    *(start_byte + 12) &= 0b111;
    *((UINT16*)(start_byte + 14)) = 0x0;
    
    //Ensure CPU brand string does not terminate early.
    for (int i=0; i<128; i++)
    {
        UINT8* byte = start_byte + 24 + i;
        if (*byte == 0x0)
            *byte = rand() % 127 + 1;

        //Null terminate last byte.
        if (i == 127)
            *byte = 0x0;
    }

    return size;
}