diff --git a/20210114/pull-down-widerstand.png b/20210114/pull-down-widerstand.png new file mode 100644 index 0000000000000000000000000000000000000000..3bb39aba9aef4c9e20af37078c00c65395347e7c Binary files /dev/null and b/20210114/pull-down-widerstand.png differ diff --git a/20210114/pull-up-kurzschluss.png b/20210114/pull-up-kurzschluss.png new file mode 100644 index 0000000000000000000000000000000000000000..c46e8af0f82ae804b3533d5d9f790125ee330a31 Binary files /dev/null and b/20210114/pull-up-kurzschluss.png differ diff --git a/20210114/pull-up-pull-down-widerstaende.xcf.gz b/20210114/pull-up-pull-down-widerstaende.xcf.gz new file mode 100644 index 0000000000000000000000000000000000000000..6de47102589e3bf76089bc42397388183d077ac3 Binary files /dev/null and b/20210114/pull-up-pull-down-widerstaende.xcf.gz differ diff --git a/20210114/pull-up-widerstand-intern.png b/20210114/pull-up-widerstand-intern.png new file mode 100644 index 0000000000000000000000000000000000000000..b30258e23cb31aef227e982a7911f5fc7223d8c7 Binary files /dev/null and b/20210114/pull-up-widerstand-intern.png differ diff --git a/20210114/pull-up-widerstand.png b/20210114/pull-up-widerstand.png new file mode 100644 index 0000000000000000000000000000000000000000..cce8f393763a0364d793953295b5b9322f288681 Binary files /dev/null and b/20210114/pull-up-widerstand.png differ diff --git a/20210121/alignment-1.c b/20210121/alignment-1.c new file mode 100644 index 0000000000000000000000000000000000000000..815b4562a8f1c4aac3dac5ff3ddc3f5452bbaee7 --- /dev/null +++ b/20210121/alignment-1.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <stdint.h> + +int main (void) +{ + uint8_t a = 42; + uint16_t b = 1117; + uint8_t c = 23; + printf ("a = %d, b = %d, c = %d\n", a, b, c); +} diff --git a/20210121/alignment-2.c b/20210121/alignment-2.c new file mode 100644 index 0000000000000000000000000000000000000000..23de308c39c5f7301c7c8b90c0078a003de21bd0 --- /dev/null +++ b/20210121/alignment-2.c @@ -0,0 +1,14 @@ +#include <stdio.h> +#include <stdint.h> + +int main (void) +{ + uint8_t a = 42; + uint16_t b = 1117; + uint8_t c = 23; + printf ("a = %d, b = %d, c = %d\n", a, b, c); + a = 0; + b = 0; + c = 0; + printf ("a = %d, b = %d, c = %d\n", a, b, c); +} diff --git a/20210121/alignment-3.c b/20210121/alignment-3.c new file mode 100644 index 0000000000000000000000000000000000000000..6a7dd0a3c8debd1fdc0e06912d0895820c08311c --- /dev/null +++ b/20210121/alignment-3.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <stdint.h> + +int main (void) +{ + uint8_t a = 42; + uint16_t b = 1117; + uint8_t c = 23; + printf ("a = %d, b = %d, c = %d\n", a, b, c); + uint32_t *p = &a; + *p = 0; + printf ("a = %d, b = %d, c = %d\n", a, b, c); +} diff --git a/20210121/alignment-4.c b/20210121/alignment-4.c new file mode 100644 index 0000000000000000000000000000000000000000..e073043765778ba75a1a002b5e86a672f1e03cea --- /dev/null +++ b/20210121/alignment-4.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <stdint.h> + +int main (void) +{ + uint8_t a = 42; + uint16_t b = 1117; + uint8_t c = 23; + printf ("a = %d, b = %d, c = %d\n", a, b, c); + uint32_t *p = (uint32_t *) &a; + *p = 0; + printf ("a = %d, b = %d, c = %d\n", a, b, c); +} diff --git a/20210121/alignment-5-32.s b/20210121/alignment-5-32.s new file mode 100644 index 0000000000000000000000000000000000000000..d4df40706c2e1e59bd3c15f2df1cba1bebafb722 --- /dev/null +++ b/20210121/alignment-5-32.s @@ -0,0 +1,83 @@ + .file "alignment-5.c" + .text + .section .rodata +.LC0: + .string "a = %d, b = %d, c = %d\n" + .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 + subl $16, %esp + call __x86.get_pc_thunk.bx + addl $_GLOBAL_OFFSET_TABLE_, %ebx + movb $42, -17(%ebp) # #include <stdio.h> + movw $1117, -10(%ebp) # #include <stdint.h> + movb $23, -11(%ebp) # + movzbl -11(%ebp), %ecx # int main (void) + movzwl -10(%ebp), %edx # { + movzbl -17(%ebp), %eax # uint8_t a = 42; + movzbl %al, %eax # uint16_t b = 1117; + pushl %ecx # uint8_t c = 23; + pushl %edx # printf ("a = %d, b = %d, c = %d\n", a, b, c); + pushl %eax # uint64_t *p = (uint64_t *) &a; + leal .LC0@GOTOFF(%ebx), %eax # *p = 0; + pushl %eax # printf ("a = %d, b = %d, c = %d\n", a, b, c); + call printf@PLT # } + addl $16, %esp + leal -17(%ebp), %eax + movl %eax, -16(%ebp) + movl -16(%ebp), %eax + movl $0, (%eax) + movl $0, 4(%eax) # -9 \ b + movzbl -11(%ebp), %ecx # -10 / -. + movzwl -10(%ebp), %edx # -11 - c | + movzbl -17(%ebp), %eax # -12 | + movzbl %al, %eax # -13 } auf 0 gesetzt + pushl %ecx # -14 | + pushl %edx # -15 | + pushl %eax # -16 | + leal .LC0@GOTOFF(%ebx), %eax # -17 - a -' + pushl %eax + call printf@PLT + addl $16, %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 diff --git a/20210121/alignment-5.c b/20210121/alignment-5.c new file mode 100644 index 0000000000000000000000000000000000000000..913c5c8a81eedddf8463acee10262875bd6c84d7 --- /dev/null +++ b/20210121/alignment-5.c @@ -0,0 +1,13 @@ +#include <stdio.h> +#include <stdint.h> + +int main (void) +{ + uint8_t a = 42; + uint16_t b = 1117; + uint8_t c = 23; + printf ("a = %d, b = %d, c = %d\n", a, b, c); + uint64_t *p = (uint64_t *) &a; + *p = 0; + printf ("a = %d, b = %d, c = %d\n", a, b, c); +} diff --git a/20210121/answer-32.s b/20210121/answer-32.s new file mode 100644 index 0000000000000000000000000000000000000000..d8649e6678dfed4bb2abeb06533fa123c195c861 --- /dev/null +++ b/20210121/answer-32.s @@ -0,0 +1,68 @@ + .file "answer.c" + .text + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "%d\n" + .text + .globl main + .type main, @function +main: +.LFB11: + .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 # #include <stdio.h> + movl %esp, %ebp # + pushl %ebx # int answer = 23; + pushl %ecx # + .cfi_escape 0xf,0x3,0x75,0x78,0x6 # int main (void) + .cfi_escape 0x10,0x3,0x2,0x75,0x7c # { + call __x86.get_pc_thunk.bx # answer += 19; + addl $_GLOBAL_OFFSET_TABLE_, %ebx # printf ("%d\n", answer); + movl answer@GOTOFF(%ebx), %eax # return 0; + addl $19, %eax # } + movl %eax, answer@GOTOFF(%ebx) + subl $8, %esp + pushl %eax + leal .LC0@GOTOFF(%ebx), %eax + pushl %eax + call printf@PLT + addl $16, %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 +.LFE11: + .size main, .-main + .globl answer + .data + .align 4 + .type answer, @object + .size answer, 4 +answer: + .long 23 + .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 diff --git a/20210121/answer.c b/20210121/answer.c new file mode 100644 index 0000000000000000000000000000000000000000..2da5fc39c50955e3ac5588d12fa1ca6d9ac949eb --- /dev/null +++ b/20210121/answer.c @@ -0,0 +1,10 @@ +#include <stdio.h> + +int answer = 23; + +int main (void) +{ + answer += 19; + printf ("%d\n", answer); + return 0; +} diff --git a/20210121/answer.disassemble b/20210121/answer.disassemble new file mode 100644 index 0000000000000000000000000000000000000000..d5682bdc46f53067217941a2fdc00d082637b515 --- /dev/null +++ b/20210121/answer.disassemble @@ -0,0 +1,16 @@ +(gdb) disassemble /r main +Dump of assembler code for function main: + 0x0000000000001135 <+0>: 48 83 ec 08 sub $0x8,%rsp + 0x0000000000001139 <+4>: 8b 05 f1 2e 00 00 mov 0x2ef1(%rip),%eax # 0x4030 <answer> + 0x000000000000113f <+10>: 8d 70 13 lea 0x13(%rax),%esi + 0x0000000000001142 <+13>: 89 35 e8 2e 00 00 mov %esi,0x2ee8(%rip) # 0x4030 <answer> + 0x0000000000001148 <+19>: 48 8d 3d b5 0e 00 00 lea 0xeb5(%rip),%rdi # 0x2004 + 0x000000000000114f <+26>: b8 00 00 00 00 mov $0x0,%eax + 0x0000000000001154 <+31>: e8 d7 fe ff ff callq 0x1030 <printf@plt> + 0x0000000000001159 <+36>: b8 00 00 00 00 mov $0x0,%eax + 0x000000000000115e <+41>: 48 83 c4 08 add $0x8,%rsp + 0x0000000000001162 <+45>: c3 retq +End of assembler dump. + + ^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ + Maschinensprache Assembler diff --git a/20210121/answer.s b/20210121/answer.s new file mode 100644 index 0000000000000000000000000000000000000000..69cf9a26f4abc713b067f4231c831f80fd3a7e31 --- /dev/null +++ b/20210121/answer.s @@ -0,0 +1,35 @@ + .file "answer.c" + .text + .section .rodata.str1.1,"aMS",@progbits,1 +.LC0: + .string "%d\n" + .text + .globl main + .type main, @function +main: +.LFB11: + .cfi_startproc + subq $8, %rsp + .cfi_def_cfa_offset 16 # #include <stdio.h> + movl answer(%rip), %eax # + leal 19(%rax), %esi # int answer = 23; + movl %esi, answer(%rip) # + leaq .LC0(%rip), %rdi # int main (void) + movl $0, %eax # { + call printf@PLT # answer += 19; + movl $0, %eax # printf ("%d\n", answer); + addq $8, %rsp # return 0; + .cfi_def_cfa_offset 8 # } + ret + .cfi_endproc +.LFE11: + .size main, .-main + .globl answer + .data + .align 4 + .type answer, @object + .size answer, 4 +answer: + .long 23 + .ident "GCC: (Debian 8.3.0-6) 8.3.0" + .section .note.GNU-stack,"",@progbits