views:

18

answers:

4

I'm responsible for some application level code that I inherited that has some x86... Intel assembly code based on 32 bit instructions and addressing. I going to make the assumption this 32 bit assembly code will run when we migrate a 64 bit windows OS. Yes?

A: 

More than likely, it will run; 64-bit Windows supports 32-bit mode for applications and it's generally very reliable. (Obviously these things are never 100%, though - caveat emptor.)

A: 

Yes. 32-bit code will run on 64-bit machines, but they won't be able to access more than 4 GiB of RAM.

Hello71
+2  A: 

It will probably run, but it won't take advantage of any of the features the 64-bit extensions to x86 asm provide (x86-64, which is what all "64-bit" versions of Windows are) or be able to tightly interop with x64 libraries. The WoW64 layer is very stable and 99.999% of 32-bit apps run fine on current "64-bit" OSes.

If you want to migrate to a true 64-bit operating system (the only ones I know of are Itanium-based, ia64), you're out of luck.

Edit: Also, if you want to enable large-address access (able to use >4gb of RAM), there's a PE header flag you can flip that will turn that on and allow it to address larger amounts of memory.

peachykeen
Fantastic! Many Thanks! I'm new here (but have a good standing on SO) wish I had a good enough reputation here so I could give a vote up.
ddm
Same. I'm not worried about rep so voting doesn't matter, but if I answered it for you, you might want to accept just so folks know. :)
peachykeen
Ok will accept, but it's not obvious how to do that (at least to me). Send FAQ link :-)
ddm
OK never mind I found the BIG check mark.
ddm
I'll upvote this - you bothered to be more technical than I did. :)
A: 

It will run if you continue to build 32-bit x86 applications, yet. However if you have to port the code to 64-bit x86, chances are that the assembly code won't run (and might not even compile) out of the box.

And depending on your tool chain and if it's inline assembler in C/C++ code or not, you might not even be able to compile it at all.

Timo Geusch
Could you elaborate? Not even compile? It's embedded C++ code.
ddm
From memory - at least with the MS compiler, inline assembler will simply not compile on the 64-bit toolchain as the compiler doesn't support `__asm`. I don't know if other compilers like GCC suffer from this problem as well.
Timo Geusch
We are using VS - probably 2010 by the time the code transfer takes place. I am so not looking forward to re-writing assy code, not impossible for me, but not a task I signed up for.
ddm
I haven't got my hands on VS2010 yet, but from this page http://msdn.microsoft.com/en-us/library/hb5z4sxd.aspx it looks like you're up the creek - no inline asm on 64 bit, although you can still use MASM for larger chunks.
Timo Geusch