The MASM Forum

Projects => Rarely Used Projects => GoAsm => Topic started by: wjr on July 21, 2013, 05:04:14 AM

Title: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on July 21, 2013, 05:04:14 AM
GoBug – Jeremy has kindly made his Win32 symbolic debugger version 2.0.3.1 now available for free. See here http://www.godevtool.com/#gobug (http://www.godevtool.com/#gobug) for further details. If you don't already have this, please check it out. It has always been a sweet (yet nasty for the bug) addition to the suite of GoTools.

GoRC – the resource compiler has received a well-deserved promotion to version 1.0.0.0 and is available here http://www.godevtool.com/Gorc.zip (http://www.godevtool.com/Gorc.zip) with the following changes:
GoRC – version 1.0.0.1 now up with the following adjustment:
GoRC – version 1.0.1.0 now up with the following adjustment:

GoAsm – version 0.58 is an important assembler update on the x64 side, available here http://www.godevtool.com/Goasm.zip along with some other changes:
GoAsm – version 0.58.0.1 now up with the following adjustments:
GoAsm – version 0.58.0.2 now up with the following adjustments:
GoAsm – version 0.58.0.3 now up with the following adjustments:
GoAsm – version 0.58.0.4 now up with the following adjustment:
GoAsm – version 0.58.0.5 now up with the following adjustment:
GoAsm – version 0.58.0.6 now up with the following adjustment:

* this fix goes a long way towards making ADDR go a long way with large addresses, but note that this in the first case MAY (doesn't when one of the first four INVOKE parameters) and in the second case WILL use the R11 register. This should have no impact on x86/x64 code. With greater register usage on the x64 only side, if you are using R11 for other purposes, please select a more suitable 64-bit register and manually MOV reg64,ADDR (actually LEA) then MOV [mem64],reg64.

The above is now good for addresses up to 4GB. There are still a few changes that I need to make with GoLink in order to allow the full 8TB. Once I finish up with these and another item, I can then return focus to some of the remaining GoAsm items, mainly x64 floating point INVOKE / FRAME issues and FRAME XDATA and PDATA which I was working on before some of the above accumulated detours became significant enough to prompt a release.

Enjoy,
WJR
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: FlySky on July 21, 2013, 05:09:10 PM
Great to see another update of this fine set of tools. I am a very happy GoASM user for a couple of years now, keep it up.
btw will there be any SSE3, SSE4 .. or higher support in GoASM.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: Yuri on July 21, 2013, 05:35:07 PM
Great update. Thanks! :icon14:
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on July 22, 2013, 02:27:23 AM
I have become somewhat familiar with the code generating engines of GoAsm, so after the above focus I can sse3 what I can do.

It has been brought to my attention that FRAME without ARG and LOCAL has a problem with USES, looking into it...
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: Yuri on July 22, 2013, 04:07:39 AM
There is one inconsistency I forgot to mention earlier. If in x64 mode we mix up registers, e.g. use RDX for the first Invoke argument, GoAsm catches this as an error:
Quote
Error!
Line 27 of assembler source file (edx.asm):-
RDX overwritten by 2nd parameter material: use a register other than RDX
But it doesn't do so if we use EDX, although the result is the same.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on July 23, 2013, 02:44:26 AM
An update is now available with fixes for these last two items.

GoRC also revised, but same version number, with very minor removal of IMAGE_FILE_LINE_NUMS_STRIPPED and IMAGE_FILE_LOCAL_SYMS_STRIPPED noting that for both "This flag is deprecated and should be zero" as part of the work in progress on the upcoming GoLink update...
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: Yuri on July 23, 2013, 02:21:33 PM
Thanks, Wayne! But how about DX, R8W and R9W? Maybe it doesn't make much sense to use them for passing arguments, so GoAsm could do what it does for DL, R8B and R9B:
Quote
Error!
Line 28 of assembler source file (edx.asm):-
Invalid operand for this mnemonic:-
dl, "hello", "test", 0
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: Yuri on July 25, 2013, 01:36:37 AM
Something seems to be wrong with the use of R11.

DATA SECTION

aa  DD 0
bb  DD 0


CODE SECTION

Start:
    lea r11,[aa]
    invoke Func, 0, 0, 0, 0, addr bb
    invoke Func, 0, 0, 0, 0, addr bb
    ret

Func:
    ret


0000000000401000: 4C 8D 1D F9 0F 00 00  lea r11,[00402000h]             

000000000040100F: 4C 8D 1D EA 0F 00 00  lea r11,[00402000h]  ; should be 00402004h
0000000000401016: 41 53                 push r11               

0000000000401026: E8 31 00 00 00        call 000000000040105C

0000000000401039: 4C 8D 1D 1C 00 00 00  lea r11,[0040105Ch]  ; should be 00402004h
0000000000401040: 41 53                 push r11         


Also, if the address is with a displacement, i.e. addr aa + 2, the displacement isn't added to the address.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on July 26, 2013, 07:58:36 AM
An update is now available with fixes for these last three items.

Yes, for the 16-bit cases I have gone with invalid to be similar to 8-bit, higher up PUSHs, and x86 cases. Sorry about that on the other two... ended up being easy fixes, but takes a while to trace through and verify after with debugger.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: Yuri on July 26, 2013, 03:01:35 PM
Thanks! But I have one more question. A local address in a FRAME is pushed like this:

0000000000401010: 55            push rbp
0000000000401011: 83 04 24 F8   add  dword ptr [rsp],0FFFFFFF8h

Is it safe to use dword ptr and not qword ptr here? I tried loading a DLL above 4 GB and creating a new thread using one of its functions as the starting point, and its stack was still below 4 GB, but is that guaranteed to always be so?
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on July 30, 2013, 03:24:47 PM
Under normal circumstances I would say safe, but not always guaranteed to be so. Perhaps this should be changed with an extra byte for a qword ptr.

Each thread gets its own stack, so I would be curious how RSP progresses as you create more threads. There should be a problem with this for the many thread case. The extent of this depends upon the next point...

I played around with /DYNAMICBASE and HIGHENTROPYVA for an EXE {just a note that I apparently have some more GoLink work to do for x64 with the /DYNAMICBASE option (remove .reloc for .rsrc)}. Although there is some variability, again well below 4GB for the typical case. However, by playing around with the PE32+ Stack Reserve, you can get there quickly. If you start with a Stack Reserve of 70000000h, you would typically find RSP starting between 7005xxxx and 7152xxx. However, starting with a Stack Reserve of 80000000h, you jump to a starting RSP around 0FFFEFxxx. With a Stack Reserve further above 2GB, you end up with an RSP >4GB.

Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on August 28, 2013, 03:04:30 PM
Although probably not common for such a large stack, or somewhat smaller ones with multiple threads, to be on the safer side, I went with the qword option.

As for GoLink, the next update will have a fix for this bug:
For x64, if you link resources using a RES file for the case of a /DLL or an EXE with /DYNAMICBASE (not a problem for just an EXE), these options include relocations, but there are some relocations for the .rsrc section that shouldn't be there.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on December 22, 2013, 04:45:44 AM
GoAsm version 0.58.0.4 and GoRC version 1.0.0.1 are now available. I'm still finishing up on some SAFESEH adjustments for a GoLink update...
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: Yuri on December 22, 2013, 03:30:59 PM
Thanks for the fixes, Wayne! :icon14:
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on January 01, 2014, 12:50:29 PM
GoRC version 1.0.1.0 now available.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on January 06, 2014, 09:55:38 AM
GoAsm version 0.58.0.5 now available.
Title: Re: GoAsm 0.58, GoRC 1.0 and GoBug updates
Post by: wjr on January 07, 2014, 03:38:06 AM
GoAsm version 0.58.0.6 now available.