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

Vortragsfolien und Beispiele 24.5.2023

parent c25157d2
No related branches found
No related tags found
No related merge requests found
Showing
with 434 additions and 0 deletions
../common/io-ports-and-interrupts.pdf
\ No newline at end of file
../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
#include <stdio.h>
typedef char string[42];
void print (string msg)
{
printf ("%s\n", msg);
}
int main (void)
{
string hello = "Hello, world!";
print (hello);
return 0;
}
.file "parameters-01.c"
.text
.globl print
.type print, @function
print:
.LFB11:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
call puts@PLT
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size print, .-print
.globl main
.type main, @function
main:
.LFB12:
.cfi_startproc
subq $56, %rsp
.cfi_def_cfa_offset 64
movabsq $8583909746840200520, %rax
movabsq $143418749551, %rdx
movq %rax, (%rsp)
movq %rdx, 8(%rsp)
movq $0, 16(%rsp)
movq $0, 24(%rsp)
movq $0, 32(%rsp)
movw $0, 40(%rsp)
movq %rsp, %rdi
call puts@PLT
movl $0, %eax
addq $56, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE12:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include "paramlib-02.h"
int main (void)
{
string hello = "Hello, world!";
print (hello);
return 0;
}
.file "parameters-02.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
subq $56, %rsp
.cfi_def_cfa_offset 64
movabsq $8583909746840200520, %rax
movabsq $143418749551, %rdx
movq %rax, (%rsp)
movq %rdx, 8(%rsp)
movq $0, 16(%rsp)
movq $0, 24(%rsp)
movq $0, 32(%rsp)
movw $0, 40(%rsp)
movq %rsp, %rdi
call print@PLT
movl $0, %eax
addq $56, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include "paramlib-03.h"
int main (void)
{
print ('H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n');
return 0;
}
.file "parameters-03.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
pushq $10
.cfi_def_cfa_offset 24
pushq $33
.cfi_def_cfa_offset 32
pushq $100
.cfi_def_cfa_offset 40
pushq $108
.cfi_def_cfa_offset 48
pushq $114
.cfi_def_cfa_offset 56
pushq $111
.cfi_def_cfa_offset 64
pushq $119
.cfi_def_cfa_offset 72
pushq $32
.cfi_def_cfa_offset 80
movl $44, %r9d
movl $111, %r8d
movl $108, %ecx
movl $108, %edx
movl $101, %esi
movl $72, %edi
call print@PLT
movl $0, %eax
addq $72, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
.file "parameters-03.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
leal 4(%esp), %ecx
.cfi_def_cfa 1, 0
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
movl %esp, %ebp
pushl %ebx
pushl %ecx
.cfi_escape 0xf,0x3,0x75,0x78,0x6
.cfi_escape 0x10,0x3,0x2,0x75,0x7c
call __x86.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
subl $8, %esp
pushl $10
pushl $33
pushl $100
pushl $108
pushl $114
pushl $111
pushl $119
pushl $32
pushl $44
pushl $111
pushl $108
pushl $108
pushl $101
pushl $72
call print@PLT
addl $64, %esp
movl $0, %eax
leal -8(%ebp), %esp
popl %ecx
.cfi_restore 1
.cfi_def_cfa 1, 0
popl %ebx
.cfi_restore 3
popl %ebp
.cfi_restore 5
leal -4(%ecx), %esp
.cfi_def_cfa 4, 4
ret
.cfi_endproc
.LFE0:
.size main, .-main
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
.type __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
.LFB1:
.cfi_startproc
movl (%esp), %ebx
ret
.cfi_endproc
.LFE1:
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include "paramlib-04.h"
int main (void)
{
print ("Hä?", 'H', 'e', 'l', 'l', 'o', ',', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\n');
return 0;
}
#include <stdio.h>
#include "paramlib-02.h"
void print (string msg)
{
printf ("%s\n", msg);
}
typedef char string[42];
extern void print (string msg);
#include <stdio.h>
void print (int h, int e, int l1, int l2, int o1,
int comma, int space,
int w, int o2, int r, int l3, int d,
int bang, int newline)
{
printf ("%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
h, e, l1, l2, o1, comma, space, w, o2, r, l3, d, bang, newline);
}
extern void print (int h, int e, int l1, int l2, int o1,
int comma, int space,
int w, int o2, int r, int l3, int d,
int bang, int newline);
.file "paramlib-03.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%c%c%c%c%c%c%c%c%c%c%c%c%c%c"
.text
.globl print
.type print, @function
print:
.LFB11:
.cfi_startproc
subq $16, %rsp
.cfi_def_cfa_offset 24
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 32
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 40
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 48
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 56
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 64
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 72
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 80
movl 80(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 88
pushq %r9
.cfi_def_cfa_offset 96
movl %r8d, %r9d
movl %ecx, %r8d
movl %edx, %ecx
movl %esi, %edx
movl %edi, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
addq $88, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size print, .-print
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
.file "paramlib-03.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%c%c%c%c%c%c%c%c%c%c%c%c%c%c"
.text
.globl print
.type print, @function
print:
.LFB11:
.cfi_startproc
pushl %ebx
.cfi_def_cfa_offset 8
.cfi_offset 3, -8
subl $12, %esp
.cfi_def_cfa_offset 20
call __x86.get_pc_thunk.bx
addl $_GLOBAL_OFFSET_TABLE_, %ebx
pushl 72(%esp)
.cfi_def_cfa_offset 24
pushl 72(%esp)
.cfi_def_cfa_offset 28
pushl 72(%esp)
.cfi_def_cfa_offset 32
pushl 72(%esp)
.cfi_def_cfa_offset 36
pushl 72(%esp)
.cfi_def_cfa_offset 40
pushl 72(%esp)
.cfi_def_cfa_offset 44
pushl 72(%esp)
.cfi_def_cfa_offset 48
pushl 72(%esp)
.cfi_def_cfa_offset 52
pushl 72(%esp)
.cfi_def_cfa_offset 56
pushl 72(%esp)
.cfi_def_cfa_offset 60
pushl 72(%esp)
.cfi_def_cfa_offset 64
pushl 72(%esp)
.cfi_def_cfa_offset 68
pushl 72(%esp)
.cfi_def_cfa_offset 72
pushl 72(%esp)
.cfi_def_cfa_offset 76
leal .LC0@GOTOFF(%ebx), %eax
pushl %eax
.cfi_def_cfa_offset 80
call printf@PLT
addl $72, %esp
.cfi_def_cfa_offset 8
popl %ebx
.cfi_restore 3
.cfi_def_cfa_offset 4
ret
.cfi_endproc
.LFE11:
.size print, .-print
.section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
.globl __x86.get_pc_thunk.bx
.hidden __x86.get_pc_thunk.bx
.type __x86.get_pc_thunk.bx, @function
__x86.get_pc_thunk.bx:
.LFB12:
.cfi_startproc
movl (%esp), %ebx
ret
.cfi_endproc
.LFE12:
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
void print (char *Hae,
int h, int e, int l1, int l2, int o1,
int comma, int space,
int w, int o2, int r, int l3, int d,
int bang, int newline)
{
printf ("%c%c%c%c%c%c%c%c%c%c%c%c%c%c",
h, e, l1, l2, o1, comma, space, w, o2, r, l3, d, bang, newline);
}
extern void print (char *Hae,
int h, int e, int l1, int l2, int o1,
int comma, int space,
int w, int o2, int r, int l3, int d,
int bang, int newline);
.file "paramlib-04.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%c%c%c%c%c%c%c%c%c%c%c%c%c%c"
.text
.globl print
.type print, @function
print:
.LFB11:
.cfi_startproc
subq $16, %rsp
.cfi_def_cfa_offset 24
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 32
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 40
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 48
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 56
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 64
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 72
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 80
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 88
movl 88(%rsp), %eax
pushq %rax
.cfi_def_cfa_offset 96
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
addq $88, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size print, .-print
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment