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

Notizen und Beispiele: ARM- vs. x86-Architektur, 29.6.2020

parent f530e5ab
Branches
No related tags found
No related merge requests found
Showing
with 895 additions and 0 deletions
.cpu arm7tdmi
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 1
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.file "calc.c"
.text
.align 2
.global main
.syntax unified
.arm
.fpu softvfp
.type main, %function
main:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
str lr, [sp, #-4]!
sub sp, sp, #12
add r1, sp, #4
ldr r0, .L3
bl scanf
ldr r1, [sp, #4]
add r1, r1, r1, lsl #1
ldr r0, .L3+4
bl printf
mov r0, #0
add sp, sp, #12
@ sp needed
ldr lr, [sp], #4
bx lr
.L4:
.align 2
.L3:
.word .LC0
.word .LC1
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d\000"
.space 1
.LC1:
.ascii "%d\012\000"
.ident "GCC: (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]"
.file "calc.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d"
.LC1:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
subq $24, %rsp
.cfi_def_cfa_offset 32
leaq 12(%rsp), %rsi
leaq .LC0(%rip), %rdi
movl $0, %eax
call __isoc99_scanf@PLT
movl 12(%rsp), %eax
leal (%rax,%rax,2), %esi
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $24, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int main (void)
{
int a;
scanf ("%d", &a);
printf ("%d\n", 3 * a);
return 0;
}
.cpu arm7tdmi
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 1
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.file "constants-42.c"
.text
.align 2
.global main
.syntax unified
.arm
.fpu softvfp
.type main, %function
main:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
mov r1, #42
ldr r0, .L3
bl printf
mov r0, #0
pop {r4, lr}
bx lr
.L4:
.align 2
.L3:
.word .LC0
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d\012\000"
.ident "GCC: (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]"
.file "constants-42.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
movl $42, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int main (void)
{
printf ("%d\n", 42);
return 0;
}
.arch armv7-a
.eabi_attribute 28, 1
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 1
.eabi_attribute 34, 1
.eabi_attribute 18, 4
.file "constants.c"
.text
.align 1
.global main
.arch armv7-a
.syntax unified
.thumb
.thumb_func
.fpu vfpv3-d16
.type main, %function
main:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r3, lr}
movw r1, #4111
movt r1, 768
ldr r0, .L3
.LPIC0:
add r0, pc
bl printf(PLT)
movs r0, #0
pop {r3, pc}
.L4:
.align 2
.L3:
.word .LC0-(.LPIC0+4)
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d\012\000"
.ident "GCC: (Debian 8.3.0-2) 8.3.0"
.section .note.GNU-stack,"",%progbits
.cpu arm7tdmi
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 1
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.file "constants.c"
.text
.align 2
.global main
.syntax unified
.arm
.fpu softvfp
.type main, %function
main:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r1, .L3
ldr r0, .L3+4
bl printf
mov r0, #0
pop {r4, lr}
bx lr
.L4:
.align 2
.L3:
.word 50335759
.word .LC0
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d\012\000"
.ident "GCC: (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]"
.file "constants.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
movl $50335759, %esi
leaq .LC0(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int main (void)
{
printf ("%d\n", 0x0300100f);
return 0;
}
.cpu arm7tdmi
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 1
.eabi_attribute 30, 1
.eabi_attribute 34, 0
.eabi_attribute 18, 4
.file "hello.c"
.text
.align 2
.global main
.syntax unified
.arm
.fpu softvfp
.type main, %function
main:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r0, .L3
bl puts
mov r0, #0
pop {r4, lr}
bx lr
.L4:
.align 2
.L3:
.word .LC0
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "Hello, world!\000"
.ident "GCC: (15:7-2018-q2-6) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]"
.file "hello.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "Hello, world!"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
subq $8, %rsp
.cfi_def_cfa_offset 16
leaq .LC0(%rip), %rdi
call puts@PLT
movl $0, %eax
addq $8, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int main (void)
{
printf ("Hello, world!\n");
return 0;
}
.arch armv7-a
.eabi_attribute 28, 1
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 1
.eabi_attribute 34, 1
.eabi_attribute 18, 4
.file "if-5.c"
.text
.align 1
.global main
.arch armv7-a
.syntax unified
.thumb
.thumb_func
.fpu vfpv3-d16
.type main, %function
main:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
push {lr}
sub sp, sp, #12
add r1, sp, #4
ldr r0, .L5
.LPIC0:
add r0, pc
bl __isoc99_scanf(PLT)
ldr r1, [sp, #4]
cmp r1, #2
bgt .L2
adds r1, r1, #7
str r1, [sp, #4]
ldr r0, .L5+4
.LPIC1:
add r0, pc
bl printf(PLT)
ldr r1, [sp, #4]
adds r1, r1, #23
.L3:
ldr r0, .L5+8
.LPIC3:
add r0, pc
bl printf(PLT)
movs r0, #0
add sp, sp, #12
@ sp needed
ldr pc, [sp], #4
.L2:
subs r1, r1, #3
str r1, [sp, #4]
ldr r0, .L5+12
.LPIC2:
add r0, pc
bl printf(PLT)
ldr r1, [sp, #4]
adds r1, r1, #137
b .L3
.L6:
.align 2
.L5:
.word .LC0-(.LPIC0+4)
.word .LC1-(.LPIC1+4)
.word .LC3-(.LPIC3+4)
.word .LC2-(.LPIC2+4)
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d\000"
.space 1
.LC1:
.ascii "Hello, world! (%d)\012\000"
.LC2:
.ascii "Hallo, Welt! (%d)\012\000"
.space 1
.LC3:
.ascii "b = %d\012\000"
.ident "GCC: (Debian 8.3.0-2) 8.3.0"
.section .note.GNU-stack,"",%progbits
.file "if-5.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d"
.LC1:
.string "Hello, world! (%d)\n"
.LC2:
.string "Hallo, Welt! (%d)\n"
.LC3:
.string "b = %d\n"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
subq $24, %rsp
.cfi_def_cfa_offset 32
leaq 12(%rsp), %rsi
leaq .LC0(%rip), %rdi
movl $0, %eax
call __isoc99_scanf@PLT
movl 12(%rsp), %esi
cmpl $2, %esi
jg .L2
addl $7, %esi
movl %esi, 12(%rsp)
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
movl 12(%rsp), %eax
leal 23(%rax), %esi
.L3:
leaq .LC3(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $24, %rsp
.cfi_remember_state
.cfi_def_cfa_offset 8
ret
.L2:
.cfi_restore_state
subl $3, %esi
movl %esi, 12(%rsp)
leaq .LC2(%rip), %rdi
movl $0, %eax
call printf@PLT
movl 12(%rsp), %eax
leal 137(%rax), %esi
jmp .L3
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int main (void)
{
int a;
int b;
scanf ("%d", &a);
if (a < 3)
{
a += 7;
printf ("Hello, world! (%d)\n", a);
b = a + 23;
}
else
{
a -= 3;
printf ("Hallo, Welt! (%d)\n", a);
b = a + 137;
}
printf ("b = %d\n", b);
return 0;
}
.arch armv7-a
.eabi_attribute 28, 1
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.eabi_attribute 26, 2
.eabi_attribute 30, 1
.eabi_attribute 34, 1
.eabi_attribute 18, 4
.file "if.c"
.text
.align 1
.global main
.arch armv7-a
.syntax unified
.thumb
.thumb_func
.fpu vfpv3-d16
.type main, %function
main:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
push {lr}
sub sp, sp, #12
add r1, sp, #4
ldr r0, .L5
.LPIC0:
add r0, pc
bl __isoc99_scanf(PLT)
ldr r1, [sp, #4]
cmp r1, #2
ite le
addle r1, r1, #7
subgt r1, r1, #3
str r1, [sp, #4]
ldr r0, .L5+4
.LPIC1:
add r0, pc
bl printf(PLT)
movs r0, #0
add sp, sp, #12
@ sp needed
ldr pc, [sp], #4
.L6:
.align 2
.L5:
.word .LC0-(.LPIC0+4)
.word .LC1-(.LPIC1+4)
.size main, .-main
.section .rodata.str1.4,"aMS",%progbits,1
.align 2
.LC0:
.ascii "%d\000"
.space 1
.LC1:
.ascii "%d\012\000"
.ident "GCC: (Debian 8.3.0-2) 8.3.0"
.section .note.GNU-stack,"",%progbits
.file "if.c"
.text
.section .rodata.str1.1,"aMS",@progbits,1
.LC0:
.string "%d"
.LC1:
.string "%d\n"
.text
.globl main
.type main, @function
main:
.LFB11:
.cfi_startproc
subq $24, %rsp
.cfi_def_cfa_offset 32
leaq 12(%rsp), %rsi
leaq .LC0(%rip), %rdi
movl $0, %eax
call __isoc99_scanf@PLT
movl 12(%rsp), %eax
cmpl $2, %eax
leal 7(%rax), %edx
leal -3(%rax), %esi
cmovle %edx, %esi
movl %esi, 12(%rsp)
leaq .LC1(%rip), %rdi
movl $0, %eax
call printf@PLT
movl $0, %eax
addq $24, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE11:
.size main, .-main
.ident "GCC: (Debian 8.3.0-6) 8.3.0"
.section .note.GNU-stack,"",@progbits
#include <stdio.h>
int main (void)
{
int a;
scanf ("%d", &a);
if (a < 3)
a += 7;
else
a -= 3;
printf ("%d\n", a);
return 0;
}
Präsentationstermine, 29.06.2020, 11:08:43
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26.10.2020, 11:00 Uhr Mumble-Seminarraum 2, VNC-Kanal 6
fmüller
tschlorke
mdannehl
aco
imueller
pherz
sndiaye
Nachhaltigkeit bei Prozessor-Architekturen, 29.06.2020, 09:19:34
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Grobunterteilung von Prozessor-Architekturen:
- RISC (Reduced Instruction Set Computer)
Beispiel: ARM
http://infocenter.arm.com/help/index.jsp?noscript=1
http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001m/QRC0001_UAL.pdf
+ mehr Rechenleistung bei gleicher Taktfrequenz (und gleichem Stromverbrauch)
- schwieriger zu programmieren
- CISC (Complex Instruction Set Computer)
Beispiel: Intel/AMD x86
Unterschiede zwischen Intel- und ARM-Prozessoren
Assembler-Sprache: grundsätzliche Struktur
Instruction <Operand 1> <Operand 2> [...]
Operanden: Adressierungsarten
- unmittelbar
- Register
- Speicher
- indirekt
Intel-x86-Assembler, 29.06.2020, 11:56:51
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Beispiel:
- subq $8, %rsp
Instruktion: subq "subtrahiere"
q: quad word = 64 Bit
Operanden: $8, %rsp
$: unmittelbare Adressierung "die Zahl 8"
%: Register "vom Register rsp"
r: 64 Bit
sp: Stack Pointer
Achtung: Diese Symbole sind prozessorabhängig!
Im Speicher steht der Befehl in Form von Bytes:
0x0000000000001135 <+0>: 48 83 ec 08 sub $0x8,%rsp
0x0000000000001139 <+4>: 48 8d 3d c4 0e 00 00 lea 0xec4(%rip),%rdi
0x0000000000001140 <+11>: e8 eb fe ff ff callq 0x1030 <puts@plt>
0x0000000000001145 <+16>: b8 00 00 00 00 mov $0x0,%eax
0x000000000000114a <+21>: 48 83 c4 08 add $0x8,%rsp
0x000000000000114e <+25>: c3 retq
Beispiel:
48 83 ec subtrahiere 8-Bit-Zahl, erweitert zu 64 Bit, vom rsp-Register
08 die 8-Bit Zahl (unmittelbar)
Anderes Beispiel: lea 0xec4(%rip),%rdi
Instruktion: lea "load effective address"
Operanden: 0xec4(%rip),%rdi
(): indirekte Adressierung "relativ zu der Adresse in Klammern)
%: Register "Register rip" bzw. "Register rdi"
r: 64 Bit
ip: Instruction Pointer Stelle im Speicher, an der gerade
das Programm abgearbeitet wird
di: Destination Index ein Register für Zeiger
--> "Lade die 64-Bit-Adresse 0x0ec4 relativ zum rip-Register in das rdi-Register"
oder: "addiere 0x0ec4 zum rip-Register und speichere das Ergebnis im rdi-Register"
Anderes Beispiel: movl $0, %eax
Instruktion: mov "move"
l: 32 Bit
Operanden: $0, %eax
$: umittelbar die 32-Bit-Zahl 0
%: Register
e: 32 Bit
ax: 16-Bit-Akkumulator ein Register zum Rechnen
0x0000000000001145 <+16>: b8 00 00 00 00 mov $0x0,%eax
b8: 32-Bit-mov-Befehl (wenn 48 davor: 64 Bit)
00 00 00 00: die 32-Bit-Zahl 0
Was ist daran gut bzw. schlecht?
+ Assembler-Sprache für Menschen relativ gut verständlich:
"move", "add", "call", ...
+ Ein einzelner Befehl kann z.T. sehr viel bewirken, z.B. "call":
* speichere Rücksprungadresse auf dem Stack
--> Stack-Pointer wird automatisch dekrementiert
* Sprung an den Beginn der aufgerufenen Funktion
- Maschinensprache für Maschinen relativ schlecht verständlich:
0x0000000000001135 <+0>: 48 83 ec 08 sub $0x8,%rsp
0x0000000000001139 <+4>: 48 8d 3d c4 0e 00 00 lea 0xec4(%rip),%rdi
0x0000000000001140 <+11>: e8 eb fe ff ff callq 0x1030 <puts@plt>
0x0000000000001145 <+16>: b8 00 00 00 00 mov $0x0,%eax
0x000000000000114a <+21>: 48 83 c4 08 add $0x8,%rsp
0x000000000000114e <+25>: c3 retq
`---.--'
Ein Befehl besteht aus 1 bis 3 Bytes,
Operanden aus 1 bis 8 Bytes
--> Der 64-Bit-Prozessor muß den Code Byte für Byte lesen und kann ihn nicht
in 64-Bit-Blöcken lesen.
--> zusätzliche Hardware, längere Signallaufzeigen, höherer Stromverbrauch
x86-Assembler ist in sehr hohem Maße abwärtskompatibel.
Programme, die in den 1980er Jahren für einen 8086 geschrieben wurden,
sollten auf aktuellen Intel-Prozessoren ohne Änderung laufen können.
--> zusätzliche Hardware ("der alte Prozessor in der Ecke mit dabei")
ARM-Assembler, 29.06.2020, 11:56:58
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ARM-Assembler ist nur in sehr geringem Maße abwärtskompatibel.
(Sogar innerhalb von ARMv7 gibt es relevante Unterschiede, z.B. haben nicht alle
Varianten eine FPU: https://en.wikipedia.org/wiki/Comparison_of_ARMv7-A_cores)
Beispiel: mov r0, #0
Instruktion: mov "move"
grundsätzlich 32 Bit
Operanden: r0, #0
r0: Register
#: umittelbar die 32-Bit-Zahl 0
- grundsätzlich: 3 Operanden
- Register: r0 bis r12, gleichberechtigt
- spezialisierte Register:
r13 = Stack Pointer, r14 = Link Register, r15 = Instruction Pointer
- Alle ARM-Befehle sind grundsätzlich in 4 Bytes kodiert (32-Bit-Blöcke)
--> für den Prozessor schneller zu lesen, Prozessor einfacher zu bauen
und zu optimieren
Wie kann man dann die 32-Bit-Zahl 0 in einem 32-Bit-Befehl unterbringen?
--> 32-Bit-Integer werden ähnlich Fließkommazahlen mit 8-Bit-Mantisse
und 4-Bit-Exponent gespeichert, wobei der Exponent vorher verdoppelt wird.
Beispiel: 0x00020000 = 0x02 << (2 * 8)
0x01000000 = 0x01 << (2 * 12)
`--' `-'
8 Bit 4 Bit --> 12 Bit, mit denen sich die
"wichtigsten" 32-Bit-Zahlen
darstellen lassen.
Falls nicht: 32-Bit-Zahl ausrechnen
oder aus dem Speicher laden
Beispiel: constants.c: Handhabung der Zahl
- x86 lädt die Zahl unmittelbar ("$") in das esi-Register
und übergibt es an printf().
--> Die Zahl steht innerhalb des Maschinen-Codes.
- ARM lädt die Zahl aus dem Speicher.
--> Die Zahl steht innerhalb des Datensegments (globale Variable ".L3").
- ARM-Linux lädt die Zahl in 2 16-Bit-Hälften
movw: lade die unteren 16 Bit ("move word")
movt: lade die oberen 16 Bit ("move top")
Beispiel: constants.c: Handhabung des Strings "%d\n"
- x86 lädt die Speicheradresse des Strings unmittelbar ("$") in das rdi-Register
und übergibt es an printf().
--> Die Speicheradresse des Strings steht innerhalb des Maschinen-Codes.
- ARM lädt die Speicheradresse des Strings aus dem Speicher.
--> Die Speicheradresse des Strings steht innerhalb des Datensegments
(globale Zeigervariable ".L3+4").
Bedingte Ausführung von Befehlen, 29.06.2020, 13:36:53
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if (a < 3)
a += 7;
else
a -= 3;
Intel x86:
cmpl $2, %eax Variable a im eax-Register, Vergleich mit 2
leal 7(%rax), %edx lade die Speicheradresse 7 relativ zu eax nach edx
leal -3(%rax), %esi lade die Speicheradresse -3 relativ zu eax nach esi
cmovle %edx, %esi "conditional move if less or equal" edx nach esi
int less_or_equal = a <= 2;
int edx = a + 7;
int esi = a - 3;
if (less_or_equal)
esi = edx; esi wird direkt an printf() übergeben.
normal wäre gewesen:
cmpl $2, %eax
jle less_or_equal
sub $3, %eax
jmp continue
less_or_equal:
add $7, %eax
continue:
mov %eax, %esi
... printf() aufrufen
Tatsächlich wird die Variante des GCC (mit "lea" statt Additionen)
schneller abgearbeitet.
Insbesondere enthält diese Variante keine bedingten Sprung-Befehle.
(Bedingte Sprung-Befehle verringern die Effizienz von Instruction-Pipelining.)
Der Befehl "cmovle" wurde erst später eingeführt - vermutlich aus diesem Grund.
ARM:
cmp r1, #2 Variable a im r1-Register, Vergleich mit 2
ite le macht die beiden folgenden Befehle bedingt - Ersatz für
einen bedingten und einen unbedingten Spring
addle r1, r1, #7 bedingte Addition: "add if less or equal"
subgt r1, r1, #3 bedingte Subtraktion: "subtract if greater than"
Im ARM-Befehlssatz sind bedingte Befehle von vorneherein vorgesehen,
um bedingte Sprung-Befehle zu vermeiden.
(Bedingte Sprung-Befehle verringern die Effizienz von Instruction-Pipelining.)
Bei größeren "if"-Blöcken (if-5.c) besteht kein grundsätzlicher Unterschied mehr
in der Handhabung durch Intel- bzw. ARM-Prozessoren.
RISC-Prozessoren von Intel, 29.06.2020, 14:14:22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
i860 (1989), etwa zeitgleich mit i486 (CISC)
- i486: 10 bis 40 Takte für 1 Befehl
- i860: 1 bis 3 Befehle pro Takt, inkompatibel zu x86-Architektur
- gemessen (Mandelbrot-Menge): bei niedrigerer Taktfrequenz (40 MHz) ist der i860
ca. 6.5mal so schnell wie der i486 (66 MHz)
--> hat sich nicht durchgesetzt
ia-64 (Itanium, Ende 1990er Jahre)
- 64-Bit-RISC-Architektur
- inkompatibel zu x86-Architektur
--> hat sich nicht durchgesetzt
amd-64
- von AMD konzipierter 64-Bit-Nachfolger der x86-Architektur
- abwärtskompatibel zu x86-Architektur
--> hat sich durchgesetzt
Datenschutz-Grundverordnung (DSGVO), 29.06.2020, 14:23:41
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Aktueller Artikel: https://www.heise.de/-4794446
- Vereinheitlichung der Datenschutzverordnungen der Mitgliedsstaaten,
- Deutschland: Bundesdatenschutzgesetz, aber wenig Sanktionsmöglichkeiten
--> wurde nicht befolgt
- Bundesregierung war wenig begeistert von der DSGVO
--> Deutschland wurde schlecht vorbereitet
- Neu: explizites Recht auf Korrektur/Löschung/Übertragung von Daten
- Problem: kleinere Unternehmen haben oft Probleme, die DSGVO korrekt umzusetzen
--> Abmahnungen möglich
--> Man darf die Daten verarbeiten, wenn man ein berechtigtes Interesse daran hat
und dieses auch transparent macht.
--> Zusätzlicher Bürokratie-Aufwand erstickt viele private Kleinstinitiativen.
Dadurch wird das Internet immer stärker zentralisiert.
Upload-Filter, 29.06.2020, 14:45:57
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Das Problem ist weiterhin aktuell!
- Es wird z.Zt. diskutiert ob das Gesetz zur Bekämpfung von Rechtsextremismus und
Haßkriminalität (Netzwerkdurchsetzungsgesetz) auch Upload-Filter bekommen soll.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment