天天看點

linux-彙編-位址及取位址變量(6)

.section .data
   mynum:
   .int 8
   mygs:
   .asciz "%x----%x----%x\n"
.section .text
   .globl main
   main:
   	  leal mynum,%eax #将mynum位址複制到%eax  
   	  movl (%eax),%ebx#将%eax内位址所指内容複制到%ebx
   	  movl mynum,%ecx#将mynum内容複制到%ecx中
      
   	  push %ecx
   	  push %ebx
  	  push %eax
   	  push $mygs
   	  call printf
   	  
   	  push $0
   	  call exit
   	        

 deepfu[email protected]:~/private/mytest$ gcc -o test66 test66.s

[email protected]:~/private/mytest$ ./test66

804a018----8----8

[email protected]:~/private/mytest$ 

繼續閱讀