<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sub="http://schemas.microsoft.com/sharepoint/soap/2002/1/alerts/" xmlns:ec="http://www.w3.org/2001/04/xmlenc#" xmlns:sp="http://schemas.microsoft.com/sharepoint/" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:Z="urn:schemas-microsoft-com:" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>RE: [ofw] WDK build environment migration thoughts</title>
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The blog you reference actually recommends PtrToPtr64 as the
solution.  For 32-bit platforms, it does a cast to ULONG_PTR, then a cast
to unsigned __int64, so I don’t see how that would give the wrong
value.  Can you clarify?<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks,<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>-Fab<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
ofw-bounces@lists.openfabrics.org [mailto:ofw-bounces@lists.openfabrics.org] <b>On
Behalf Of </b>Tzachi Dar<br>
<b>Sent:</b> Wednesday, April 30, 2008 1:51 PM<br>
<b>To:</b> Alex Estrin; Fab Tillier; Alex Naslednikov; Smith, Stan; Ishai
Rabinovitz<br>
<b>Cc:</b> ofw@lists.openfabrics.org<br>
<b>Subject:</b> RE: [ofw] WDK build environment migration thoughts<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<div>

<p class=MsoNormal> <o:p></o:p></p>

</div>

<blockquote style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt;
margin-left:3.75pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>

<p class=MsoNormal><o:p> </o:p></p>

<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> ofw-bounces@lists.openfabrics.org
[mailto:ofw-bounces@lists.openfabrics.org] <b>On Behalf Of </b>Alex Estrin<br>
<b>Sent:</b> Wednesday, April 30, 2008 10:40 PM<br>
<b>To:</b> Fab Tillier; Alex Naslednikov; Smith, Stan; Ishai Rabinovitz<br>
<b>Cc:</b> ofw@lists.openfabrics.org<br>
<b>Subject:</b> RE: [ofw] WDK build environment migration thoughts</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Couple more questions regarding the patch:</span><o:p></o:p></p>

<p class=MsoNormal> <o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>1. Why 4 different definitions to replace the same
__ptr64? Seem confusing, not mentioning macro TO_LONG_PTR broke
"IntelliSence" feature in VS. </span><o:p></o:p></p>

<p class=MsoNormal> <o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:red'>3 of them are actually defined as nothing and are actually just
comments. We will be able to delete them once we fill all issues are solved.
The TO_LONG_PTR() macro can be replaced, but this will break things on Itanium
(If there is a real need to support Itanium on 32/64 applications).</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'> </span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>2. Still not clear why using PtrToPtr64 was not
appropriate?</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:red'> In one sentence  PtrToPtr64  simply doesn't
work. If your pointer is big enough it will be converted to a wrong value.
See also <a
href="http://blogs.msdn.com/texblog/archive/2005/10/31/487436.aspx">http://blogs.msdn.com/texblog/archive/2005/10/31/487436.aspx</a></span><o:p></o:p></p>

<p class=MsoNormal> <o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>I would also suggest to move *_PTR64 definitions
from ib_types.h  to cl_types_osd.h, where it belong.</span><o:p></o:p></p>

<p class=MsoNormal> <o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Thanks,</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:blue'>Alex</span><o:p></o:p></p>

<blockquote style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt;
margin-left:3.75pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt'>

<p class=MsoNormal><o:p> </o:p></p>

<div class=MsoNormal align=center style='text-align:center'>

<hr size=2 width="100%" align=center>

</div>

<p class=MsoNormal style='margin-bottom:12.0pt'><b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> ofw-bounces@lists.openfabrics.org
[mailto:ofw-bounces@lists.openfabrics.org] <b>On Behalf Of </b>Fab Tillier<br>
<b>Sent:</b> Wednesday, April 30, 2008 3:20 PM<br>
<b>To:</b> Alex Naslednikov; Smith, Stan; Ishai Rabinovitz<br>
<b>Cc:</b> ofw@lists.openfabrics.org<br>
<b>Subject:</b> RE: [ofw] WDK build environment migration thoughts</span><o:p></o:p></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Yikes!  You disable warning C4305 for everyone including
ib_types.h?  Do you really think this is appropriate???<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The more I look at the patch, the more I think it should be
rolled back, sorry.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>-Fab<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> ofw-bounces@lists.openfabrics.org
[mailto:ofw-bounces@lists.openfabrics.org] <b>On Behalf Of </b>Alex Naslednikov<br>
<b>Sent:</b> Wednesday, April 30, 2008 1:20 AM<br>
<b>To:</b> Alex Naslednikov; Smith, Stan; Ishai Rabinovitz<br>
<b>Cc:</b> ofw@lists.openfabrics.org<br>
<b>Subject:</b> RE: [ofw] WDK build environment migration thoughts<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p> </o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>Hello,</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>I
committed our WDK and __ptr64 patch into WinOF trunk, and WinOF and WinIB
trunks were synchronized again.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>You
can find below some further explanations :</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>1.
IBAL compiles now with WDK6001.18001. According to Microsoft, it should be the
last and official release.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>We
preserved the backward compatibility with DDK, but some intermediate versions
of WDK may be incompatible</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>2.
Please, be aware that one has to change WinOF modules that aren't in WinIB
stack (like additional ulps : udapl, vnic etc.) according to new methodology</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>Also,
I'd like to point your attention, that these modules will work as is on
homogeneous systems (x86, x64), but not on mixed systems (x86 application on
x64 kernel)</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>In
addition, Microsoft fixed an internal compiler bug when compiling modules with
long (__ptr64) pointers on functions (occurred only in x86 CHECKED
environment).</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>So,
you should not have problem with compilation after adjusting makefiles</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>3.
This revision contains:</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'> 3.1.
All bugfixes from WinOF trunk, from rev. 939 to 1067</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'> 3.2.
Mellanox __ptr64 solution and WDK poring, starting from rev. 2164</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'> 3.3.
All bugfixes and patches from connectx branches (both Mellanox and WinOF)</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>It
was a large amount of code to be merged from 4 different svn trees (trunk and
connectx branch in WinOF, and trunk and connectx branch in WinIB).</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>We
will appreciate your code review, just to be sure that we didn't forget to
insert any minor patch or bug fix.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>4.
I carefully tested new trunk inside Mellanox, on different platforms, both with
DDK and WDK compilers. Please, update us about every minor problem during your
testing.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:blue'>Thanks,</span><o:p></o:p></p>

<p><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Naslednikov
Alexander (a.k.a XaleX)</span></b><o:p></o:p></p>

<p><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Windows
Team</span></b><o:p></o:p></p>

<p><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Mellanox
Technologies </span></b><o:p></o:p></p>

<p><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>_____________________________________________
</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>From:
 </span></b> <span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Alex
Naslednikov  </span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Sent:  </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Monday, April
21, 2008 7:15 PM</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>To:    </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Alex
Naslednikov; 'Smith, Stan'; Ishai Rabinovitz</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Cc:    </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>'ofw@lists.openfabrics.org'</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Subject:       </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>RE: [ofw] WDK
build environment migration thoughts</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hi all,<br>
I would like to repost my previous message, because I haven't received yet your
comments.<br>
Our regression seems to be stable, so we are going to commit the change into
WinOF trunk the nearest time.<br>
For you convenience, I also provide some typical changes as a patch (attached
to this mail). Please, read the explanation below before - it will help you a
lot.<br>
Be aware that all the modules not contained in Mellanox WinIB stack (like
udapl, vnic) should be also changed according to this methodology.<br>
<br>
It is very large change, so I'll appreciate your time and effort while
reviewing the methodology and the patch itself.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thanks,<br>
</span><br>
<b>Naslednikov Alexander (a.k.a XaleX)<br>
Windows Team<br>
Mellanox Technologies</b><o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>_____________________________________________
</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>From:
 </span></b> <span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Alex
Naslednikov  </span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Sent:  </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Thursday, April
10, 2008 4:09 PM</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>To:    </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>'Smith, Stan';
Ishai Rabinovitz</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Cc:    </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>ofw@lists.openfabrics.org</span><o:p></o:p></p>

<p><b><span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>Subject:       </span></b>
<span style='font-size:7.5pt;font-family:"Tahoma","sans-serif"'>RE: [ofw] WDK
build environment migration thoughts</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hi all,</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>It's a good
idea to clarify some points before announcing Mellanox patch for WDK porting
and __ptr64 problems.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hope, these
explanations will be informative enough and not so long.</span><o:p></o:p></p>

<p><b><u><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>1.
__ptr64 problem</span></u></b><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Briefly
speaking, this problem arises when copying 32bit len pointer into 64bit len
pointer. In this case,</span><u> </u><u><span style='font-size:10.0pt;
font-family:"Arial","sans-serif"'>signed pointer extension</span></u> <span
style='font-size:10.0pt;font-family:"Arial","sans-serif"'>will take place.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>How it's
applicable to WinOF ?  A lot of pointer were declared to be __ptr64 (i.e.,
to be always "long", even in 32bit kernel systems), that's to
preserve on unique size of structs used in IOCTL calls.  The main problem
it will cause is between 32bit user applications and 64bit kernel application.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>When user
code do operation like </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>s_ptr =
&my_struct;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>my_type*
__ptr64 ptr = s_ptr;</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Than kernel
will receive ptr with invalid upper bits data (4 bytes FF).</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>To avoid
signed pointer extension, PtrToPtr64() function should be used.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Also, I
found some other places where dangerous signed pointer extension took place,
even on 32bit kernel.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Yet another
problem that arises with __ptr64 attribute is internal compiler error
(C1001)  in WDK when using __ptr64 pointer to function (callback)</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>This problem
was described in ofw discussion, you can see also :</span><o:p></o:p></p>

<p><a href="http://blogs.msdn.com/texblog/archive/2005/10/31/487436.aspx"><span
style='font-size:10.0pt;font-family:"Arial","sans-serif"'>http://blogs.msdn.com/texblog/archive/2005/10/31/487436.aspx</span></a><o:p></o:p></p>

<p><a href="http://lists.openfabrics.org/pipermail/ofw/2007-July/001613.html"><span
style='font-size:10.0pt;font-family:"Arial","sans-serif"'>http://lists.openfabrics.org/pipermail/ofw/2007-July/001613.html</span></a><span
style='font-size:10.0pt;font-family:"Arial","sans-serif"'> (posted by Jan from
OFW)</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Our
solution:</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>1. Initially,
we decided to remove all __ptr64 attributes except those ones inside IOCTL
structures. After, put PtrToPtr64() conversion on every assignment to long
pointer.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>(like
my_type* __ptr64 ptr = PtrToPtr64(s_ptr);  )</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>During this
solution, we changed a huge amount of code, so patch became unreadable. And it
was difficult to validate that all long pointer (with __ptr64 attribute) were
used in a proper manner</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>2. So, we
decided about another solution:</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> All
__ptr64 occurrences were replaced by either:</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> i) TO_LONG_PTR(type,
field) macro, when occurred inside structure</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>ii)
VOID_PTR64 macro otherwise (defined as void macro)</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>#define
CONCAT(str1, str2) str1##str2</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>#define
TO_LONG_PTR(type,member_name) \</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>   
union { type member_name;  uint64_t CONCAT(member_name,_padding) ; }</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thus, we can
both preserve on a uniform shapes of structs in user and kernel and to avoid
unsafe pointer arithmetic !</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>The patch
now is much more readable, but it sill consist of thousands lines.</span><o:p></o:p></p>

<p><b><u><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>2.
Migration to WDK</span></u></b><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Main issue
here was to preserve on backward compatibility with DDK</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>We were able
to compile our stack with WDK, while the main problems we found were :</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>1. WDK uses
newer version of SDK (SDK Vista). So, when using 2 or more versions of SDK on
the same build machine, one has to update </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>PLATFORM_SDK_PATH
variable to point on the proper version of SDK (for example,
PLATFORM_SDK_PATH=%sysdrive%:\PROGRA~1\MI2578~1\windows\v6.1)</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>2.verify.src
script in WDK (new add-on) checks if your SOURCES file is in appropriate
format.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>For example,
you can't set implicitly path to system .dll in TARGETLIBS, but to use
USE_<MODULE_NAME> =1 macro</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Example:</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Old code : </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> ....</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>TARGETLIBS=
\</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  
$(CRT_LIB_PATH)\msvcprt.lib\</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  
$(SDK_LIB_PATH)\Ws2_32.lib\</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  
$(TARGETPATH)\*\mtcr.lib</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>New code :</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>USE_MSVCRT=1</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>USE_NTDLL=1</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>TARGETLIBS=
\</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  
$(SDK_LIB_PATH)\Ws2_32.lib\</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  
$(TARGETPATH)\*\mtcr.lib</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>3. Some
other problems, like mulitple includes error in .rc files, or problem with
substituing more than one symbol constant into string in Makefiles (some
version of WDK)</span><o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Currently,
we continue testing and will advertise these patches right after the testing
will finish</span><o:p></o:p></p>

<p><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Naslednikov
Alexander (a.k.a XaleX)</span></b><o:p></o:p></p>

<p><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Windows
Team</span></b><o:p></o:p></p>

<p><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Mellanox
Technologies</span></b> <o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>-----Original
Message-----</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>From:
ofw-bounces@lists.openfabrics.org [</span><a
href="mailto:ofw-bounces@lists.openfabrics.org"><span style='font-size:10.0pt;
font-family:"Arial","sans-serif"'>mailto:ofw-bounces@lists.openfabrics.org</span></a><span
style='font-size:10.0pt;font-family:"Arial","sans-serif"'>] On Behalf Of Smith,
Stan</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Sent:
Tuesday, April 08, 2008 4:10 PM</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>To: Ishai
Rabinovitz</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Cc:
ofw@lists.openfabrics.org</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Subject:
[ofw] WDK build environment migration thoughts</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Hello,</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  I
strongly believe it would help the WinOF community in transitioning to the WDK
build environment if the connectX branch</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>(svn:gen1\branches\ConnectX)
was used as a WDK build environment staging grounds prior to merging the WDK
modifications into the mainline trunk.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>This has
been talked about before although it still (as of last Friday) does not build
using the latest WDK version.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'> </span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>One week
prior to merging the WDK fixes into the mainline trunk, if you were to push all
the WDK fixes into the ConnectX branch and then advertise on the ofw mailing
list the availability of a WDK build branch along with</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  1)
how to build in the WDK environment,</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>    
which version of the WDK is required + a URL link where to get the WDK.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  2) An
explanation of why and how the __ptr64 attributes were removed along with how</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>    
others should correct their codes containing __ptr64 attributes.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>  3)
updates to the WinOF wiki page describing how to build in the WDK env.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Let this branch
exist for one week, receiving feedback from the list and then merge into the
mainline trunk.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Using this
approach is certainly community friendly and may prevent developer surprises.</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>ConnectX
branch availability dates plus when the actual WDK fixes would be merged into
the mainline trunk would be published beforehand.</span><o:p></o:p></p>

<p class=MsoNormal><o:p> </o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Thanks for
your consideration,</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>Stan.</span><o:p></o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>_______________________________________________</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>ofw mailing
list</span><o:p></o:p></p>

<p><span style='font-size:10.0pt;font-family:"Arial","sans-serif"'>ofw@lists.openfabrics.org</span><o:p></o:p></p>

<p><a href="http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw"><span
style='font-size:10.0pt;font-family:"Arial","sans-serif"'>http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw</span></a><o:p></o:p></p>

</blockquote>

</blockquote>

</div>

</body>

</html>