I am a beginner in assembler. I objdumped a file that validates a password entered through command line. One of its sections was the one below. I don't understand a thing of what the movs are copying into eax register. I am also using evans debugger. A general understanding of what is happening would help.
<fillpassword>:
804851d: 55 push ebp
804851e: 89 e5 mov ebp,esp
8048520: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
8048523: c6 00 53 mov BYTE PTR [eax],0x53
8048526: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
8048529: 83 c0 01 add eax,0x1
804852c: c6 00 30 mov BYTE PTR [eax],0x30
804852f: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
8048532: 83 c0 02 add eax,0x2
8048535: c6 00 52 mov BYTE PTR [eax],0x52
8048538: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
804853b: 83 c0 03 add eax,0x3
804853e: c6 00 50 mov BYTE PTR [eax],0x50
8048541: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
8048544: 83 c0 04 add eax,0x4
8048547: c6 00 52 mov BYTE PTR [eax],0x52
804854a: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
804854d: 83 c0 05 add eax,0x5
8048550: c6 00 33 mov BYTE PTR [eax],0x33
8048553: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
8048556: 83 c0 06 add eax,0x6
8048559: c6 00 53 mov BYTE PTR [eax],0x53
804855c: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
804855f: 83 c0 07 add eax,0x7
8048562: c6 00 34 mov BYTE PTR [eax],0x34
8048565: 8b 45 08 mov eax,DWORD PTR [ebp+0x8]
8048568: 83 c0 08 add eax,0x8
804856b: c6 00 00 mov BYTE PTR [eax],0x0
804856e: 5d pop ebp
804856f: c3 ret
EBP+0x8 looks like a parameter to a function call -- the address of a string area to write to. The code repeatedly loads this address to AX and increments it, then writes a hard-wired character to the location pointed to by AX, so that the net result is to store the string "S0RPR3S4" (0-delimited) to the address passed in EBP+0x8.
In C, it would look something like this:
void fillpassword(char *p)
{
p[0] = 'S';
p[1] = '0';
p[2] = 'R';
p[3] = 'P';
p[4] = 'R';
p[5] = '3';
p[6] = 'S';
p[7] = '4';
p[8] = '\0';
}
It's kind of an inefficient way to accomplish its task, and it looks to have been compiled without optimization (assuming it did start in C, or another higher-level language).