This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add support for the Win32 hook prologue (try 3)


Am Friday 11 September 2009 17:34:22 schrieb Ross Ridge:
> >On a partly related topic, I think the Win64 ABI requires that the first
> >function is two bytes long, and there at least 6 bytes of slack before
> >the function. Does gcc implement that?
>
> As far as I can tell the Win64 ABI doesn't have either of these
> requirements.  Microsoft's compiler certainly doesn't guarantee that
> functions begin with two byte instructions, and the "x64 Software
> Conventions" document gives examples of prologues with larger initial
> instructions:
This is where I got that from:
http://www.virtualdub.org/blog/pivot/entry.php?id=47

This yet-another-blog-post refers to the docs from the platform SDK:
> Tentatively, all functions must begin with an instruction that is at least
> two bytes, and have at least six bytes of unused space available before them 

I haven't yet downloaded the platform SDK to check that myself. I don't bother 
too much about Win64 hooking at the moment because (a) Wine doesn't support 
Win64 right now, (b) Win64 apps are rare, and (c) Steam doesn't support Win64 
hooking yet(although it does have some Win64 bit games)

> Hmm... after playing around with Microsoft's compiler it seems if it omits
> the frame pointer it will also omit the the two-byte "NOP" at the start
> of the function.  Basically /hotpatch isn't compatible with /O2, although
> /Oy alone isn't enough for the compiler to remove the frame pointer.
Sounds kinda broken and fragile to me... If I were to design this, I'd force 
the frame pointer on with /hotpatch, rather than the other way around.

> And while I'm merging replies, I believe:
>
> 	"movl.s\t%1,%0"
>
> should be:
>
> 	"movl.s\t{%1, %0|%0, %1}"
What's the difference?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]