TheByteSize wrote: ↑Tue Aug 13, 2019 1:34 am
Well, I have figured out my dumb ass mistakes. movss [eax] works when eax is actually acting as a pointer which mean that it is holding an address instead of a value. Since, I'm trying move hex value directly from xmm to eax(eax was 0x0), I need to use movd. DOH
As for method of saving xmm. I copied it from
[Link].
I got a question though. Since xmm is a register consist of 4 set of aligned 32 bits floating point, can I assume it's always aligned and can I always use movdqa to save xmm value?
I do want to learn a sure way to save xmm.
Thanks for the hints.
You have xmm0 ... xmm15. I'm sure you can find one of them, at that hook spot of yours, that is not used. Really now
Make no sense to clog the hook with "movdqu [crap],your_xmm"
I'd use that only as a last resort; only if ALL of them are in use at that spot. You're clearly not breaking in the middle of some heavy MMX computations, so pick one.. as far away from yours as possible.
"I'm trying move hex value directly from xmm to eax(eax was 0x0), I need to use movd" - you're not making any sense here. If your "eax" is 0, both movss and movd will fail. You're not moving anything to eax, but to [eax]. That will cause an exception when eax is 0. That's because [0] == crash. Trying to read or write from 0 address never worked for anyone. Like I said.. make sure the address you write to is valid and a constant (the function you hook in is not used by other functions, thus eax changing; and perhaps being 0 from time to time).
Lastly, my point was exactly the opposite. For 'movaps' or anything with an 'a' in MMX world you'll need a 16-bytes aligned address. In short, an address that ends in 0 (xxxxxxx0). If the address is not aligned, you'll hit an exception, thus crash. Always use 'movups' (or 'u' equivalent) to move stuff around.