global variable redeclared
Cannot compile this:
program RAW_IMAGE 'test';
#set bits 32;
dword a, b;
procedure MyProc() {
dword a, b;
a = b;
}
MyProc();
But was compiled when i commented first
dword a, b;
.
Also after that i noticed that in generated raw binary MyProc looks:
00000005 55 push ebp
00000006 8BEC mov ebp,esp
00000008 81EC08000000 sub esp,0x8
0000000E FF75F8 push dword [ebp-0x8]
00000011 8F45FC pop dword [ebp-0x4]
00000014 83C408 add esp,byte +0x8
00000017 C9 leave
00000018 C3 ret
Seems that you use
add esp,byte +0x8
to restore stack.
But it can be done also with
mov esp,ebp
But you already use
leave
Next, i give quote from AMD Manual:
LEAVE Releases a stack frame created by a previous ENTER instruction. To release the frame, it copies the frame pointer (in the rBP register) to the stack pointer register (rSP), and then pops the old frame pointer from the stack into the rBP register, thus restoring the stack frame of the calling procedure. The 32-bit LEAVE instruction is equivalent to the following 32-bit operation: MOV ESP,EBP POP EBP