Nov 22, 2009

Leal .... What The Hell Is This Instruction ? - AT&T 32bit x86

free web hosting
Open Discussion & Free Web Hosting > Computers & Tech > Programming > Programming General > Assembly

Leal .... What The Hell Is This Instruction ? - AT&T 32bit x86

qwijibow

< pointless angry ranblings. >
Their are a million on-line assembly tutorials...

every single one the same...

stick the write system call number into eax, the std-out number into ebx, a string into ecx, and a string length to edx, and interput 0x80.

HELLO world.... now you are an assembly expert..

Im going to kill the next person i see who rites such an empty tutorial smile.gif
< / pointless angry ranblings >


Righty...

Im looking for a list of assembly instrucions, and maybe a line or two of comment to show their meaning..

i can guess most of them, but leal keps showing up in my test programs ( tutorials are all utterly usless, so im compiling c code, and making gcc dump the assembly code )

what does leal do ?

thanks.

e.g.

CODE

void funtction1() {

    int A = 10;
    A += 66;
}


compiles to...

CODE

funtction1:
    pushl    %ebp    #
    movl    %esp, %ebp    #,
    subl    $4, %esp    #,
    movl    $10, -4(%ebp)    #, A
    leal    -4(%ebp), %eax    #, tmp59    THIS LINE !!!
    addl    $66, (%eax)    #, A
    leave
    ret


i understand nmostly everything,,, EXCEPT leal

 

 

 


Comment/Reply (w/o sign-up)

mastercomputers
I'll try and explain it, but I don't think I can make a good explanation.

LEA is Load Effective Address, it's basically a direct pipeline to the address you want to do calculations on without affecting any flags, or the need of pushing and popping flags. It's also used in repetitve things, in your code I'll try to explain:

CODE
funtction1:
1.    pushl    %ebp    #
2.    movl    %esp, %ebp    #,
3.    subl    $4, %esp    #,
4.    movl    $10, -4(%ebp)    #, A
5.    leal    -4(%ebp), %eax    #, tmp59    THIS LINE !!!
6.    addl    $66, (%eax)    #, A
7.    leave
8.    ret


1. push ebp
2. copy stack pointer to ebp
3. make space on stack for local data
4. put value 10 in A (this would be the address A has now)
5. load address of A into EAX (similar to a pointer)
6. add 66 to A
... don't think you need to know the rest

So hopefully that explains it, remember in some circumstances when doing calculations, like adding, subtracting, etc you affect different flags, in this way, you aren't affecting any flags and are performing the calculations directly to it. Useful for repetitive work.

What I find is, usually what is before LEA instructions, is what LEA will mimic, and what is after LEA is what it will do. You could have just worked out everything and pushed the results at the end, but I guess this way is better/faster, etc.

By the way, I wrote an empty Hello, World tutorial too tongue.gif but I could have made it more informative I agree. I wrote a tutorial here once on Assembly and it was quite packed but unfortunately, it disappeared and I think that it's no longer is here, nor did I have a backup copy of it, it was basic but explained how to go about using all the information Linux provides you with so you could do simple things like writing and reading, etc which would have helped people understand Shellcoding that's for sure tongue.gif


Cheers,


MC

 

 

 


Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : Leal Hell Instruction Atampt 32bit X86


    Looking for leal, h, ll, instruction, andt, 32bit, x86

See Also,

*SIMILAR VIDEOS*
Searching Video's for leal, h, ll, instruction, andt, 32bit, x86
advertisement



Leal .... What The Hell Is This Instruction ? - AT&T 32bit x86

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com