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

daydreamer

agner fogs cpuid testprogram reports modelspecific register on mine and it it doesnt protest when running SSE2, which confuses me
undocumented that xtra regs are also on newer athlon XP's?
so how do I do casecode for check my code is running on amd64?


MichaelW

I believe the information you need is in the AMD64 Architecture Programmer's Manual, Volume 1: Application Programming and Volume 2: System Programming, available here. And you can get CPUID-related utilities and code samples here.
eschew obfuscation

Bieb

Hmm, documentation on this whole matter seems to be pretty scarce.  Perhaps the big CPU companies are trying to push people more toward HLLs?

Is Microsoft likely to update MASM?  When was the last time there was a major update to MASM itself?  Looks like we're in for a big CPU architecture war.  Are there versions of Windows for both Intel's and AMD's hardware now?

Phoenix

I think there will not be different softwares for Intel- or AMD-based systems as long we are talking about Athlon64 or Intel EM64T. They seem to be compatible, and WindowsXP x64 is designed to work with both processors.

Visual Studio 2005 beta 1 supports 64-bit programming. There are two versions of ml64 included, one of them works in 32-bit-OS, the other one only in 64-bit-OS. Both of them have the same name and version number, the only difference one can see is the filesize. I was able to create an 64bit-obj-file, but i did not get link.exe to work... There also seem to be major changes on Microsoft's Macro Assembler for x64 systems. ML64.exe is still beta, I've tried V8.0.40607.16 (beta 1.04607-1600), with Microsoft® Incremental Linker (beta1.040607-1600) using mspdb80.dll.

Some information about ml64 and Win64 assembler programs:


http://www.codegurus.be/codegurus/Programming/assembler&win64_en.htm

http://www.codegurus.be/codegurus/Programming/riprelativeaddressing_en.htm

Bieb

So basically, so far, the differences are that parameters are passed in registers and [?]direct adressing isn't supported[/?]
Is the invoke macro part of ML.exe or just the MAM32 package?  If it's not directly supported by MASM, a new version of that macro might be difficult to create with registers being used the way they are.

Phoenix

#20
Quotethe differences are that parameters are passed in registers and direct adressing isn't supported?

As the documentation is very small for ml64 within VS 2005 beta - and i am not able to link - it is not possible for me to try it.

From Microsoft Macro Assembler Reference (VS 2005 beta):
 
QuoteINVOKE

Calls the procedure at the address given by expression, passing the arguments on the stack or in registers according to the standard calling conventions of the language type.

INVOKE expression [[,arguments]]

Remarks

Each argument passed to the procedure may be an expression, a register pair, or an address expression (an expression preceded by ADDR).

ml64 is still beta release and there is still no complete reference at this point (as far as i know).

manhattan

What errors do you have when you link ? I had errors too because the linker was using 32-bit libraries. Did you add the path to the 64-bit libraries in the list of directories used by the linker ? The order is important. The 64-bit directories must be the first in the list.

I don't know if it will change in the final release but ml64 beta doesn't support ASSUME,  PROC, INVOKE or conditionnal statements (.IF, .WHILE, ...)

Phoenix

Quote from: manhattan on January 09, 2005, 07:59:02 PM
What errors do you have when you link ? I had errors too because the linker was using 32-bit libraries. Did you add the path to the 64-bit libraries in the list of directories used by the linker ? The order is important. The 64-bit directories must be the first in the list.

manhattan, this is what i tried:

First, i copied the required(?) files to one directory:

Quote09.01.2005  22:31    <DIR>          .
09.01.2005  22:31    <DIR>          ..
09.01.2005  14:48               416 hello64.asm
08.01.2005  20:18               594 hello64.obj
23.03.2004  13:24           182.694 Kernel32.Lib
24.06.2004  22:55           767.488 link.exe
10.06.2004  16:54               268 link.exe.config
08.01.2005  20:16                22 make.bat
08.01.2005  14:40                89 makeit.bat
08.01.2005  20:17                95 makeit1.bat
24.06.2004  22:35           556.544 ml64.exe
24.06.2004  22:55           245.760 mspdb80.dll
25.06.2004  06:26           773.120 msvcr80.dll
23.03.2004  13:25           132.280 User32.Lib

When executing makit.bat, the result is:

QuoteC:\64>ml64 hello64.asm /link /subsystem:windows /defaultlib:kernel32.lib /defaultlib:user32.lib
Microsoft (R) Macro Assembler (x64) Version 8.00.40607.16
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: hello64.asm
MASM : fatal error A1020: cannot find LINK.EXE

Or just calling link.exe returns...

QuoteC:\64>link
The system cannot execute the specified program.

Seems that this way does not work although all files are in one directory? Hm, perhaps the problem is that i did install VS from W2K, but i try it from XP 64 where no VS is installed? (same machine, dual-boot)

Quote from: manhattan on January 09, 2005, 07:59:02 PM
I don't know if it will change in the final release but ml64 beta doesn't support ASSUME,  PROC, INVOKE or conditionnal statements (.IF, .WHILE, ...)

This are bad news... ::)

chetnik

Quote from: John on January 03, 2005, 03:45:37 PM
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?

Yap, I've noticed it too, AMD manual says that there are rax, rbx,rcx,rdx
and Intell has r0-r127... I'm really confused  :( :(
Does it mean that everybody will ship their programmes for 64 in two version (AMD64 and IA64)?

hutch--

I think you can safely say that the Itanium is a dead duck so IA64 is on its way out. It appears that Intel will follow AMD with x86 64 bit hardware sooner or later and if I understand the licencing between the two of them over the x86 instruction set, the Intel version will be similar to the AMD in terms of instructions.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Bieb

Wow.  After all these years, Intel may finally fall from it's position as the foremost CPU builder.

chetnik

I like EliCZ description of x86-amd64-ia64 and C at his board :

Quote
If you speak Dutch(x86 asm) then it easier to learn German(amd64 asm) than Russian(ia64 asm). But the best is to know English(C).

=))))

MazeGen

Quote from: drhowarddrfine on January 01, 2005, 10:18:52 PM
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.
AFAIK Intel provides only IAS, "IA-64 Assembler":
QuoteIAS is a cross-platform assembler; it runs on 32-bit host machines and produces IA-64
object files. IAS does not assemble IA-32 assembly language programs.
I downloaded the full package (manuals and the source code) from one site which is now denied, I don't know why...

MazeGen

News:
IAS means Itanium ASsembler.

I just found that IAS 6.0 is a part of Visual Studio 2005 beta:

for IA-32 platform:
...\Microsoft Visual Studio 8\VC\bin\x86_ia64\ias.exe

for Itanium platform:
...\Microsoft Visual Studio 8\VC\bin\ia64\ias.exe

nasm64developer

> 23.03.2004  13:24           182.694 Kernel32.Lib
> 24.06.2004  22:55           767.488 link.exe
> 10.06.2004  16:54               268 link.exe.config
> 24.06.2004  22:35           556.544 ml64.exe
> 24.06.2004  22:55           245.760 mspdb80.dll
> 25.06.2004  06:26           773.120 msvcr80.dll
> 23.03.2004  13:25           132.280 User32.Lib
>
> [...] i did install VS from W2K [...]

I just installed the VS 2005 Beta on a W2K machine, and I can't
seem to find the above files. Do you happen to know which sub
directory they came from? Or did you install from a XP64 system?

Odd.