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

free web hosting
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

 

 

 


Reply

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

 

 

 


Reply


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*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. movl leal assembly tutorial - 3.99 hr back. (1)
  2. assembler leal - 2.38 hr back. (2)
  3. at&t leal - 10.91 hr back. (1)
  4. leal assembler - 12.09 hr back. (1)
  5. leal stack - 22.04 hr back. (2)
  6. leal gcc x86 - 22.52 hr back. (1)
  7. leal asm examples - 26.64 hr back. (2)
  8. assembly commands leal - 27.59 hr back. (1)
  9. leal in assembly - 32.73 hr back. (1)
  10. assembly leal - 33.68 hr back. (1)
  11. leal assembly - 11.90 hr back. (11)
  12. intel assembly leal - 36.06 hr back. (1)
  13. asm leal - 32.07 hr back. (3)
  14. ranblings - 37.50 hr back. (1)
Similar Topics

Keywords : leal, h, ll, instruction, andt, 32bit, x86

  1. X86: Assembler AT&T Or Intel Mode?
    Which do you prefer AT&T or Intel mode for programming assembler? (0)
  2. Magic! Vmware Said My 32Bit CPU Support 64Bit ?
    (2)
    I got a AMD 32bit Sempron 2600+, socket 754 system. After I installed VMWare. it passed the 64bit
    compatibility check.... what a amazing result... /ohmy.gif' border='0'
    style='vertical-align:middle' alt='ohmy.gif' /> may be it just locked by AMD. is AMD 32bit
    Sempron 2600+, socket 754, really a 64bit CPU?? if yes, How can I turn it on?? ....
  3. Installed Freebsd, Need Instruction For Gui
    At the dawn of a personal FreeBSD era (3)
    I'm at the beginning of learning about FreeBSD, and have installed the OS (version 5.4). I only
    made it to the black screen with text/command line. So I need those quick and easy pointers to get
    started with the graphical interface of things. So...how easy can I get a graphical user interface
    like mousecursor, windows, programmenu's and such (like in windows, ubuntu, mandrake and so on)
    working for my FreeBSD installation? I read some stuff about X11 and Xorg, but it seems quite
    complicated to me, but I consider that as just being a mild obstacle because I'm....

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

*RANDOM STUFF*





*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



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE