Okay thanks, I tried -mstackrealign and it seems to help in the last
case I mentioned. I don't really see how, though. It shouldn't be
necessary in the first place, since once the stack is aligned
correctly, it should stay aligned in every subsequent function call.
The GP fault I mentioned earlier occurs in the following instruction:
60987: 0f 29 45 a8 movaps XMMWORD PTR [ebp-0x58],xmm0
Here is the entry to this function, when compiled with -mstackrealign:
00060a74 <jw::thread::detail::scheduler::check_exception()>:
60a74: 8d 4c 24 04 lea ecx,[esp+0x4]
60a78: 83 e4 f0 and esp,0xfffffff0
60a7b: ff 71 fc push DWORD PTR [ecx-0x4]
60a7e: 55 push ebp
60a7f: 89 e5 mov ebp,esp
And here is the same function, without it:
00060918 <jw::thread::detail::scheduler::check_exception()>:
60918: 55 push ebp
60919: 89 e5 mov ebp,esp
In the first case, ebp ends up being 0x...8, while in the second, ebp
is 0x...c. In both cases however, esp at the point of the call is
correctly aligned to 0x10 bytes.
Either with or without -mstackrealign, the stack is always aligned to
16 bytes in main():
0005ee6c <main>:
5ee6c: 55 push ebp
5ee6d: 89 e5 mov ebp,esp
5ee6f: 57 push edi
5ee70: 56 push esi
5ee71: 53 push ebx
5ee72: 83 e4 f0 and esp,0xfffffff0
5ee75: 83 c4 80 add esp,0xffffff80
Here's the code I'm working with, if you want to try for yourself:
https://github.com/jwt27/jwdpmi_test
On 12 March 2017 at 06:15, Louis Santillan (
lpsa...@gmail.com) [via