Skip to content
Snippets Groups Projects
Commit c25157d2 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Vortragsfolien, Notizen und Beispiele 17.5.2023

parent ffa318c2
Branches
No related tags found
No related merge requests found
.file "functions-01.c"
.text
.p2align 4,,15
.globl sum
.type sum, @function
sum:
.LFB11:
.cfi_startproc
leal (%rdi,%rsi), %eax
ret
.cfi_endproc
.LFE11:
.size sum, .-sum
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "c = %d\n"
.section .text.startup,"ax",@progbits
.p2align 4,,15
.globl main
.type main, @function
main: ; #include <stdio.h>
.LFB12: ;
.cfi_startproc ; int sum (int a, int b)
subq $8, %rsp ; {
.cfi_def_cfa_offset 16 ; return a + b;
movl $10, %esi ; }
leaq .LC0(%rip), %rdi ;
xorl %eax, %eax ; int main (void)
call printf@PLT ; {
xorl %eax, %eax ; int c = sum (3, 7);
addq $8, %rsp ; printf ("c = %d\n", c);
.cfi_def_cfa_offset 8 ; return 0;
ret ; }
.cfi_endproc
.LFE12:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int sum (int a, int b)
{
return a + b;
}
int main (void)
{
int c = sum (3, 7);
printf ("c = %d\n", c);
return 0;
}
.file "functions-01.c"
.text
.globl sum
.type sum, @function
sum:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
movl -4(%rbp), %edx
movl -8(%rbp), %eax
addl %edx, %eax
popq %rbp
.cfi_def_cfa 7, 8 ; #include <stdio.h>
ret ;
.cfi_endproc ; int sum (int a, int b)
.LFE0: ; {
.size sum, .-sum ; return a + b;
.section .rodata ; }
.LC0: ;
.string "c = %d\n" ; int main (void)
.text ; {
.globl main ; int c = sum (3, 7);
.type main, @function ; printf ("c = %d\n", c);
main: ; return 0;
.LFB1: ; }
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl $7, %esi
movl $3, %edi
call sum
movl %eax, -4(%rbp)
movl -4(%rbp), %eax
movl %eax, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
../common/logo-hochschule-bochum-cvh-text-v2.pdf
\ No newline at end of file
../common/logo-hochschule-bochum.pdf
\ No newline at end of file
../common/pgslides.sty
\ No newline at end of file
File added
This diff is collapsed.
Binär codiertes Dezimalsystem (BCD), 17.05.2023, 11:27:10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Speicherzellen (hexadezimal): 0123
--> dezimal: 1 · 256 + 2 · 16 + 3 = 291
komfortabler zum Lesen: Interpretation als Dezimalzahl 123
--> Jede Hex-Ziffer wird als Dezimalziffer interpretiert.
--> bequem zu lesen (im Debugger)
bequem für die Ausgabe (z.B. beim Drucken)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment