Skip to content

Commit

Permalink
Enable Target_GetReleaseInfo (#267)
Browse files Browse the repository at this point in the history
- implement Target_GetReleaseInfo
- rename structs

Signed-off-by: José Simões <[email protected]>
  • Loading branch information
josesimoes authored Mar 30, 2017
1 parent 2ad5749 commit e3b53ad
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 40 deletions.
31 changes: 15 additions & 16 deletions src/CLR/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -937,32 +937,32 @@ bool CLR_DBG_Debugger::Debugging_Execution_ChangeConditions( WP_Message* msg)

static void GetClrReleaseInfo(CLR_DBG_Commands::Debugging_Execution_QueryCLRCapabilities::ClrInfo& clrInfo)
{
MfReleaseInfo::Init( clrInfo.m_clrReleaseInfo, VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION, OEMSYSTEMINFOSTRING, hal_strlen_s(OEMSYSTEMINFOSTRING) );
NFReleaseInfo::Init( clrInfo.m_clrReleaseInfo, VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION, OEMSYSTEMINFOSTRING, hal_strlen_s(OEMSYSTEMINFOSTRING) );

if ( g_CLR_RT_TypeSystem.m_assemblyMscorlib &&
g_CLR_RT_TypeSystem.m_assemblyMscorlib->m_header)
{
const CLR_RECORD_VERSION* mscorlibVer = & (g_CLR_RT_TypeSystem.m_assemblyMscorlib->m_header->version);
MFVersion::Init( clrInfo.m_TargetFrameworkVersion,
NFVersion::Init( clrInfo.m_TargetFrameworkVersion,
mscorlibVer->iMajorVersion, mscorlibVer->iMinorVersion,
mscorlibVer->iBuildNumber, mscorlibVer->iRevisionNumber
);
}
else
{
MFVersion::Init( clrInfo.m_TargetFrameworkVersion, 0, 0, 0, 0 );
NFVersion::Init( clrInfo.m_TargetFrameworkVersion, 0, 0, 0, 0 );
}
}


void MfReleaseInfo::Init(MfReleaseInfo& mfReleaseInfo, unsigned short int major, unsigned short int minor, unsigned short int build, unsigned short int revision, const char *info, size_t infoLen)
void NFReleaseInfo::Init(NFReleaseInfo& NFReleaseInfo, unsigned short int major, unsigned short int minor, unsigned short int build, unsigned short int revision, const char *info, size_t infoLen)
{
MFVersion::Init( mfReleaseInfo.version, major, minor, build, revision );
mfReleaseInfo.infoString[ 0 ] = 0;
NFVersion::Init( NFReleaseInfo.version, major, minor, build, revision );
NFReleaseInfo.infoString[ 0 ] = 0;
if ( NULL != info && infoLen > 0 )
{
const size_t len = MIN(infoLen, sizeof(mfReleaseInfo.infoString)-1);
hal_strncpy_s( (char*)&mfReleaseInfo.infoString[ 0 ], sizeof(mfReleaseInfo.infoString), info, len );
const size_t len = MIN(infoLen, sizeof(NFReleaseInfo.infoString)-1);
hal_strncpy_s( (char*)&NFReleaseInfo.infoString[ 0 ], sizeof(NFReleaseInfo.infoString), info, len );
}
}

Expand Down Expand Up @@ -1067,14 +1067,13 @@ bool CLR_DBG_Debugger::Debugging_Execution_QueryCLRCapabilities( WP_Message* msg
size = sizeof(reply.u_ClrInfo);
break;

case CLR_DBG_Commands::Debugging_Execution_QueryCLRCapabilities::c_SolutionReleaseInfo:
// UNDONE: FIXME
// if(Solution_GetReleaseInfo(reply.u_SolutionReleaseInfo) == true)
// {
// data = (CLR_UINT8*)&reply.u_SolutionReleaseInfo;
// size = sizeof(reply.u_SolutionReleaseInfo);
// }
// else
case CLR_DBG_Commands::Debugging_Execution_QueryCLRCapabilities::c_TargetReleaseInfo:
if(Target_GetReleaseInfo(reply.u_TargetReleaseInfo) == true)
{
data = (CLR_UINT8*)&reply.u_TargetReleaseInfo;
size = sizeof(reply.u_TargetReleaseInfo);
}
else
{
fSuccess = false;
}
Expand Down
10 changes: 5 additions & 5 deletions src/CLR/Debugger/Debugger_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ __nfweak void CLR_DBG_Debugger::BroadcastEvent( unsigned int cmd, unsigned int p
NATIVE_PROFILE_CLR_DEBUGGER();
}

__nfweak void MfReleaseInfo::Init( MfReleaseInfo& mfReleaseInfo, unsigned short int major, unsigned short int minor, unsigned short int build, unsigned short int revision, const char *info, size_t infoLen )
__nfweak void NFReleaseInfo::Init( NFReleaseInfo& NFReleaseInfo, unsigned short int major, unsigned short int minor, unsigned short int build, unsigned short int revision, const char *info, size_t infoLen )
{
MFVersion::Init( mfReleaseInfo.version, major, minor, build, revision );
mfReleaseInfo.infoString[ 0 ] = 0;
NFVersion::Init( NFReleaseInfo.version, major, minor, build, revision );
NFReleaseInfo.infoString[ 0 ] = 0;
if ( NULL != info && infoLen > 0 )
{
const size_t len = MIN(infoLen, sizeof(mfReleaseInfo.infoString)-1);
hal_strncpy_s( (char*)&mfReleaseInfo.infoString[0], sizeof(mfReleaseInfo.infoString), info, len );
const size_t len = MIN(infoLen, sizeof(NFReleaseInfo.infoString)-1);
hal_strncpy_s( (char*)&NFReleaseInfo.infoString[0], sizeof(NFReleaseInfo.infoString), info, len );
}
}
10 changes: 5 additions & 5 deletions src/CLR/Include/nanoCLR_Debugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct CLR_DBG_Commands
{
struct Reply
{
MfReleaseInfo m_releaseInfo;
NFReleaseInfo m_releaseInfo;
};
};

Expand Down Expand Up @@ -260,7 +260,7 @@ struct CLR_DBG_Commands
static const CLR_UINT32 c_CapabilityVersion = 3;
static const CLR_UINT32 c_HalSystemInfo = 5;
static const CLR_UINT32 c_ClrInfo = 6;
static const CLR_UINT32 c_SolutionReleaseInfo = 7;
static const CLR_UINT32 c_TargetReleaseInfo = 7;

static const CLR_UINT32 c_CapabilityFlags_FloatingPoint = 0x00000001;
static const CLR_UINT32 c_CapabilityFlags_SourceLevelDebugging = 0x00000002;
Expand Down Expand Up @@ -290,8 +290,8 @@ struct CLR_DBG_Commands

struct __nfpack ClrInfo
{
MfReleaseInfo m_clrReleaseInfo;
MFVersion m_TargetFrameworkVersion;
NFReleaseInfo m_clrReleaseInfo;
NFVersion m_TargetFrameworkVersion;
};

union ReplyUnion
Expand All @@ -301,7 +301,7 @@ struct CLR_DBG_Commands
SoftwareVersion u_SoftwareVersion;
HalSystemInfo u_HalSystemInfo;
ClrInfo u_ClrInfo;
MfReleaseInfo u_SolutionReleaseInfo;
NFReleaseInfo u_TargetReleaseInfo;
};
};

Expand Down
23 changes: 12 additions & 11 deletions src/HAL/Include/nanoHAL_ReleaseInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

#include <nanoPackStruct.h>

struct __nfpack MFVersion
struct __nfpack NFVersion
{
unsigned short usMajor;
unsigned short usMinor;
unsigned short usBuild;
unsigned short usRevision;

// Version & MfReleaseInfo participate in a union in the debugging support,
// Version & NFReleaseInfo participate in a union in the debugging support,
// and therefore cannot have real constructors, though that would be better
// style otherwise.
static void Init(MFVersion& version, unsigned short major=0, unsigned short minor=0, unsigned short build=0, unsigned short revision=0)
static void Init(NFVersion& version, unsigned short major=0, unsigned short minor=0, unsigned short build=0, unsigned short revision=0)
{
version.usMajor = major;
version.usMinor = minor;
Expand All @@ -27,12 +27,12 @@ struct __nfpack MFVersion
}
};

struct __nfpack MfReleaseInfo
struct __nfpack NFReleaseInfo
{
MFVersion version;
unsigned char infoString[64-sizeof(MFVersion)];
NFVersion version;
unsigned char infoString[64-sizeof(NFVersion)];

static void Init(MfReleaseInfo& releaseInfo, unsigned short major=0, unsigned short minor=0, unsigned short build=0, unsigned short revision=0, const char *info=(const char *)NULL, size_t infoLen=0);
static void Init(NFReleaseInfo& releaseInfo, unsigned short major=0, unsigned short minor=0, unsigned short build=0, unsigned short revision=0, const char *info=(const char *)NULL, size_t infoLen=0);
};

struct __nfpack OEM_MODEL_SKU
Expand All @@ -50,7 +50,7 @@ struct __nfpack OEM_SERIAL_NUMBERS

struct __nfpack HalSystemInfo
{
MfReleaseInfo m_releaseInfo;
NFReleaseInfo m_releaseInfo;
OEM_MODEL_SKU m_OemModelInfo;
OEM_SERIAL_NUMBERS m_OemSerialNumbers;
};
Expand All @@ -63,13 +63,14 @@ struct __nfpack HalSystemInfo
bool GetHalSystemInfo(HalSystemInfo& systemInfo);

// Solution-specific function; see nanoBooterEntry.cpp in your solution's nanoBooter directory for implementation.
unsigned int nanoBooter_GetReleaseInfo(MfReleaseInfo& releaseInfo);
unsigned int nanoBooter_GetReleaseInfo(NFReleaseInfo& releaseInfo);

// Solution-specific function, provide this to allow access to a vendor-provided
// target specific function, provide this to allow access to a vendor-provided
// informative string and build-time version information.
unsigned int Solution_GetReleaseInfo(MfReleaseInfo&);
bool Target_GetReleaseInfo(NFReleaseInfo&);

//--//


#endif // _NANOHAL_RELEASEINFO_H_

11 changes: 10 additions & 1 deletion src/HAL/nanoHAL_SystemInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ bool GetHalSystemInfo(HalSystemInfo& systemInfo)
return FALSE;
#else

// MfReleaseInfo:
// NFReleaseInfo:
systemInfo.m_releaseInfo.version.usMajor = VERSION_MAJOR;
systemInfo.m_releaseInfo.version.usMinor = VERSION_MINOR;
systemInfo.m_releaseInfo.version.usBuild = VERSION_BUILD;
Expand All @@ -34,3 +34,12 @@ bool GetHalSystemInfo(HalSystemInfo& systemInfo)
return TRUE;
#endif
}

bool Target_GetReleaseInfo(NFReleaseInfo& releaseInfo)
{
NFReleaseInfo::Init(releaseInfo,
VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION,
OEMSYSTEMINFOSTRING, hal_strlen_s(OEMSYSTEMINFOSTRING)
);
return TRUE; // alternatively, return false if you didn't initialize the releaseInfo structure.
}
4 changes: 2 additions & 2 deletions targets/os/win32/nanoCLR/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@


// All solutions are expected to provide an implementation of this
unsigned int Solution_GetReleaseInfo(MfReleaseInfo& releaseInfo)
bool Target_GetReleaseInfo(NFReleaseInfo& releaseInfo)
{
MfReleaseInfo::Init(releaseInfo,
NFReleaseInfo::Init(releaseInfo,
VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD, VERSION_REVISION,
OEMSYSTEMINFOSTRING, hal_strlen_s(OEMSYSTEMINFOSTRING)
);
Expand Down

0 comments on commit e3b53ad

Please sign in to comment.