On 14/07/2020 11:17, Paul Gofman wrote:
On 7/14/20 10:35, Alexandre Julliard wrote:
Paul Gofman pgofman@codeweavers.com writes:
On 7/13/20 23:05, Alexandre Julliard wrote:
Paul Gofman pgofman@codeweavers.com writes:
There is no guarantee that jmp_buf is 16 bytes aligned.
It is using DECLSPEC_ALIGN(16) though. Where do you see it being misaligned?
Well, I was getting that after turning NtOpenDirectoryObject locally into syscall thunk from __TRY / __CATCH block used by IsBadStringPtrW() from debugstr_w(). But after you pointed out that alignment is there which I initially missed, I found that the stack alignment which is present in syscall thunk generated code seems not to be performed (apparently, not intentionally) if the size of arguments is <= 0x20. I should rather be fixing that, sorry for the noise.
Fixing that wouldn't hurt, but note that all API functions should already be using force_align_arg_pointer. If that doesn't work correctly we'll have other problems.
The stack is not aligned in Mingw PE modules for some reason (I checked with a winehq binary also that is not my local build problem only; I also checked by explicitly setting it for function to make sure it is not some configuration problem).
You mean it's not forcefully aligned, right? If so, I think that's normal since the MS ABI mandates that it is 16 byte aligned. I don't think Windows force aligns the stack either, it just probably doesn't use aligned SSE instructions in the first place (and why it mostly doesn't crash, though I've heard stories of it crashing when people misalign the stack and break the ABI).
For this patch, just for future reference, you should be using movdqu, which anyway it's just as fast as movdqa unless the processor is very old. I don't know if it's still necessary though.