 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
reverser69 Expert Cheater
Reputation: 0
Joined: 03 Sep 2014 Posts: 112
|
Posted: Thu Feb 04, 2021 5:42 pm Post subject: how write large number of bytes? |
|
|
hi all
i want to write 200 bytes in [rsi+rax+XXX] location.
any help?[/code]
|
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4711
|
Posted: Thu Feb 04, 2021 6:54 pm Post subject: |
|
|
Example C++ code:
| Code: | #include <cstring>
void foo(char *a, char *b) {
std::memcpy(a, b, 200);
} |
gcc unrolls it to this:
| Code: | vmovdqu xmm0,[rsi]
vmovdqu [rdi],xmm0
vmovdqu xmm1,[rsi+16]
vmovdqu [rdi+16],xmm1
vmovdqu xmm2,[rsi+32]
vmovdqu [rdi+32],xmm2
vmovdqu xmm3,[rsi+48]
vmovdqu [rdi+48],xmm3
vmovdqu xmm4,[rsi+64]
vmovdqu [rdi+64],xmm4
vmovdqu xmm5,[rsi+80]
vmovdqu [rdi+80],xmm5
vmovdqu xmm6,[rsi+96]
vmovdqu [rdi+96],xmm6
vmovdqu xmm7,[rsi+112]
vmovdqu [rdi+112],xmm7
vmovdqu xmm0,[rsi+128]
vmovdqu [rdi+128],xmm0
vmovdqu xmm1,[rsi+144]
vmovdqu [rdi+144],xmm1
vmovdqu xmm2,[rsi+160]
vmovdqu [rdi+160],xmm2
vmovdqu xmm3,[rsi+176]
vmovdqu [rdi+176],xmm3
mov rax,[rsi+192]
mov [rdi+192],rax
ret
| (sysv abi) (edit: offsets are in decimal here; note CE uses hexadecimal)
Use lea to make addressing modes easier.
If you don't want to unroll it, you could make a for loop.
_________________
I don't know where I'm going, but I'll figure it out when I get there.
Last edited by ParkourPenguin on Thu Feb 04, 2021 8:29 pm; edited 1 time in total |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25820 Location: The netherlands
|
Posted: Thu Feb 04, 2021 7:51 pm Post subject: |
|
|
| Code: |
push rsi
push rdi
push rcx
lea rdi,[rsi+rax+XXX]
lea rsi,sourcebytes
mov rcx,#25 //25*8=200
db f3 48 a5 //rep movsq (apparently CE doesn't know how to assemble this, fixed in next version)
pop rcx
pop rdi
pop rsi
|
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
reverser69 Expert Cheater
Reputation: 0
Joined: 03 Sep 2014 Posts: 112
|
Posted: Fri Feb 05, 2021 8:47 am Post subject: |
|
|
| thanks. both of you.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|