I have a simple question really.. I just wanted to see how this is done.. if anyone can show me how..

XOR AL, 5 ; this is what I have in asm.. but...


I was wondering what is the MMX version of this same exact thing...
like using mmx to xor al by 5 if that makes any sense just kinda curious and I also wondered if MMX can be done using masm32.. even if i have to write macros to do it :/

I tried looking on the net for how its done but couldn't find very much must be a somewhat less explored area.
Posted on 2004-01-29 21:09:54 by DevSpartacus
MMX has own registers, and instructions start with "p".
You can enable it with .mmx in header of your source.
Instruction you need is pxor.
Posted on 2004-01-29 21:40:51 by comrade
i see didnt know about the .mmx thing :)

would you then do somthing like this....
MOVQ MM0, AL
MOVQ MM1, 5
PXOR MM0, MM1
MOVQ AL, MM0

or with PMOV?
??
Posted on 2004-01-29 21:42:08 by DevSpartacus
Spartacus, you should read some text about MMX :), it's rather different from the rest of the instructionset. What you're trying to do doesn't make much sense, realy - MMX is so-called SIMD: "Single Instruction, Multiple Data". So, processing of 8 bytes, 4 words, or 2 dwords.

You cannot directly move constants into MMX registers, and for MOVQ you can onlu move to/from memory or other mmx registers. There's also MOVD that moves to dword-size memory or registers.
Posted on 2004-01-30 02:01:16 by f0dder
I agree with fodder about reading up on mmx. You do not seem to know what you are doing. In mmx there's 2 types of mov, movq (move quadword) and movd (move dword) but no sure things as move the values in al to mmx except perhaps movd mm0, eax.

May I ask, what are you trying to accomplish with mmx?
Posted on 2004-01-30 05:15:01 by roticv
is this what your looking for?





sub esp,8
movzx eax,al
mov dword ptr ,eax
movd MM0, dword ptr
mov dword ptr ,5
movd MM0, dword pre
pxor MM0,MM1
movd dword ptr ,MM0
mov eax,dword ptr
add esp,8
Posted on 2004-01-30 11:41:22 by Qages


00000000 0FB6C0 movzx eax,al ; we assume there's already a number in al
00000003 0F6EC0 movd mm0,eax
00000006 B805000000 mov eax,05 ; same size as "mov al, 5 + movzx eax, al"
0000000B 0F6EC8 movd mm1,eax
0000000E 0FEFC1 pxor mm0,mm1
00000011 0F7EC0 movd eax,mm0

20 bytes, whatever clocks, pretty pointless.



00000000 3405 xor al,05

2 bytes, a lot less clocks, the way to do it.

MMX is not for small operations like this. However, if you had like a megabyte of data you wanted to XOR with 5, you could probably do it faster with MMX (or SSE2-extended MMX :)) than regular instructions. The code would be somewhat more complicated than a simple byte-xor loop, as you should make sure the main loop works on 8-byte aligned data.
Posted on 2004-01-30 16:07:33 by f0dder
I understand its not for small operations im making somthing that I wanted it to be more obscure and longer to follow, example an exe encryptor, thought it might be a bit more difficult for someone to trace, if they had to account for MMX registers. I have yet to see any encryptors for pe files that make use of MMX at least none to my current knowledge :)

Just thought it might be a good idea if someone wrote one that made use of them thus making the code harder to follow since MMX isn't necessarly used as much as say, normal assembly instructions. I don't know much about MMX though thats true :) I just thought it might be a good idea but then again maybe im wrong :confused: just thought it would make things intresting.

Unless someone has a better idea of how to make it more tedious.
Posted on 2004-01-30 19:28:19 by DevSpartacus
More tedious? Binary code mutation/morphing (borrowed from the viral world), virtual machines. Forget about debugger tricks and ring0.
Posted on 2004-02-01 18:10:46 by f0dder

I understand its not for small operations im making somthing that I wanted it to be more obscure and longer to follow, example an exe encryptor, thought it might be a bit more difficult for someone to trace, if they had to account for MMX registers. I have yet to see any encryptors for pe files that make use of MMX at least none to my current knowledge :)


last time i checked softice was perfectly capable of displaying mmx registers, so i cant see how using mmx would be more tedious to trace than say for example tracing fpu/80387 code.. just because it might be new to you doesnt mean that it will be more difficult for someone to trace.. it all comes down to experience at the end of the day
Posted on 2004-02-01 20:36:12 by evlncrn8