Page 1 of 1

How to move value into XMM register?

Posted: Mon Sep 14, 2020 8:43 am
by SantiagoJaxson
Hello People!

I have a problem, don't know how to make a working script.

I know that EAX is currently holding value. But I found that the instruction for eax is: movd eax,xmm6. Does it mean that xmm6 which stored value is moving to EAX? If yes, how to write a correct script for moving value into XMM6 register?? I want to put a 4-byte value into XMM6 register.

I am waiting for your advices,

Thanks.[Link]

Re: How to move value into XMM register?

Posted: Mon Sep 14, 2020 9:46 am
by Chucky

Code: Select all

aobscanmodule(INJECT, Game.exe, AOB)
alloc(newmem,$1000, "Game.exe"+offset)

alloc(MyMem, 4)

MyMem:
//float
  dd (float)100

MyMem+4:
//double
  dq (double)1

label(code)
label(return)

newmem:
code:
  // move float
  movss xmm6,[MyMem]
  
  // move double
  movsd xmm6,[MyMem+4]
  jmp return

INJECT:
  jmp newmem
return:
registersymbol(INJECT)

[DISABLE]
INJECT:
  db origBites

unregistersymbol(INJECT)
dealloc(newmem)
Converting values:

Re: How to move value into XMM register?

Posted: Fri Sep 25, 2020 9:44 pm
by Scaredcat
I know 2 ways to do this. One is already posted above, but I will still post my own version since its slightly different than Chucky's.

1st way:

Code: Select all

  push eax
  mov eax,(float)200        // for moving a 4 byte value just use #200 instead of (float)200
  movd xmm0,eax
  pop eax
  movss [ecx+00000E9C],xmm0
  jmp return
2nd way:

Code: Select all

alloc(fullHealth,4) 

code:
  movss xmm0,[fullHealth]
  movss [ecx+00000E9C],xmm0
  jmp return

fullHealth:                      // Let’s say we’re moving a float value
  dd (float)200 

dealloc(fullHealth)