[ros-dev] [ros-diffs] [cgutman] 59704: [CMAKE] - Define i386 on x86 MSVC builds - Probably fixes the infamous MSVC networking issues caused by tcpip.h assuming it was a big-endian platform and never byte-swapping anythi...
Cameron Gutman
cameron.gutman at reactos.org
Mon Aug 12 14:19:47 UTC 2013
My original plan was to switch to a different definition, but at least
one MS header (netiodef.h in WDK 8.0) uses i386 too.
On 8/12/2013 1:04 AM, Timo Kreuzer wrote:
> I remember some time ago, I ran into a problem with "i386" definition
> somewhere, because it was used in a structure or something. I would
> prefer to use standard definitions as much as possible. And in the case
> of Windows code, I would consider MS to be standard. So IMO we should
> use _X86_ or _M_IX86 whenever possible.
>
>
> Am 12.08.2013 03:12, schrieb cgutman at svn.reactos.org:
>> Author: cgutman
>> Date: Mon Aug 12 01:12:25 2013
>> New Revision: 59704
>>
>> URL: http://svn.reactos.org/svn/reactos?rev=59704&view=rev
>> Log:
>> [CMAKE]
>> - Define i386 on x86 MSVC builds
>> - Probably fixes the infamous MSVC networking issues caused by tcpip.h assuming it was a big-endian platform and never byte-swapping anything
>> [TCPIP][LAN]
>> - Fix byteswapping on AMD64 and ARM builds too
>>
>> Modified:
>> trunk/reactos/CMakeLists.txt
>> trunk/reactos/drivers/network/lan/include/net_wh.h
>> trunk/reactos/drivers/network/tcpip/include/tcpip.h
>>
>> Modified: trunk/reactos/CMakeLists.txt
>> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=59704&r1=59703&r2=59704&view=diff
>> ==============================================================================
>> --- trunk/reactos/CMakeLists.txt [iso-8859-1] (original)
>> +++ trunk/reactos/CMakeLists.txt [iso-8859-1] Mon Aug 12 01:12:25 2013
>> @@ -142,7 +142,7 @@
>>
>> # Arch Options
>> if(ARCH STREQUAL "i386")
>> - add_definitions(-D_M_IX86 -D_X86_ -D__i386__)
>> + add_definitions(-D_M_IX86 -D_X86_ -D__i386__ -Di386)
>> elseif(ARCH STREQUAL "amd64")
>> add_definitions(-D_M_AMD64 -D_AMD64_ -D__x86_64__ -D_WIN64)
>> elseif(ARCH STREQUAL "arm")
>>
>> Modified: trunk/reactos/drivers/network/lan/include/net_wh.h
>> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/lan/include/net_wh.h?rev=59704&r1=59703&r2=59704&view=diff
>> ==============================================================================
>> --- trunk/reactos/drivers/network/lan/include/net_wh.h [iso-8859-1] (original)
>> +++ trunk/reactos/drivers/network/lan/include/net_wh.h [iso-8859-1] Mon Aug 12 01:12:25 2013
>> @@ -1,6 +1,6 @@
>> #pragma once
>>
>> -#ifdef i386
>> +#if defined(i386) || defined(_AMD64_) || defined(_ARM_)
>>
>> /* DWORD network to host byte order conversion for i386 */
>> #define DN2H(dw) \
>> @@ -26,7 +26,7 @@
>> ((((w) & 0xFF00) >> 8) | \
>> (((w) & 0x00FF) << 8))
>>
>> -#else /* i386 */
>> +#else /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
>>
>> /* DWORD network to host byte order conversion for other architectures */
>> #define DN2H(dw) \
>> @@ -44,4 +44,4 @@
>> #define WH2N(w) \
>> (w)
>>
>> -#endif /* i386 */
>> +#endif /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
>>
>> Modified: trunk/reactos/drivers/network/tcpip/include/tcpip.h
>> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/include/tcpip.h?rev=59704&r1=59703&r2=59704&view=diff
>> ==============================================================================
>> --- trunk/reactos/drivers/network/tcpip/include/tcpip.h [iso-8859-1] (original)
>> +++ trunk/reactos/drivers/network/tcpip/include/tcpip.h [iso-8859-1] Mon Aug 12 01:12:25 2013
>> @@ -65,7 +65,7 @@
>> #define NDIS_BUFFER_TAG FOURCC('n','b','u','f')
>> #define NDIS_PACKET_TAG FOURCC('n','p','k','t')
>>
>> -#ifdef i386
>> +#if defined(i386) || defined(_AMD64_) || defined(_ARM_)
>>
>> /* DWORD network to host byte order conversion for i386 */
>> #define DN2H(dw) \
>> @@ -91,7 +91,7 @@
>> ((((w) & 0xFF00) >> 8) | \
>> (((w) & 0x00FF) << 8))
>>
>> -#else /* i386 */
>> +#else /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
>>
>> #error Unsupported architecture
>>
>> @@ -111,7 +111,7 @@
>> #define WH2N(w) \
>> (w)
>>
>> -#endif /* i386 */
>> +#endif /* defined(i386) || defined(_AMD64_) || defined(_ARM_) */
>>
>> /* AF_INET and other things Arty likes to use ;) */
>> #define AF_INET 2
>>
>>
>>
>
> _______________________________________________
> Ros-dev mailing list
> Ros-dev at reactos.org
> http://www.reactos.org/mailman/listinfo/ros-dev
More information about the Ros-dev
mailing list