View previous topic :: View next topic |
Author |
Message |
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Jun 07, 2014 1:52 am Post subject: Working With xmm0 |
|
|
How can I manipulate the individual values in xmm0? For example, I have an instruction that writes to coordinate values using:
Code: | movaps [rdx+00000030],xmm0 |
By setting a breakpoint, I can see the XMMRegisters and their corresponding values, e.g.:
Code: | xmm0: 1973.66 - 295.23 - 68.30 - 0.00 |
I'd like to write a script that basically performs no operation on the third coordinate (68.30) only.
Is this possible?
Thanks.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Jun 07, 2014 2:56 am Post subject: |
|
|
This will write 1973.66 into [rdx+30] and 295.23 into [rdx+34].
In case you want to skip 295.23 you can use this:
Code: | movss [rdx+30],xmm0
shufps xmm0,xmm0,4E
movss [rdx+38],xmm0
shufps xmm0,xmm0,4E |
This will write 1973.66 into [rdx+30] and 68.30 into [rdx+38].
_________________
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Jun 07, 2014 3:20 am Post subject: |
|
|
mgr.inz.Player, thanks.
What's the 4E?
What if I want to NOP the 68.30, but not the others? Would I write it out similarly?:
Code: | movss [rdx+30],xmm0
shufps xmm0,xmm0,4E
movss [rdx+34],xmm0
shufps xmm0,xmm0,4E |
Thanks, again.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Jun 07, 2014 3:44 am Post subject: |
|
|
XMM registers have four single-precision floating-point values
Code: |
---------------------------
| X3 | X2 | X1 | X0 |
--------------------------- |
0.00 - 68.30 - 295.23 - 1973.66
movaps [memory],XMM0
or movups [memory],XMM0
will write X0 into [memory], X1 into [memory+4]
X2 into [memory+8] and X3 into [memory+C]
movd [memory],XMM0
or movss [memory],XMM0
will write X0 into [memory] only
movq [memory],XMM0
will write X0 into [memory], X1 into [memory+4] only
shufps xmm0,xmm0,4E will swap qwords (X0X1 and X2X3) inside XMM0
more info about shufps
http://www.jaist.ac.jp/iscenter-new/mpc/altix/altixdata/opt/intel/vtune/doc/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/mergedProjects/instructions/instruct32_hh/vc293.htm
What exactly do you want? NOP = NoOp = No Operation
If you want to perform NOP on third value (X2), so no reading and no writing on that part of XMM0, just use
X3 isn't important, when it comes to "coordinates". Mostly.
_________________
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Jun 07, 2014 3:54 am Post subject: |
|
|
Ahh...I see. Thanks for the explanation...that makes more sense. I still don't see where you get the 4E value from. Nonetheless, you have given me enough information to accomplish what I want.
Yes, I just wanted to NOP that value...just testing something out.
Thanks again...I owe you 3 +reps right now.
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Jun 07, 2014 4:36 am Post subject: |
|
|
++METHOS wrote: | I still don't see where you get the 4E value from. |
1 0 3 2
01 00 11 10
01001110 = 0x4E
_________________
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sat Jun 07, 2014 5:29 am Post subject: |
|
|
Ha! Thanks.
|
|
Back to top |
|
|
Daijobu Master Cheater Reputation: 13
Joined: 05 Feb 2013 Posts: 301 Location: the Netherlands
|
Posted: Sat Jun 07, 2014 7:54 am Post subject: |
|
|
This topic just got bookmarked. Thanks mgr.inz.Player.
_________________
|
|
Back to top |
|
|
shakib187 Expert Cheater Reputation: 0
Joined: 24 May 2007 Posts: 215
|
Posted: Sat Mar 07, 2015 5:50 pm Post subject: |
|
|
Is it possible for my game to crash if I use movq instead of movss? I have no idea what I'm doing wrong
|
|
Back to top |
|
|
justa_dude Grandmaster Cheater Reputation: 23
Joined: 29 Jun 2010 Posts: 891
|
Posted: Sat Mar 07, 2015 6:01 pm Post subject: |
|
|
shakib187 wrote: | Is it possible for my game to crash if I use movq instead of movss? I have no idea what I'm doing wrong :shock: |
One is moving a 4-byte float and the other is moving an 8-byte double. So, yes, it's possible that you're causing a crash.
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on... |
|
Back to top |
|
|
|