This is the list of bugs I have found so far. The most important (i.e. require too much creative alternative) is the impossibility to write to the .data section either from 32-bit or from 64-bit (I thought it was only 64-bit but is from both).
OPTION FLAT:1
; Some features of LITERALS:ON do not work with FLAT:1, See examples at the bottom
OPTION LITERALS:ON
USE32 ; USE32 is required to be here, otherwise the stack will be incorrectly restored after INVOKE printf
includelib \masm32\lib\msvcrt.lib
printf proto C :ptr,:vararg
.data
msg db "Received: 0x%.8x%.8x",10,0
somevalue dd 0 ; Can't write to .data either from 32-bit or 64-bit. And if we don't initialize values it believes it is a BSS segment
; Default Prologue and Epilogue do not work properly.
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE
X64_Start macro
USE32
push 33h
call @F
@@:
add dword ptr [esp], @F-$
retf
@@:
USE64
endm
X64_End MACRO
USE64
call @F
@@:
mov dword ptr [rsp + 4], 23h
add dword ptr [rsp], @F-@B
retf
@@:
USE32
ENDM
.code
main proc C
mov somevalue, 10 ; Writing to .data do not work either in 32-bit or 64-bit
X64_Start
; do something in 64-bit
X64_End
mov eax, 1
mov edx, 2
;invoke printf, CSTR("Received: 0x%.8x%.8x"),edx, eax ; does not work
;printf("Received: 0x%.8x%.8x",edx, eax ) ; does not work
invoke printf, offset msg, edx, eax
ret
main endp
end
COMMENT #
Build with:
\masm32\bin\uasm64 -c -coff test.asm
\masm32\bin\link /entry:main /MACHINE:X86 /FIXED test.obj
#