Sign In
MSDN Blogs
Microsoft Blog Images
More ...
ML64 bug to watch out for
Common Tasks
Blog Home
Email Blog Author
RSS for comments
RSS for posts
Search
Advanced search options...
Search In:
Everything
Blogs
Forums
People
Groups
Places
Pages
Date range:
All Time
Last Year
Last 6 Months
Last 3 Months
Last Month
Last Week
Last Two Days
Tags
Bugs
Developer Info
X64 ABI Info
Archives
Archives
February 2009
(1)
June 2008
(1)
April 2008
(1)
February 2008
(1)
September 2007
(1)
June 2007
(2)
March 2007
(2)
December 2006
(1)
October 2006
(2)
September 2006
(1)
July 2006
(2)
May 2006
(1)
April 2006
(2)
March 2006
(2)
January 2006
(3)
December 2005
(1)
November 2005
(1)
October 2005
(1)
September 2005
(2)
July 2005
(3)
June 2005
(1)
March 2005
(2)
January 2005
(1)
November 2004
(3)
MSDN Blogs
>
FreiK's WebLog
>
ML64 bug to watch out for
ML64 bug to watch out for
Kevin Frei
20 Jul 2006 4:45 PM
Comments
0
If you're porting your application to x64, and you use much in the way of __asm in your x86 code, you're likely to start looking at ml64 - the 64 bit version of Masm. The reason you're likely to do this is that the x64 compiler doesn't support __asm blocks in C code. So you can either use the compiler intrinsic functions [and there are a lot of 'em, and they're all documented relatively well], or you have to use ml64. For folks that aren't new to Masm, you're also likely to try to use some of the nifty little time-saver features of Masm to automatically generate prologue's and epilogues for your functions. For ML64, DO NOT DO THIS!
Here's an example:
.DATA
.CODE
testfunc PROC uses rbx
xor rbx, rbx
ret
testfunc ENDP
END
There are 2 problems with the code that ML64 generates. #1: There is no .xdata of any sort. No unwind directives are emitted, despite the fact that you're allocating stack, and saving a nonvolatile register. #2: The epilogue is invalid - it uses the 'leave' instruction, which is ineffecient, but also just plain illegal in an x64 function epilogue. The stack unwind routines will not properly recognize the instruction sequence as an epilogue, so the debugger and the EH routines will all fail [the EH routines will just terminate your process if an exception occurs while testfunc is on the stack].
BTW - Here's the
link
to the customer bug. It came in about 3 months too soon for serious consideration for VC8, so we punted it to the next version, but now it's pushed out until we get some more resources for investment in MASM.
0 Comments
Bugs
Leave a Comment
Name
Comment
Please add 5 and 5 and type the answer here:
Post