News:

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

correct usage of ml 10

Started by ToutEnMasm, October 15, 2010, 09:03:30 AM

Previous topic - Next topic

ToutEnMasm


ml 10 need a big number of environnement variables to work well.
without them he can have various internal error ( miss a .const ,cpu instructions...)
Here is a list of this variables.
Quote
VCINSTALLDIR
VSINSTALLDIR
Framework35Version
FrameworkDir
FrameworkDIR32
FrameworkVersion
FrameworkVersion32
PATH

For compilation ML,LINK,LIB,LIBPATH,INCLUDE
In case of doubt,use a batch who call vcvars32.bat (c++ environment) and call ml in it.


japheth

Quote from: ToutEnMasm on October 15, 2010, 09:03:30 AM

ml 10 need a big number of environnement variables to work well.
without them he can have various internal error ( miss a .const ,cpu instructions...)

Please post the details of how to get at least ONE of these internal errors (best is to supply a test case ), so we are able to confirm these claims!


hutch--

Yves,

I just tested ML 10 in a spare installation of masm32 and almost everything worked normally. One test piece had the word ERROR as a variable that I had to rename but the rest worked fine.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

ToutEnMasm


Want a sample ? OK
Macro Assembler Version 10.00.30319.01 (c++ express)
just don't declare those environment variable
Quote
VCINSTALLDIR
VSINSTALLDIR

Now test this and you have in internal error on FXSAVE
Explain is somewhere on MSDN about the new ml provided with visual studio 2010.
Some parts of .NET Framework 4.0 cannot be found without those variables

Quote
.NOLIST         ;signifie: ne rien mettre dans le listing
;------ emplacement des déclarations CreateProcess
   .686
   .xmm
   .model flat, stdcall
   option casemap :none   ; case sensitive

   include translate.inc   ;SDK translate include files (voir mon site)
   include windows.sdk
   include masm32.inc
   ;------- librairie courantes ,identiques masm32rt   
      includelib kernel32.lib
   includelib masm32d.lib
   
   .const
   ZEROLOCALES MACRO dernierelocale:REQ
      mov eax, esp
      mov esp, ebp   ; base page of calling procedure
      @@:
      push 0
      cmp esp, eax
      ja @B   
   ENDM   
   
   .data
      buffer db 20 dup(0)
   align 16
   axsave XSAVE_FORMAT <>
   .code
   start:
   lea eax,axsave
   FXSAVE axsave
   invoke ExitProcess,0
   ;------- proc içi ------------
   

   end start      


ToutEnMasm

a few time later

Ml Option ,no problem if no debug option
Quote
ML /c /coff /Zi /Zd /nologo

Quote
E:\Vide
Assembling: vide.asm

MASM : fatal error A1016: Internal error

  Version 10.00.30319.01

  ExceptionCode            = C0000005
  ExceptionFlags           = 00000000
  ExceptionAddress         = 00424A81 (00400000) "C:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\ml.exe"
  NumberParameters         = 00000002
  ExceptionInformation[ 0] = 00000000
  ExceptionInformation[ 1] = 010F0006

CONTEXT:
  Eax    = 0045343C  Esp    = 0012F644
  Ebx    = 0012F7F0  Ebp    = 0012F984
  Ecx    = 00B03BD5  Esi    = 010F0006
  Edx    = 00000001  Edi    = 0012F660
  Eip    = 00424A81  EFlags = 00010206
  SegCs  = 0000001B  SegDs  = 00000023
  SegSs  = 00000023  SegEs  = 00000023
  SegFs  = 0000003B  SegGs  = 00000000
  Dr0    = 00000000  Dr3    = 00000000
  Dr1    = 00000000  Dr6    = 00000000
  Dr2    = 00000000  Dr7    = 00000000


????????????????????????????????????????????????


ToutEnMasm


there is also the fact to add an empy proc(not called) after exitprocess who solve the problem
Quote
;################################################################
rien PROC
         Local  retour:DWORD
         mov retour,1

Finderien:
         mov eax,retour
         ret
rien endp

;################################################################

japheth

I cannot reproduce the problem.

However, I have to admit that I didn't download the include files which your sample needs. Instead I included the XSAVE_FORMAT structure manually:



.NOLIST         ;signifie: ne rien mettre dans le listing
;------ emplacement des déclarations CreateProcess
   .686
   .xmm
   .model flat, stdcall
   option casemap :none   ; case sensitive

;   include translate.inc   ;SDK translate include files (voir mon site)
;   include windows.sdk
;   include masm32.inc
   ;------- librairie courantes ,identiques masm32rt   
   includelib kernel32.lib
   includelib masm32d.lib

XSAVE_FORMAT struct
ControlWord          dw ?
StatusWord           dw ?
TagWord              db ?
Reserved1            db ?
ErrorOpcode          dw ?
ErrorOffset          dd ?
ErrorSelector        dw ?
Reserved2            dw ?
DataOffset           dd ?
DataSelector         dw ?
Reserved3            dw ?
MxCsr                dd ?
MxCsr_Mask           dd ?
FloatRegisters       oword 8 dup (?)
XmmRegisters         oword 8 dup (?)
Reserved4            db 192 dup (?)
StackControl         dd 7 dup (?)
Cr0NpxState          dd ?
XSAVE_FORMAT ends

ExitProcess proto stdcall :dword

   .const
   ZEROLOCALES MACRO dernierelocale:REQ
      mov eax, esp
      mov esp, ebp   ; base page of calling procedure
      @@:
      push 0
      cmp esp, eax
      ja @B   
   ENDM   
   
   .data
      buffer db 20 dup(0)
   align 16
   axsave XSAVE_FORMAT <>
   .code
   start:
   lea eax,axsave
   FXSAVE axsave
   invoke ExitProcess,0
   ;------- proc içi ------------
   

   end start


I tried with and without -Zi switch, no differenc, both without errors or crashs

ToutEnMasm


I know that . your test is of no use
the files are downloadable in the windows.inc project board
Without those files the compiler have less need

japheth

Quote from: ToutEnMasm on October 15, 2010, 05:35:16 PM
I know that . your test is of no use
the files are downloadable in the windows.inc project board
Without those files the compiler have less need

Ok, but this is probably too much work then. We may get a crash then, but getting a crash after feeding the assembler with several MBs of source will not get us much closer to the cause of the problem.

Perhaps if you post your definition of XSAVE_FORMAT in this thread, one might get an idea what Masm v10 doesn't like?

ToutEnMasm


There is nothing else to search than a bug of ml
6.14 6.15 works
I repeat
There is just to add a empty proc to make it work
I have verify this with a debugger

japheth

Quote from: ToutEnMasm on October 15, 2010, 06:30:07 PM

There is nothing else to search than a bug of ml
6.14 6.15 works
I repeat
There is just to add a empty proc to make it work
I have verify this with a debugger

Ok.

I wasn't interested in finding a workaround to avoid the crash. I was interested to find the reason for the crash. But never mind. I won't bother you again.