I am trying to write a test app that unmarshals a binary blob. The blob is generated by a low-level h/w interface. Based on the c header I found that the binary blob is defined in this way,
typedef struct Report
{
uint32_t SnpVersion;
uint32_t SnpGuestSvn;
union {
uint64_t ModelVer_t;
struct {
uint64_t AbiMinor:8;
uint64_t AbiMajor:8;
uint64_t TTAllowed:1;
uint64_t RrvdTrue:1;
uint64_t MigrateTTAllowed:1;
uint64_t DebugAllowed:1;
uint64_t RrvdFalse:44;
} TuneConfig;
} TunePolicy;
union {
uint64_t Asuint64_t;
struct {
uint64_t TTEnabled:1;
uint64_t RRvd:63;
} ChannelConfig;
} ChannelPolicy;
uint8_t PolicyDigest[48];
}
I need to do unmarshalling of the binary blob in c#. Based on the ref at this link, https://learn.microsoft.com/en-us/dotnet/framework/interop/marshalling-classes-structures-and-unions, I should be able to generate it. However, I am still not sure about the syntax of representing the AbiMinor:8
; The reserved bits in managed code.