Assembly Language for Beginners
1.5. HELLO, WORLD! TheADR R0, aHelloWorldinstruction adds or subtracts the value in thePC^32 register to the offset where thehel ...
1.5. HELLO, WORLD! .text:00000304 68 65 6C 6C+aHelloWorld DCB "hello, world",0 ; DATA XREF: main+2 We can easily spot the 2-byte ...
1.5. HELLO, WORLD! Why did the compiler replace theprintf()withputs()? Presumably becauseputs()is faster^41. Because it just pas ...
1.5. HELLO, WORLD! In an executable binary file (Windows PE .exe, ELF or Mach-O) an import section is present. This is a list of ...
1.5. HELLO, WORLD! ARM64 GCC Let’s compile the example using GCC 4.8.1 in ARM64: Listing 1.29: Non-optimizing GCC 4.8.1 + objdum ...
1.5. HELLO, WORLD! Listing 1.30:main()returning a value ofuint64_ttype #include <stdio.h> #include <stdint.h> uint64 ...
1.5. HELLO, WORLD! 12 ; load the address of the puts() function from the GP to $25: 13 lw $25,%call16(puts)($28) 14 ; load the a ...
1.5. HELLO, WORLD! 15 .text:00000010 sw $gp, 0x20+var_10($sp) 16 ; load the address of the puts() function from the GP to $t9: 1 ...
1.5. HELLO, WORLD! We see here that register FP is used as a pointer to the stack frame. We also see 3NOPs. The second and third ...
1.6 Function prologue and epilogue Optimizing GCC: load it into GDB Listing 1.36: sample GDB session root@debian-mips:~# gcc hw. ...
1.7 Stack What these instruction do: save the value in theEBPregister, set the value of theEBPregister to the value of theESPand ...
1.7. STACK Heap Stack Start of heap Start of stack In [D. M. Ritchie and K. Thompson,The UNIX Time Sharing System, (1974)]^57 we ...
1.7. STACK ; Line 4 pop ebp ret 0 ?f@@YAXXZ ENDP ; f ...Also if we turn on the compiler optimization (/Oxoption) the optimized c ...
1.7. STACK For more information on other calling conventions see also section (6.1 on page 734). By the way, thecalleefunction d ...
1.7. STACK mov dx, msg ; address of message mov ah, 9 ; 9 means "print string" function int 21h ; DOS "syscall" mov ah, 4ch ; "t ...
1.7. STACK Local variable storage A function could allocate space in the stack for its local variables just by decreasing thesta ...
1.7. STACK push esi call _puts add esp, 28 ... The solealloca()argument is passed viaEAX(instead of pushing it into the stack)^6 ...
1.7. STACK ret The code is the same as in the previous listing. By the way,movl $3, 20(%esp)corresponds tomov DWORD PTR [esp+20] ...
1.7. STACK }; int main() { f1(); f2(); }; Compiling ... Listing 1.41: Non-optimizing MSVC 2010 $SG2752 DB '%d, %d, %d', 0aH, 00H ...
1.7. STACK Microsoft (R) Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. /ou ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf