Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1493
2015-01-21 13:39:35 UTC
Hmm, this looks very strange, I will check this as soon as I get in the office.
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1497
2015-01-21 19:27:48 UTC
I have just tested your exact code and the output seems correct.
L_00000000: or eax, eax
L_00000002: and eax, eax
L_00000004: xor eax, eax
L_00000006: add eax, eax
L_00000008: sub eax, eax
L_0000000A: or eax, ebx
L_0000000C: and eax, ebx
L_0000000E: xor eax, ebx
L_00000010: add eax, ebx
L_00000012: sub eax, ebx
L_00000014: or eax, ecx
L_00000016: and eax, ecx
L_00000018: xor eax, ecx
L_0000001A: add eax, ecx
L_0000001C: sub eax, ecx
L_0000001E: or eax, edx
L_00000020: and eax, edx
L_00000022: xor eax, edx
L_00000024: add eax, edx
...
It is quite possible I did not update the linker plugin in the package by mistake, I have updated the download package for version 2.0.0.16, can you please re-download and let me know if this solves the issue? Thanks
0CodErr
member
Posts
201
Threads
37
Location
Unknown
Post #1499
2015-01-21 21:05:22 UTC
It seems that you checked only output beginning :)
If i not mistaken then wrong output starts from
or ax, ax
And instead of just prefix 0x66 also added 0x44 and we get wrong 0x66, 0x44 -- it
inc sp
.
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1502
2015-01-21 23:45:16 UTC
Aha, I see now, thanks for that, I'm going to look into the issue now.
Edit: Fixed for next release, thanks again for report.
0CodErr
member
Posts
201
Threads
37
Location
Unknown
Post #1509
2015-01-22 21:36:42 UTC
There is assignment not occures:
program RAW_IMAGE 'test';
#set bits 32;
byte b1, b2;
word w1, w2;
b1 = b2;
w1 = w2;
byte[edi] = byte[esi];
word[edi] = word[esi];
00000000 33C0 xor eax,eax
00000002 A0E0285401 mov al,[0x15428e0]
00000007 50 push eax
00000008 66680000 push word 0x0
0000000C 66FF35E3285401 push word [dword 0x15428e3]
00000013 33C0 xor eax,eax
00000015 8A06 mov al,[esi]
00000017 50 push eax
00000018 66680000 push word 0x0
0000001C 66FF36 push word [esi]
0000001F 0000 add [eax],al
00000021 0000 add [eax],al
00000023 0000 add [eax],al
As for dword's there is seems ok -- push \ pop used:
program RAW_IMAGE 'test';
#set bits 32;
dword d1, d2;
d1 = d2;
00000000 FF35D0285401 push dword [dword 0x15428d0]
00000006 8F05CC285401 pop dword [dword 0x15428cc]
0000000C 0000 add [eax],al
0000000E 0000 add [eax],al
00000010 0000 add [eax],al
00000012 0000 add [eax],al
Just suggestion.
If for byte \ word register eax used then may be also for dword better would use eax.
It faster than through the stack. Or may be need to add option's "through stack" and "through register".
Colin
admin
Posts
928
Threads
49
Location
Bulgaria
Post #1510
2015-01-23 22:15:53 UTC
OK, I have implemented as so:
preserving EAX is default even with byte/word etc. But there is now a directive to prevent this.
byte b1, b2;
word w1, w2;
dword d1, d2;
#set m2m_reg true;
b1 = b2;
w1 = w2;
d1 = d2;
nop
#set m2m_reg false;
b1 = b2;
w1 = w2;
d1 = d2;
Try this is the new release.
0CodErr
member
Posts
201
Threads
37
Location
Unknown
Post #1513
2015-01-25 13:30:38 UTC
I have tested new release.
Your code above works fine.
But errors here:
program RAW_IMAGE 'test';
#set bits 32;
inline procedure MyTest(;){
$x = 0;
$repeat $argc:
$y = 0;
$repeat $argc:
byte[$arg[$x]] = byte[$arg[$y]];
word[$arg[$x]] = word[$arg[$y]];
dword[$arg[$x]] = dword[$arg[$y]];
$y = $y + 1;
$end
$x = $x + 1;
$end
}
#set m2m_reg true;
Mytest(eax, ebx, ecx, edx, esi, edi, ebp, esp);
#set m2m_reg false;
Mytest(eax, ebx, ecx, edx, esi, edi, ebp, esp);
Below is only part(not all) of output:
00000000 33C0 xor eax,eax
00000002 8A00 mov al,[eax]
00000004 50 push eax
00000005 66680000 push word 0x0
00000009 66FF30 push word [eax]
0000000C FF30 push dword [eax]
0000000E 8F00 pop dword [eax]
00000010 33C0 xor eax,eax
00000012 8A03 mov al,[ebx]
00000014 50 push eax
00000015 66680000 push word 0x0
00000019 66FF33 push word [ebx]
0000001C FF33 push dword [ebx]
0000001E 8F00 pop dword [eax]
00000020 33C0 xor eax,eax
00000022 8A01 mov al,[ecx]
00000024 50 push eax
00000025 66680000 push word 0x0
00000029 66FF31 push word [ecx]
0000002C FF31 push dword [ecx]
0000002E 8F00 pop dword [eax]
; ............................................
00000858 33C0 xor eax,eax
0000085A 8A4500 mov al,[ebp+0x0]
0000085D 50 push eax
0000085E 66680000 push word 0x0
00000862 66FF7500 push word [ebp+0x0]
00000866 FF7500 push dword [ebp+0x0]
00000869 8F0424 pop dword [esp]
0000086C 33C0 xor eax,eax
0000086E 8A0424 mov al,[esp]
00000871 50 push eax
00000872 66680000 push word 0x0
00000876 66FF3424 push word [esp]
0000087A FF3424 push dword [esp]
0000087D 8F0424 pop dword [esp]
Seems that works only for dword.