News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

AMD 64-bit assembly?

Started by Phoenix, January 01, 2005, 06:11:19 PM

Previous topic - Next topic

Phoenix

Hope this is the right place for this post...

There were a lot of problems with my old PC so i decided to build a new one using Athlon64-CPU. I also installed WindowsXP x64 OS and this is working properly.

A look at the white-papers of AMD told me, that the architecture of the Athlon64-CPU is very interesting. The registers are not only expanded towards 64 bit, they added 8 (!) new registers in both CPU and FPU. These registers can only be used if the CPU is switched to 64bit-mode, so we need a 64bit OS.

I know that i am an absolute beginner, but i'm interested how to do assembly in 64bit-mode. So, can anyone tell me if there is something aviable to test it? Neither the search in google nor the search on AMD or Microsoft were successful.

Regards, Phoenix

manhattan

It's not easy to install and configure, but Visual Studio 2005 beta 1 supports 64-bit programming. I use it to port my JPEG decoder to 64-bit. I repost the link to order it on DVD. It's really a great IDE.

http://lab.msdn.microsoft.com/vs2005/get/order/default.aspx

Refresh Tools :
http://www.microsoft.com/downloads/details.aspx?FamilyID=afd04ff1-9d16-439a-9a5e-e13eb0341923&displaylang=en

Phoenix

Quote from: manhattan on January 01, 2005, 07:28:26 PM
I repost the link to order it on DVD. It's really a great IDE.

manhattan,

thank you for your help, I've ordered the DVD and give it a try...  but is there something aviable like masm32 for 64-bit (may be masm64?   :lol)

drhowarddrfine

Do a search on Intel's site.  They have a 64-bit assembler BUT it's written in C and must be compiled AND, iirc, it only runs on linux.

drhowarddrfine

From MSDN:

Working with Assembly Code
Assembly code is straightforward to port to AMD64 and 64-bit Windows—and is worth the effort for performance reasons. For example, you can take advantage of the new 64-bit general-purpose registers (r8-r15), and new floating point and 128-bit SSE/SSE2/floating point registers (xmm8-xmm15). However, there are new 64-bit stack frames and calling conventions you should learn about in the ABI (application binary interface) specifications.

The AMD64 Software Conventions document (also known as the AMD64 ABI Specification) is in the beta version of the Microsoft Windows Server™ 2003 Service Pack 1 DDK. You should download and install the Windows DDK and the Microsoft Platform SDK for AMD64 to have access to those ABIs and the documentation.

NOTE: In-line assembly code is not supported with the Microsoft C/C++ compiler and libraries so you have to put the assembly code into a separate MASM file. Compiler intrinsic functions are an alternative to assembly code, and are provided to implement most SSE and SSE2 instructions, in a manner that compiles seamlessly for both 32-bit and 64-bit targets.

Phoenix

Quote from: drhowarddrfine on January 01, 2005, 10:37:52 PM


NOTE: In-line assembly code is not supported with the Microsoft C/C++ compiler and libraries so you have to put the assembly code into a separate MASM file.

Does this mean that 64bit assembly is supported by masm??

daydreamer

Well I gonna make a emu64.inc files for starters, but it means I am interested in how I detect my code is running on a 64bit, or I have to emulate, my extra regs with local memory variables named XMM8-XMM15 and MMX8-MMX15 and st8-st15 if casecode fails???

hutch--

Just from memory there are versions of NASM and YASM that will build 64 bit AMD x86 code.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php


John

This is similar to a question I wanted to discuss as well.

If I remember what I read, AMD and Intel are headed in different directions with the 64 bit movement. Their 64 bit instruction sets are not compatible with each other. AMD is expanding on the x86 instruction set and Intel has developed a new one they call IA64.

Where are we headed as ASM programmers in the 64 bit future? Won't we need to make two different versions of our applications, one for each processor? Will there ever be an MASM64?

MichaelW

Intel has developed Intel Extended Memory 64 Technology (EM64T) for the IA-32 processors, available now:

http://developer.intel.com/products/desktop/processors/pentium4/index.htm

I could find no reference to x86-64, but I was under impression that EM64T is at least mostly compatible with x86-64. You can find more information and links to the Software Developer Guides here:

http://developer.intel.com/technology/64bitextensions/

eschew obfuscation

Phoenix

Quote from: John on January 03, 2005, 03:45:37 PM

If I remember what I read, AMD and Intel are headed in different directions with the 64 bit movement. Their 64 bit instruction sets are not compatible with each other. AMD is expanding on the x86 instruction set and Intel has developed a new one they call IA64.

From: http://www.winsupersite.com/showcase/windowsxp_x64_preview.asp

QuoteOn April 9, 2003, Microsoft officially announced that it would support AMD's then-upcoming 64-bit Opteron and Athlon 64 microprocessors with 64-bit native versions of Windows XP and Windows Server 2003. The news must have sent shivers down the spines of executives at Microsoft partner Intel, whose 64-bit Itanium product line has languished because of slow performance and incompatibilities with today's existing 32-bit software. For AMD, of course, it was--and still is--a major victory. Not only was the one time microprocessor also-suddenly getting equal press from Microsoft as Intel, within a year, Intel shocked the world by announcing that it would essentially ape AMD's designs and create 64-bit versions of the Xeon and Pentium 4 CPUs that would be code compatible. The follower had suddenly become the leader.

The Intel IA64-architecture seems to be dead - so i think we have to learn about Athlon64 instruction set?  :eek


MichaelW

Quote from: Phoenix on January 03, 2005, 08:23:15 PMThe Intel IA64-architecture seems to be dead - so i think we have to learn about Athlon64 instruction set?  :eek
The IA-64 processors compete in a completely different arena than the x86-64/EM64T processors. IA-64 is no where close to dead, and I would not be surprised to see it eventually dominate its target market, considering the *immense* resources of Intel and their *proven* capability.

eschew obfuscation

Phoenix

QuoteIA-64 is no where close to dead, and I would not be surprised to see it eventually dominate its target market

MichaelW - you are of course right - i should have said "seems to be dead for the 'mass market' (?) and was never designed for it."

If Microsoft really releases WinXP x64 in the first half of this year, I think there will be a big interest for 64bit-software based on Athlon64 or EM64T, though 32bit applications should work on this OS as well. A lot of drivers are currently avaiable for XP x64 (most of them as beta-releases), and applications will follow. And that's why I'm interested to learn about 64-bit programming.

( :red that was difficult - had to look up my dictionary a lot of times....)

dev_zero

There is an introduction to x86-64 assembly on this page: http://www.x86-64.org/documentation
Even though it's in gas syntax you should understand it, it isn't so hard to understand..
QuoteThis document is meant to summarise differences between x86-64 and i386 assembly assuming that you already know well the i386 gas syntax. I will try to keep this document up to date until official documentation is available.