I know that the sentence I am about to say is probably the best way to become very unpopular on StackOverflow very quickly. I'll say it anyway: Why doesn't this work (completly)?
I was trying to figure out what the lea/leal instruction does. The way I understand it, lea/leal finds out the memory address of the first operand and writes this address into the second operand (which might be a register or so).
This part seems to work. When I run the program below it says:
The memory address of var is 134518204.
However, right after this it says something like "memory access error". pushl (%eax) obviously doesn't work. Why not?
.data
    var:    .long 42
    str1:   .string "The memory address of var is %d.\n"
    str2:   .string "At this memory address we find var's value: %d.\n"
.text
.global main
main: 
    leal var, %eax          # Copy the address of var into %eax
    pushl %eax
    pushl $str1
    call printf             # Print str1
    pushl (%eax)
    pushl $str2
    call printf             # Print str2
    # Some stack cleaning should be here :)
    movl $1, %eax
    int $0x80
I am not even sure if I got right what lea/leal does. Help is appreciated. ;)
 
     
    