Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit e8ae0ab

Browse files
authored
Merge pull request #484 from Eclo/fix-endian-issue
Fixes issues with endian macros (in GCC)
2 parents 513f5ae + 4ee3626 commit e8ae0ab

34 files changed

+98
-98
lines changed

Application/TinyBooter/Commands.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ bool Loader_Engine::ProcessPayload( WP_Message* msg )
979979
LOADER_ENGINE_SETFLAG( this, c_LoaderEngineFlag_ValidConnection );
980980

981981
//--//
982-
#if defined(BIG_ENDIAN)
982+
#if defined(NETMF_TARGET_BIG_ENDIAN)
983983
SwapEndian( msg, msg->m_payload, msg->m_header.m_size, false );
984984
#endif
985985
size_t num;
@@ -1120,7 +1120,7 @@ bool Loader_Engine::TransmitMessage( const WP_Message* msg, bool fQueue )
11201120
UINT32 payloadSize;
11211121
UINT32 flags;
11221122

1123-
#if !defined(BIG_ENDIAN)
1123+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
11241124
payloadSize = msg->m_header.m_size;
11251125
flags = msg->m_header.m_flags;
11261126
#else
@@ -1178,7 +1178,7 @@ void Loader_Engine::ReplyToCommand( WP_Message* msg, bool fSuccess, bool fCritic
11781178

11791179
msgReply.Initialize( &m_controller );
11801180

1181-
#if defined(BIG_ENDIAN)
1181+
#if defined(NETMF_TARGET_BIG_ENDIAN)
11821182
SwapEndian( msg, ptr, size, true );
11831183
#endif
11841184
msgReply.PrepareReply( msg->m_header, flags, size, (UINT8*)ptr );
@@ -1203,7 +1203,7 @@ bool Loader_Engine::Monitor_Ping( WP_Message* msg )
12031203
CLR_DBG_Commands::Monitor_Ping::Reply cmdReply;
12041204
cmdReply.m_source = CLR_DBG_Commands::Monitor_Ping::c_Ping_Source_TinyBooter;
12051205

1206-
#if defined(BIG_ENDIAN)
1206+
#if defined(NETMF_TARGET_BIG_ENDIAN)
12071207
cmdReply.m_dbg_flags = CLR_DBG_Commands::Monitor_Ping::c_Ping_DbgFlag_BigEndian;
12081208
#endif
12091209

@@ -1587,7 +1587,7 @@ bool Loader_Engine::Monitor_FlashSectorMap( WP_Message* msg )
15871587
return true;
15881588
}
15891589

1590-
#if defined(BIG_ENDIAN)
1590+
#if defined(NETMF_TARGET_BIG_ENDIAN)
15911591

15921592
UINT32 Loader_Engine::SwapEndianPattern( UINT8* &buffer, UINT32 size, UINT32 count )
15931593
{

Application/TinyBooter/Commands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct Loader_Engine
147147
bool Monitor_SignatureKeyUpdate( WP_Message* msg );
148148
bool EnumerateAndLaunch ( );
149149

150-
#if defined(BIG_ENDIAN)
150+
#if defined(NETMF_TARGET_BIG_ENDIAN)
151151
public:
152152
void SwapDebuggingValue ( UINT8* &msg, UINT32 size );
153153
void SwapEndian ( WP_Message* msg, void* ptr, int size, bool fReply );

CLR/Core/CLR_RT_HeapBlock.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ HRESULT CLR_RT_HeapBlock::LoadFromReference( CLR_RT_HeapBlock& ref )
389389
else if(size == 1) { first = ((CLR_UINT8 *)src)[ 0 ]; }
390390
else { first = ((CLR_UINT16*)src)[ 0 ]; }
391391

392-
#if !defined(BIG_ENDIAN)
392+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
393393
((CLR_UINT32*)&NumericByRef())[ 0 ] = first;
394394
((CLR_UINT32*)&NumericByRef())[ 1 ] = second;
395395
#else
@@ -403,7 +403,7 @@ HRESULT CLR_RT_HeapBlock::LoadFromReference( CLR_RT_HeapBlock& ref )
403403
((CLR_UINT32*)&NumericByRef())[ 0 ] = second;
404404
((CLR_UINT32*)&NumericByRef())[ 1 ] = first;
405405
}
406-
#endif //BIG_ENDIAN
406+
#endif //NETMF_TARGET_BIG_ENDIAN
407407

408408
TINYCLR_SET_AND_LEAVE(S_OK);
409409
}
@@ -531,7 +531,7 @@ HRESULT CLR_RT_HeapBlock::StoreToReference( CLR_RT_HeapBlock& ref, int size )
531531
}
532532
}
533533

534-
#if !defined(BIG_ENDIAN)
534+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
535535
CLR_UINT32 first = ((CLR_UINT32*)&obj->NumericByRef())[ 0 ];
536536
CLR_UINT32 second = ((CLR_UINT32*)&obj->NumericByRef())[ 1 ];
537537
#else
@@ -548,7 +548,7 @@ HRESULT CLR_RT_HeapBlock::StoreToReference( CLR_RT_HeapBlock& ref, int size )
548548
first = ((CLR_UINT32*)&obj->NumericByRef())[ 1 ];
549549
second = ((CLR_UINT32*)&obj->NumericByRef())[ 0 ];
550550
}
551-
#endif //BIG_ENDIAN
551+
#endif //NETMF_TARGET_BIG_ENDIAN
552552

553553
if (sizeArray == 4) { ((CLR_UINT32*)dst)[ 0 ] = (CLR_UINT32)first; }
554554
else if(sizeArray == 8) { ((CLR_UINT32*)dst)[ 0 ] = (CLR_UINT32)first; ((CLR_UINT32*)dst)[ 1 ] = (CLR_UINT32)second; }

CLR/Core/CLR_RT_HeapBlock_Array.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ HRESULT CLR_RT_HeapBlock_Array::IndexOf( CLR_RT_HeapBlock_Array* array, CLR_RT_H
206206

207207
while(true)
208208
{
209-
#if !defined(BIG_ENDIAN)
209+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
210210
if(memcmp( data, &matchPtr->NumericByRef(), sizeElem ) == 0)
211211
{
212212
index = pos;

CLR/Core/Execution.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3067,7 +3067,7 @@ void CLR_RT_ExecutionEngine::StopOnBreakpoint( CLR_DBG_Commands::Debugging_Execu
30673067

30683068
if(m_breakpointsActiveNum == 1)
30693069
{
3070-
#if defined(BIG_ENDIAN)
3070+
#if defined(NETMF_TARGET_BIG_ENDIAN)
30713071
static CLR_DBG_Commands::Debugging_Execution_BreakpointDef s_breakpoint;
30723072
CLR_UINT8* data;
30733073

CLR/Core/Serialization/BinaryFormatter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ HRESULT CLR_RT_BinaryFormatter::State::AdvanceToTheNextElement()
16351635
{
16361636
TINYCLR_CHECK_HRESULT(m_parent->ReadBits( val, bits ));
16371637

1638-
#if !defined(BIG_ENDIAN)
1638+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
16391639
memcpy( ptr, &val, size );
16401640
#else
16411641
memcpy( ptr, ((unsigned char*)&val)+(sizeof(val)-size), size );

CLR/Core/Streams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ HRESULT CLR_RT_HeapBlock_MemoryStream::ReadBits( CLR_UINT64& res, CLR_UINT32 bit
165165

166166
CLR_UINT32* ptr = (CLR_UINT32*)&res;
167167

168-
#if !defined(BIG_ENDIAN)
168+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
169169
if(bits > 32) { TINYCLR_CHECK_HRESULT(ReadBits( ptr[ 1 ], bits - 32 )); bits = 32; }
170170
else { ptr[ 1 ] = 0; }
171171

CLR/Core/TypeSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ bool CLR_RECORD_ASSEMBLY::GoodHeader() const
13421342
NATIVE_PROFILE_CLR_CORE();
13431343
CLR_RECORD_ASSEMBLY header = *this; header.headerCRC = 0;
13441344

1345-
#if !defined(BIG_ENDIAN)
1345+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
13461346
if ( (header.flags & CLR_RECORD_ASSEMBLY::c_Flags_BigEndian) == CLR_RECORD_ASSEMBLY::c_Flags_BigEndian)
13471347
#else
13481348
if ( (header.flags & CLR_RECORD_ASSEMBLY::c_Flags_BigEndian) != CLR_RECORD_ASSEMBLY::c_Flags_BigEndian)
@@ -4430,7 +4430,7 @@ HRESULT CLR_RT_AttributeParser::Next( Value*& res )
44304430
CLR_UINT32 size = (dtl.m_sizeInBits + 7) / 8;
44314431

44324432
// FIXME GJS - the numeric values, what is their endiannes??? In the MSTV code there is a BIG endian fix but it looks like it will not work, so was it ever used?
4433-
#if !defined(BIG_ENDIAN)
4433+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
44344434
memcpy( &m_lastValue.m_value.NumericByRef(), m_blob, size ); m_blob += size;
44354435
#else
44364436
switch(size)

CLR/Debugger/Debugger.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ bool CLR_DBG_Debugger::Monitor_Ping( WP_Message* msg, void* owner )
370370

371371
cmdReply.m_source = CLR_DBG_Commands::Monitor_Ping::c_Ping_Source_TinyCLR;
372372

373-
#if !defined(BIG_ENDIAN)
373+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
374374
cmdReply.m_dbg_flags = CLR_EE_DBG_IS(State_ProgramExited) != 0 ? CLR_DBG_Commands::Monitor_Ping::c_Ping_DbgFlag_AppExit : 0;
375375
#else
376376
cmdReply.m_dbg_flags = CLR_DBG_Commands::Monitor_Ping::c_Ping_DbgFlag_BigEndian;
@@ -1432,7 +1432,7 @@ static bool FillValues( CLR_RT_HeapBlock* ptr, CLR_DBG_Commands::Debugging_Value
14321432
// Primitives or optimized value types.
14331433
//
14341434

1435-
#if !defined(BIG_ENDIAN)
1435+
#if !defined(NETMF_TARGET_BIG_ENDIAN)
14361436
memcpy( dst->m_builtinValue, (void*)&ptr->NumericByRefConst().u1, 8 );
14371437
#else
14381438
{

CLR/Include/TinyCLR_Messaging.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct CLR_Messaging
175175
static bool Messaging_Send__Reply ( WP_Message* msg, void* owner );
176176
static bool Messaging_Reply ( WP_Message* msg, void* owner );
177177
static bool Messaging_Reply__Reply ( WP_Message* msg, void* owner );
178-
#if defined(BIG_ENDIAN)
178+
#if defined(NETMF_TARGET_BIG_ENDIAN)
179179
public:
180180
static void SwapDebuggingValue ( UINT8* &msg, UINT32 size );
181181
static void SwapEndian ( WP_Message* msg, void* ptr, int size, bool fReply );

0 commit comments

Comments
 (0)