Assembleur
Pentium
Pr´ esentation du Pentium http://developer.intel.com/design/pentium4/manuals/ ..
Premi`ere ann´ee
2003
2
Assembleur 0001
The table below shows the dramatic increases in performance and transistor count of the IA processors over their history, as predicted by Moore’s Law, and also summarizes the evolution of other key features of the architecture.
Pentium
Table 2-1. Processor Performance Over Time and Other Intel Architecture Key Features Date of Product Introduction
Perform -ance in MIPs1
Max. CPU Frequency at Introduction
8086
1978
0.8
8 MHz
Intel 286
1982
2.7
Intel386™ DX
1985
Intel486™ DX
No. of Transis -tors on the Die
Main CPU Register Size2
Extern. Data Bus Size2
Max. Extern. Addr. Space
Caches in CPU Package3
29 K
16
16
1 MB
None
12.5 MHz
134 K
16
16
16 MB
Note 3
6.0
20 MHz
275 K
32
32
4 GB
Note 3
1989
20
25 MHz
1.2 M
32
32
4 GB
8KB L1
Pentium®
1993
100
60 MHz
3.1 M
32
64
4 GB
16KB L1
Pentium® Pro
1995
440
200 MHz
5.5 M
32
64
64 GB
16KB L1; 256KB or 512KB L2
Pentium II®
1997
466
266
7M
32
64
64 GB
32KB L1; 256KB or 512KB L2
Pentium® III
1999
1000
500
8.2 M
32 GP 128 SIMD-FP
64
64 GB
32KB L1; 512KB L2
Intel Processor
0004
0003
0005
NOTES: 1. Performance here is indicated by Dhrystone MIPs (Millions of Instructions per Second) because even 2003though MIPs are no longer considered a preferred measure of CPU performance, they are the only benchmarks that span all six generations of the IA. The MIPs and frequency values given here correspond to the maximum CPU frequency available at product introduction. 0002
Premi`ere ann´ee
2. Main CPU register size and external data bus size are given in bits. Note also that there are 8 and 16-bit
3
Assembleur
Pentium Architectural Features
0002
Figure 2-1. Embedded Pentium® Processor Block Diagram
0011
0010
Control
DP Logic4
Branch Prefetch Target Buffer Address
TLB Code Cache 16 Kbytes1
0011
0007
0012
1283
Prefetch Buffers
Instruction Pointer
64-Bit Data Bus
Bus Unit 0014
Control ROM
Instruction Decode
Branch Verification and Target Address Control Unit 0015
000e
Page Unit 0015
V-Pipeline Connection U-Pipeline Connection
Floating Point Unit
Address Address Generate Generate (U Pipeline) (V Pipeline)
MMX™ Technology Unit2
32-Bit Address Bus
Control
Integer Register File
64-Bit 64 Data Bus 0013
ALU (U Pipeline) 32 32-Bit Addr. Bus
ALU (V Pipeline)
Control Register File Add Divide
Barrel Shifter
0013
80 Multiply 80
Data 000f
APIC5
0013 0013
Control 0013
0013
32
32
32
Data Cache 16 Kbytes1
32
0013
0013
TLB
32
32
A6105-01
NOTES: 1. The Code and Data caches are each 8 Kbytes in size on the embedded Pentium® processor (at 100/133/166 MHz). 2. The MMX Technology Unit is present only on the embedded Pentium processor with MMX™ technology. 3. The internal instruction bus is 256 bits wide on the embedded Pentium processor. 4. Dual processing is not present on the embedded Pentium processor with Voltage Reduction Technology or the low-power embedded Pentium processor with MMX technology. 5. The APIC is not present on the embedded Pentium proces sor with Voltage Reduction Technology. 0003
0004
0005
Premi`ere ann´ee
2003 0001
0006
The dual processor configuration allows two embedded Pentium processors to share a single L2 cache for a low-cost symmetric multi-processor system. The two processors appear to the system as a single embedded Pentium processor. Multiprocessor operating systems properly schedule
4
•
Memory pointers
Although all of these registers are available for general storage of operands, results, and pointers, caution should be used when referencing the ESP register. The ESP register holds the stack pointer and as a general rule should not be used for any other purpose. 0001
Assembleur 0002
31
General-Purpose Registers
Pentium
0 EAX EBX ECX EDX ESI EDI EBP ESP
Segment Registers 0 15 CS DS SS ES FS GS 31
Status and Control Registers
0 EFLAGS
31
0 EIP
Figure 3-3. Application Programming Registers
Many instructions assign specific registers to hold operands. For example, string instructions use the contents of the ECX, ESI, and EDI registers as operands. When using a segmented 2003 memory model, some instructions assume that pointers in certain registers are relative to 0003
0004
Premi`ere ann´ee
0005
5
Programmation Assembleur format ATT- GNU http://www.gnu.org/manual/ ..
Assembleur
Format d’une instruction assembleur (gnu ATT)
´ etiquette:
mn´ emonique
op´ erandes
Pentium
#commentaires
• ´ etiquette: adresse effective de l’instruction, utile pour les branchements • mn´ emonique nom g´en´erique donn´e ` a une instruction : ADD, JUMP.. • op´ erandes arguments de l’instruction : 0, 1 ou 2 • #commentaires non pris en compte au moment de l’assemblage
Premi`ere ann´ee
2003
7
Assembleur
Type des op´ erandes
op´erande 1 : source registre
Premi`ere ann´ee
2003
Pentium
op´erande 2 : destination registre
imm´ediat
registre
m´emoire
registre
registre
m´emoire
imm´ediat
m´emoire
8
register set found in the 8086 and Intel 286 processors and can be referenced with the names AX, BX, CX, DX, BP, SP, SI, and DI. Each of the lower two bytes of the EAX, EBX, ECX, and Assembleur Pentium EDX registers can be referenced by the names AH, BH, CH, and DH (high bytes) and AL, BL, CL, and DL (low bytes).
0007
0004
31
General-Purpose Registers 8 7 16 15
16-bit
32-bit
AL
AX
EAX
BH
BL
BX
EBX
CH
CL
CX
ECX
DH
DL
DX
EDX
0
AH
BP
EBP
SI
ESI
DI
EDI
SP
ESP
Figure 3-4. Alternate General-Purpose Register Names
3.6.2. 0001
Segment Registers
The segment registers (CS, DS, SS, ES, FS, and GS) hold 16-bit segment selectors. A segment selector is a special pointer that identifies a segment in memory. To access a particular segment
Premi`ere ann´ee
2003
9
Assembleur
Les modes d’adressages de la m´ emoire
Pentium
• absolu => 0x8049514 • registre indirecte : ∗ base => (%eax) ∗ base + d´eplacement=> 4(%eax) ∗ base + index * pas + d´eplacement => dep(base,index,scale) =>4(%eax,%ebx,2)
Premi`ere ann´ee
2003
10
• 0005
Scale factor—A value of 2, 4, or 8 that is multiplied by the index value.
The offset which results from adding these components is called an effective address. Pentium Each of modes either a positived’adressages or negative (2s complement) value, with the excepthese components can haveLes tion of the scaling factor. Figure 5-6 shows all the possible ways that these components can be combined to create an effective address in the selected segment.
Assembleur 0007
0007
0004
0006
Base
Index
EAX EBX ECX EDX ESP EBP ESI EDI
EAX EBX ECX EDX EBP ESI EDI
+
*
Scale
Displacement
1
None
2
8-bit
+
3
16-bit
4
32-bit
Offset = Base + (Index ∗ Scale) + Displacement
Figure 5-6. Offset (or Effective Address) Computation 0001
The uses of general-purpose registers as base or index components are restricted in the following manner:
• The ESP register cannot be used as an index register. Premi`ere ann´ee 2003 • When the ESP or EBP register is used as the base, the SS segment is the default segment.11 0001
In all other cases, the DS segment is the default segment.
Assembleur
Types des instructions
Pentium
• Transfert : mouvement de donn´ees, MOV •
Arithm´etique et logique : ADD, AND..
•
Contrˆ ole : ∗ saut conditionnel ∗ appel de proc´edure
•
Interruption : en g´en´eral : int num´ero de 0 ` a 255
Premi`ere ann´ee
2003
12
All Intel Architecture instruction encodings are subsets of the general instruction format shown in Figure 2-1. Instructions consist of optional instruction prefixes (in any order), one or two Assembleurprimary opcode bytes, an addressing-form specifier (if required) consisting of the ModR/M byte (Scale-Index-Base) byte, a displacement (if required), and an immediate and sometimes the SIB Format d’une instruction machine data field (if required). 0001
0002
Pentium
0003
0004
Instruction Prefixes
Opcode
ModR/M
SIB
Displacement
Immediate
Up to four prefixes of 1-byte each (optional)
1 or 2 byte opcode
1 byte (if required)
1 byte (if required)
Address displacement of 1, 2, or 4 bytes or none
Immediate data of 1, 2, or 4 bytes or none
32
7
3 2
7
65 Mod
Reg/ Opcode
0 R/M
6 5
Scale
0005
Index
0005
0 Base
Figure 2-1. Intel Architecture Instruction Format
2.2. INSTRUCTION PREFIXES • longueur d’une instruction de un `a 16 octets The instruction prefixes are divided into four groups, each with a set of allowable prefix codes:
•
Lock and repeat prefixes. — F0H—LOCK prefix. — F2H—REPNE/REPNZ prefix (used only with string instructions).
Premi`ere ann´ee
—2003F3H—REP prefix (used only with string instructions). — F3H—REPE/REPZ prefix (used only with string instructions).
13
Assembleur
Structure d’un programme : les segments
Pentium
• A l’origine un programme comportait au moins trois segments associ´es `a des registres (16 bits): ∗ code : CS EIP => .text ∗ donn´ees : DS => .data ∗ pile : SS ESP=> .bss • La gestion de la m´emoire est fortement li´ee au syst`eme d’exploitation. Elle peut ˆetre de deux types : segment´ee (8086 avec msdos) ou pagin´ee (linux), l’utilisation des regitres ”segment” pour l’adressage physique d´epend de cette gestion (voir doc Pentium http://developer.intel.com/design/pentium4/manuals/).
Premi`ere ann´ee
2003
14
Assembleur
Structure d’un programme :
Pentium
.data bonjour: .string 'hello world!n' taille: .long . - bonjour .text .globl main main: ## appel syst` eme de write () movl $4, %eax # write () system call movl $1,%ebx # %ebx = 1, fd = stdout leal bonjour, %ecx # %ecx ---> bojour movl taille, %edx # %edx = count int $0x80 # execute write () system call
Premi`ere ann´ee
2003
15
Assembleur
Premi`ere ann´ee
Pentium
## appel syst` eme de exit () xorl %eax, %eax # %eax = 0 incl %eax # %eax = 1 system call _exit () xorl %ebx, %ebx # %ebx = 0 normal program return code int $0x80 # execute system call _exit ()
2003
16
Assembleur
Structure d’un programme : les donn´ ees
• directives :
• valeurs :
Premi`ere ann´ee
2003
.byte .word .long .quad .ascii .string binaire octal d´ecimal hexad´ecimal d´ecimal r´eel ASCII
Pentium
octet : 8 bits mot : 16 bits double mot : 32 bits 64 bits caract`ere ou chaˆıne chaˆıne de caract`eres termin´ee par 0 001110 012345670 1234567890 0x123456789ABCDEF 0f 120.121e-15 ”..”
17
Programmation Assembleur Les instructions .. ..
Assembleur
Pentium
Instructions de tranfert : mov
mov?
Source,
Destination
• Destination et Source : registres, variables, adresses • Source : imm´ediat
movw
$36,
%eax
36 → eax
movl
%ebx,
%eax
ebx
Premi`ere ann´ee
2003
....?....
.....12.....
..36.....
→ eax
.....12.....
19
Assembleur
Instructions de tranfert : mov
Pentium
0x8014 0c020381 → eax 8103020c
movl
(0x8014), %eax
movw
(%ebx), %ax
movb
$5, (%ebx)
ebx 00000012 → 0x12 05??
movw
$2, (%ebx)
ebx 00000012 → 0x12 0200
movl
5(%ebx,%esi,1), %eax
( ebx 00000012 ) 1201 → eax ????0112
( ebx 00000012 esi 00000003 ) 20 0510e1a2 ) → eax a2e11005
Premi`ere ann´ee
2003
20
Assembleur
xchg
Instructions de tranfert : XCHG, LEA
Source,
Pentium
Destination
´echange le contenu de Destination et de Source lea
M´emoire ,
Registre
Chargement d’une adresse effective .data table toto
.fill .long
9 0x1a
2
5; neuf 5 sur des mots de 2 octets ; adresse donnee + 18
lea toto , %eax eax 00000012 Alors que movl toto, %eax, eax 0000001a
Premi`ere ann´ee
2003
21
Assembleur
Instructions de tranfert : propre au pentium
movsx
Destination,
Pentium
Source
avec MOV la source et la destination sont de mˆeme type ici, la source peut ˆetre d’un type plus petit SX, signe extension, le signe de la source est conserv´e movsx %al,%ebx al a3 → ebx ffffffa3 movzx
Source
Destination,
ZX, zero extension, movzx %al ,ebx
Premi`ere ann´ee
2003
al a3
→ ebx 000000a3
22
Programmation Assembleur Instructions arithm´ etiques http://www.gnu.org/manual/ ..
Assembleur
L’addition
add
Source,
Pentium
Destination
• Destination + Source → Destination • Source : imm´ediat, registre, m´emoire • Destination : registre, m´emoire • op´erandes : nombres sign´es ou non sign´es • flag : OF, SF, ZF, AF, CF, et PF
Premi`ere ann´ee
2003
24
Assembleur
addl
L’addition (exemple)
%eax,
Pentium
%ebx
eax 00001113 +ebx 000000a9 →ebx 000011bc OF 0
eflags
SF 0
ZF 0
0 0
AF 0
0 0
PF 0
1 1
CF 0
eax 00001113 +ebx f f f f f f f f →ebx 00001112 OF 0
eflags
SF 0
ZF 0
0 0
AF 1
0 0
PF 1
1 1
CF 1
eax f f f f 1113 +ebx a00000a9 →ebx 9f f f 11bc Premi`ere ann´ee
2003
25
Assembleur
Pentium
OF 0
SF 1
ZF 0
0 0
AF 0
0 0
PF 0
1 1
CF 1
eax f f f f 1113 +ebx f f f f f f f f →ebx f f f f 1112 OF 0
SF 1
ZF 0
0 0
AF 1
0 0
PF 1
1 1
CF 1
eax a0000013 +ebx 800000a9 →ebx 200000bc OF 1
Premi`ere ann´ee
2003
SF 0
ZF 0
0 0
AF 0
0 0
PF 0
1 1
CF 1
26
Assembleur
La soustraction
sub
Source,
Pentium
Destination
• Destination − Source → Destination • Source : imm´ediat, registre, m´emoire • Destination : registre, m´emoire • op´erandes : nombres sign´es ou non sign´es • flag : OF, SF, ZF, AF, CF, et PF
Premi`ere ann´ee
2003
27
Assembleur
Incr´ ementer - D´ ecr´ ementer
inc
Destination
dec
Destination
Pentium
• inc :Destination + 1 → Destination • dec : Destination − 1 → Destination • Destination : registre, m´emoire • flag : OF, SF, ZF, AF et PF, par contre CF n’est pas modifi´e
Premi`ere ann´ee
2003
28
Assembleur
La multiplication
mul Operand Size Byte Word Doubleword
Source 1 AL AX EAX
Source 2 r/m8 r/m16 r/m32
Pentium
Source 2 Destination AX DX:AX EDX:EAX
• Source 1 ∗ Source 2 → Destination • Source 2 : registre, m´emoire • Source 1 : registre AL, AX, EAX • Destination : registre AX, DX:AX, EDX:EAX Premi`ere ann´ee
2003
29
Assembleur
• op´erandes : non sign´es
Pentium
• flag : OF et CF flags sont mis `a 0 si la partie haute du r´esultat est nulle, sinon ils sont mis `a 1. SF, ZF, AF, et PF ne sont pas d´efinis.
Premi`ere ann´ee
2003
30
Assembleur
La multiplication sign´ ee
•
imul
Pentium
Source 2
Source 2 (reg or mem) ∗ AL, AX, or EAX register → AX, DX:AX, or EDX:EAX. CF et OF = 0 si le r´esultat tient dans la partie basse, sinon CF et OF = 1. •
imul
Source
Destination
Destination (register) ∗ Source (register or memory or imm´ediat) → Destination •
imul
Source 1
Source 2
Destination
Source 1 (register or memory) ∗ Source 2 (imm´ediat) → Destination (register) • Immediate value is sign-extended to the length of the destination operand format. Premi`ere ann´ee
2003
31
Assembleur
Pentium
La division
div Operand Size Word/byte Doublew/word Quadw/doublew
Dividende AX DX:AX EDX:EAX
Diviseur r/m8 r/m16 r/m32
Diviseur Quotient AL AX EAX
Reste AH DX EDX
Max Quotient 255 65, 535 232 − 1
• Dividende = Diviser ∗ Quotient + Reste
Premi`ere ann´ee
2003
32
Assembleur
La division (suite)
Pentium
• Dividende : AX, DX:AX, EDX:EAX • Diviseur: regitre ou m´emoire • Quotient : AL, AX ou EAX • Rest : AH, DX ou EDX • The CF, OF, SF, ZF, AF, and PF flags are undefined. • Si Quotient trop gros pour AL, AX ou EAX, alors interruption
Premi`ere ann´ee
2003
33
Assembleur
Pentium
La division sign´ ee
idiv Operand Size Word/byte Doublew/word Quadw/doublew
Dividende AX DX:AX EDX:EAX
Diviseur r/m8 r/m16 r/m32
Diviseur Quotient AL AX EAX
Reste AH DX EDX
Quotient Range −128 to +127 −215 to 215 − 1 −231 to 231 − 1
• Dividende = Diviseur ∗ Quotient + Reste
Premi`ere ann´ee
2003
34
Assembleur
La division sign´ ee (suite)
Pentium
• Dividende, Diviseur, Quotient , Reste : comme DIV • The CF, OF, SF, ZF, AF, and PF flags are undefined. • The sign of the remainder is always the same as the sign of the dividend. • absolute value of remainder < absolute value of divisor.
Premi`ere ann´ee
2003
35
Assembleur
Extension de signe
Pentium
• cbw : extension sign´ee de AL → AX • cwde : extension sign´ee de AX → EAX • cwd : extension sign´ee de AX → DX:AX • cdq : extension sign´ee de EAX → EDX/EAX • CF, OF, SF, ZF, AF, and PF flags are undefined.
Premi`ere ann´ee
2003
36
Assembleur
Autres op´ erateurs
•
adc
Source ,
Pentium
Destination
Destination + Source + CF → Destination •
sbb
Source,
Destination
Destination − (Source + CF ) → Destination • Source : imm´ediat, registre, m´emoire • Destination : registre, m´emoire • flag : OF, SF, ZF, AF, CF, et PF
Premi`ere ann´ee
2003
37
Assembleur
Op´ erateurs Logiques
•
and
Source,
Pentium
Destination
Destination AN D Source → Destination •
or
Source,
Destination
Destination OR Source → Destination •
xor
Source,
Destination
Destination XOR Source → Destination
Premi`ere ann´ee
2003
38
Assembleur
Op´ erateurs Logiques (suite)
Pentium
• The OF and CF flags are cleared; • the SF, ZF, and PF flags are set according to the result. • The state of the AF flag is undefined. • NOT Source : compl´ement `a un
Premi`ere ann´ee
2003
39
Assembleur
D´ ecalages
•
shl sal
Source, Source,
Pentium
Destination Destination
CF X ← Destination ← 0 ⇒ CF D ← estination0 •
shr sar
Source, Source,
SHR 0 → DestinatioN → CF X SAR
DestinatioN → CF X
Destination Destination
⇒ 0Destinatio → CF N
⇒ DDestinatio → CF N
• Source : CL ou imm´ediat, au plus 31 Destination, : registre ou m´emoire Premi`ere ann´ee
2003
40
Assembleur
Rotations rol ror rcl rcr
• ROL : CF X ← Destination • ROR
Source, Source, Source, Source,
Destination Destination Destination Destination
⇒ CF D ← estinationD
DestinatioN → CF X
⇒ NDestinatio → CF N
• RCL : CF X ← Destination
⇒ CF D ← estinationX
• RCR
DestinatioN → CF X
Pentium
⇒ XDestinatio → CF N
• Source : CL ou imm´ediat, au plus 31 Destination, : registre ou m´emoire Premi`ere ann´ee
2003
41
Les branchements Programmation Assembleur Jean-Claude Bajard IUT - universit´e Montpellier 2
Assembleur
Instructions de pr´ eparation
CMP
Source,
Pentium
Destination
• Destination, : registre, m´emoire • Source : registre, m´emoire , imm´ediat • effectue Destination - Source : sans affecter Destination • flag : OF, SF, ZF, AF, CF, et PF
Premi`ere ann´ee
2003
43
Assembleur
Instructions de pr´ eparation
TEST
Source,
Pentium
Destination
• Destination, : registre, m´emoire • Source : registre, m´emoire , imm´ediat • effectue Destination AND Source : sans affecter Destination • flag : OF=0, SF, ZF, AF, CF=0, et PF
Premi`ere ann´ee
2003
44
Assembleur
Les Sauts
Pentium
Deux cat´egories • Saut inconditionnel JMP
Adresse
• Saut conditionnel Jcc
Adresse
cc repr´esente la condition
Premi`ere ann´ee
2003
45
Assembleur
Les Sauts (suite)
Pentium
• Adresse d´eplacement relatif `a EIP • Adresse g´en´eralement une ´etiquette dans le code • Jcc ne supporte pas les sauts lointains Exemple: si nous ne pouvons pas faire le saut suivant JZ FARLABEL; alors on le remplace par JNZ BEYOND; JMP FARLABEL; BEYOND:
Premi`ere ann´ee
2003
46
Assembleur
Les conditions
Instruction Mnemonic Unsigned Conditional Jumps JA/JNBE JAE/JNB JB/JNAE JBE/JNA JC JE/JZ JNC JNE/JNZ JNP/JPO JP/JPE JCXZ JECXZ Premi`ere ann´ee
Pentium
2003
Condition (Flag States)
Description
(CF and ZF)=0 CF=0 CF=1 (CF or ZF)=1 CF=1 ZF=1 CF=0 ZF=0 PF=0 PF=1 CX=0 ECX=0
Avant/non apr`es ou egal Avant ou ´egal/non apr`es Apr`es/non avant ou egal Apr`es ou ´egal/non avant retenue egal/nul pas de retenue Non ´egal/non nul Non pair/parit´e impaire Pair/parit´e paire Registre CX est zero Registre ECX est zero 47
Assembleur
Les conditions (suite)
Instruction Mnemonic Signed Conditional Jumps JG/JNLE JGE/JNL JL/JNGE JLE/JNG JNO JNS JO JS
Premi`ere ann´ee
2003
Pentium
Condition (Flag States)
Description
((SF xor OF) or ZF) =0 (SF xor OF)=0 (SF xor OF)=1 ((SF xor OF) or ZF)=1 OF=0 SF=0 OF=1 SF=1
Plus grand/no plus petit ou ´egal Plus grand ou ´egal/non plus petit Plus petit/non plus grand ou ´egal Plus petit ou ´egal/non plus grand Non overflow Non signe (non-negatif) Overflow Signe (negatif)
48
Assembleur
Si ??? Alors .. Sinon ..
Exemple .. suite 1 .. Si
Traduction
A
Alors:
Sinon suite 3 .. .. suite 4 ..
Premi`ere ann´ee
Pentium
2003
Sinon: Finsi:
.. suite 1 .. MOV CMP JNL suite 2 .. JMP suite 3 .. .. suite 4 ..
$A,%EAX $B,%EAX Sinon
Finsi
49
Assembleur
Faire..Tant que ???
Traduction
Exemple .. suite 1 .. Faire
Tant que .. suite 3 ..
Premi`ere ann´ee
Pentium
2003
Faire: .. suite 2 .. A≥B Finftq:
.. suite 1 .. .. suite 2 .. MOV CMP JGE .. suite 3 ..
$A,%EAX $B,%EAX Faire
50
Assembleur
Tant que ??? Faire ..
Traduction
Exemple .. suite 1 .. Tant que
.. suite 3 ..
Premi`ere ann´ee
Pentium
2003
Tantque: A≥B .. suite 2 ..
Faire
Fintq :
.. suite 1 .. MOV CMP JNGE .. suite 2 .. JMP .. suite 3 ..
$A,%EAX $B,%EAX Fintq
Tantque
51
Assembleur
Pour i = n ` a m Faire ..
Traduction
Exemple .. suite 1 .. Pour Faire
i = n `a m (pas =t) .. suite 2 ..
Pour:
.. suite 3 .. Finpour :
Premi`ere ann´ee
Pentium
2003
.. suite 1 .. MOV CMP JG .. suite 2 .. ADD JMP .. suite 3 ..
$n,%ECX $m,%ECX Finpour
$t,%ECX Pour
52
Assembleur
Instruction LOOP
LOOP
Pentium
Adresse (8bits: -128 `a 127)
• ECX est utilis´e comme compteur
• ECX est d´ecr´ement´e,
• puis Si ECX 6= 0 alors saut vers Adresse ,
• Sinon passage `a la suite
Premi`ere ann´ee
2003
53
Assembleur
Pentium
Exemple .. suite 1 .. Pour Faire
.. suite 3 ..
Premi`ere ann´ee
2003
Traduction
i = n `a 1 .. suite 2 ..
Pour:
Finpour :
.. suite 1 .. MOV .. suite 2 .. LOOP .. suite 3 ..
$n,%ECX
Pour
54
Assembleur
Pentium
Gestion de la PILE Appel de fonction
Premi`ere ann´ee
2003
55
Assembleur
Principe d’utilisation de la Pile
Pentium
• Place m´emoire r´eserv´ee pour lors de l’ex´ecution d’un programme (sous linux par d´efaut 2M o) : pour les variables locales, pour les sauvegardes d’environnement • ESP pointe `a l’initialisation sur le premier octet hors de la pile • ESP pointe toujours sur le sommet de la zone occup´ee • EBP pour pointer les variables stock´ees dans la pile
Premi`ere ann´ee
2003
56
Assembleur
Pentium
Exemple
• R´eservation de quatre octets dans la pile •
movl subl movw movw
%esp,%ebp $4,%esp $4,-4(%ebp) $12,-2(%ebp)
⇒ ESP →
04
00
12
00
ESP →
Premi`ere ann´ee
2003
57
Assembleur
Pentium
Op´ erations sur la pile
PUSH
Source
• PUSH d´ecr´emente ESP de 2 ou de 4 suivant le type de Source • Puis met la valeur de Source `a l’adresse [ESP] •
mov push
Premi`ere ann´ee
$0x23,%eax %eax
2003
⇒
eax 00 00 00 23 esp ← esp - 4 mov %eax,(%esp)
⇒ esp →
23
00
00
00
esp →
58
Assembleur
Pentium
Op´ erations sur la pile (suite)
POP
Source
• POP met la valeur point´ee `a l’adresse [ESP] dans Source • Puis incr´emente ESP de 2 ou de 4 suivant le type de Source •
pop
%eax
⇒
eax 00 00 00 esp ← esp + 4
Premi`ere ann´ee
2003
⇒
mov (%esp),%eax 23
ESP →
23
00
00
00
ESP →
59
Assembleur
Pentium
Appel de fonctions
Premi`ere ann´ee
2003
60
Assembleur
Appel d’une fonction
CALL
Pentium
nomfonction
• CALL : sauvegarde de l’adresse de l’instruction suivant le CALL dans la pile traduction : push jmp
Premi`ere ann´ee
2003
%eip nomfonction
61
Assembleur
D´ eclaration d’une fonction
Pentium
nomfonction: .. suite .. ret
instructions
• ret assure le retour en d´epilant l’addresse de l’instruction suivant l’appel RET
$val
• traduction : pop add
Premi`ere ann´ee
2003
%eip $val, %esp
;(si arguments)
62
Assembleur
Retour s´ ecuris´ e
Pentium
• Pour ˆetre certain de d´epil´e l’adresse de l’instruction suivant le call • En d´ebut de fonction :
• En fin de fonction :
push mov
%ebp %esp,%ebp
leave ret
• traduction de LEAVE : mov pop
Premi`ere ann´ee
2003
%ebp, %esp %ebp
63
Assembleur
Sauvegarde de l’environnement
Pentium
• Avant l’appel empiler le contenu de tous les registres risquant d’ˆetre modifi´es dans la proc´edure
PUSHAD
;empile : EAX, ECX, EDX, EBX, original ESP, EBP, ESI, and EDI
• Avant le retour d´epiler pour restituer le contenu de tous les registres empil´es lors de l’appel POPAD Pop EDI, ESI, EBP, EBX, EDX, ECX, and EAX POPAD
Premi`ere ann´ee
2003
; d´epile : EDI, ESI, EBP, EBX, EDX, ECX, and EAX
64
Assembleur
linux ELF
Pentium
Directives : • .globl d´eclaration pour l’´edition de lien • .type nomfonction,@function d´eclaration du type Remarque: • le corps du programme (main:) peut lui aussi ˆetre d´eclar´e comme fonction. C’est mˆeme conseill´e.
Premi`ere ann´ee
2003
65
Assembleur
linux ELF
Pentium
Utilitaire: • readelf pour lire les diff´erentes informations li´ees au format ELF: par exemple readelf -s a.out pour lire la table des symboles. Construction de l’ex´ecutable: • avec gcc gcc toto.s -o toto • avec as et ld as toto.s -o toto.o ld -e main toto.o -o toto
Premi`ere ann´ee
2003
66
Assembleur
r´ esum´ e
.globl .type main:
main main,@function push mov .. pushad call popad .. leave ret
Premi`ere ann´ee
Pentium
2003
%ebp %esp,%ebp
nomfonction
.globl .type nomfonction:
nomfonction nomfonction,@function push mov .. leave ret
%ebp %esp,%ebp
67
Assembleur
Passage des arguments
Pentium
Principe d’utilisation de la pile lors de l’appel: • empiler push .. push push
les arguments dans l’ordre inverse: argN,..,arg2,arg1 argN arg2 arg1
• faire l’appel call nomfonction • au retour r´etablir le pointeur de pile ret taillearg
Premi`ere ann´ee
2003
68
Assembleur
Passage des arguments: suite
Pentium
Principe d’utilisation de la pile dans la fonction: • sauvegarde du pointeur de pile: push %ebp mov %esp,%ebp • reservation de l’espace n´ecessaire pour les variables locales: sub $val,%esp • localisation par rapport au registre %ebp: +8(%ebp) pointe sur arg1 (%ebp) pointe %esp d’origine -4(%ebp) pointe sur varloc1 • leave replace le pointeur de pile sur l’appel (%eip suivant) Premi`ere ann´ee
2003
69
Assembleur
Pentium
Variables Locales
• R´eservation d’espace dans la pile pour les variables locales : esp →
var 2 var 1
esp →
2003
ebp
eip (call)
eip (call)
arg 2
arg 2
arg 1
Premi`ere ann´ee
ebp →
ebp
⇒ sub $8,%esp ⇒
arg 1
70
Shawon100 / Assembly-8086. Pull requests 0. Projects 0 Insights Permalink. Assembly-8086 / Assembly Language 8086 Exercise Solution [Marut].pdf. Andaaz full movie 2003 hd download. 3203d38 Nov 17, 2016. Shawon100 Add files via upload. 1 contributor. Users who have contributed to this file. Shawon100 Download History. Important programs of 8086 (Exam point of view) 1. Write an ALP to find factorial of number for 8086. Find number of times letter ‚e™ exist in the string ‚exercise. Write an 8086 ALP which will input the user name from the keyboard. If the user is. TD 4: Programmation en assembleur 8086. Exercice 1: Ecrire un programme, en langage assembleur 8086, qui permet de compter les nombres nuls dans un.
Download and torrent. At our site you can get Novecento Complete Torrent via Rapidshare Hotfile Fileserve Mediafire Megaupload, and Novecento Complete Torrent zip rar free Torrent and Emule download included crack, serial, keygen, full version, and so on. 4966 kb/s 6596 kb/s 4966 kb/s Novecento Sans| Novecento Sans| Novecento Sans| novecento wide bold font torrent| novecento sans| novecento font zip| novecento font torrent| Novecento wide| novecento wide free torrent| novecento font family free download torrent.
Dell Datasafe Local Backup Premium Serial Numbers. Convert Dell Datasafe Local Backup Premium trail version to full software. Oct 31, 2016 I have been using my Dell laptop for over 2 years and Dell DataSafe local backup has been annoying my with pop-ups. I disabled it using msconfig, but the messages keep popping up. I am using the default version, which has the basic features of restoring the pc back to factory state and creating a back-up CD. May 16, 2013 Dell DataSafe Local Backup-activation key not validating I have purchased the upgrade for my Dell Inspirion 4010N and have been attempting. Dell Datasafe Local Backup Activation Code Generator Serial Numbers. Convert Dell Datasafe Local Backup Activation Code Generator trail version to full software. Dell datasafe local backup serial keygenreter. Aug 18, 2013 AuthorTotal downloads 7653Uploaded2.6.2014Activation code/Serial key7221-1-9778 Important! If the activation code or serial key does not fit, download and generate NEWChecked Dr.Web No virusesLink: To download the “dell datasafe local backup premium activation code” one file you must go to one of the links on file sharing.
Renditioner express v2 serial number free. Your search for Idx Renditioner Express Free Serial Number will produce better results if you simplify your keywords and exclude words like: serial, key, number, code, activation, keygen, crack, etc. If you still have trouble finding results for Idx Renditioner Express Free Serial Number after simplifying your search term then we strongly suggest using the alternative sites (linked above).
Programmation Assembleur 8086
- Categories
- Top types
- Audio & home theatre
- Cameras & camcorders
- Computer cables
- Computer components
- Computers
- Data input devices
- Data storage
- Networking
- Print & Scan
- Projectors
- Smart wearables
- Software
- Telecom & navigation
- TVs & monitors
- Warranty & support
- other →
- Top brands
- Acer
- AEG
- Aeg-Electrolux
- Asus
- Canon
- Casio
- Electrolux
- HP
- LG
- Nikon
- Panasonic
- Philips
- Samsung
- Sony
- Yamaha
- other →
- Top types
- Infotainment
- Musical instruments
- Video games & consoles
- other →
- Top brands
- Acer
- AEG
- Asus
- Dometic
- Electrolux
- HP
- LG
- Panasonic
- Philips
- Progress
- Samsung
- Sharp
- Sony
- ZANKER
- Zoppas
- other →
- Top types
- Binding machines
- Boards
- Calculators
- Correction media
- Desk accessories & supplies
- Drawing supplies
- Equipment cleansing kit
- Folders, binders & indexes
- Laminators
- Mail supplies
- Paper cutters
- Sorters
- Storage accessories for office machines
- Typewriters
- Writing instruments
- other →
- Top brands
- Bosch
- Canon
- Casio
- Craftsman
- Dell
- Epson
- Fujitsu
- HP
- KitchenAid
- LG
- Panasonic
- Philips
- Samsung
- Sharp
- Smeg
- other →
- Top types
- Bedding & linens
- Cleaning & disinfecting
- Do-It-Yourself tools
- Domestic appliances
- Home décor
- Home furniture
- Home security & automation
- Kitchen & houseware accessories
- Kitchenware
- Lighting
- other →
- Top brands
- AEG
- Aeg-Electrolux
- Bauknecht
- Candy
- Electrolux
- HP
- Indesit
- LG
- Panasonic
- Philips
- Progress
- Samsung
- Sony
- Whirlpool
- Zanussi
- other →
- Top types
- Bags & cases
- Children carnival costumes
- Clothing care
- Clothing hangers
- Dry cleaners
- Fabric shavers
- Men's clothing
- Tie holders
- Ultrasonic cleaning equipment
- Watches
- Women's clothing
- other →
- Top brands
- Braun
- Casio
- Delta
- Garmin
- Huawei
- Indesit
- LG
- Mitsubishi Electric
- Philips
- Radio Shack
- SEVERIN
- Sony
- V7
- Velleman
- ZyXEL
- other →
- Top types
- Air Handlers
- Boom Lifts
- Compact Excavator
- Elevators
- Excavators
- Finishers
- Front End Loaders
- Noise Reduction Machine
- Oxygen Equipment
- Robotics
- Scrubber
- Spreader
- Tractor
- Trash Compactor
- Welding System
- other →
- Top brands
- AEG
- Aeg-Electrolux
- Asus
- Canon
- Casio
- Electrolux
- HP
- LG
- Nikon
- Panasonic
- Philips
- Samsung
- Sony
- Whirlpool
- Yamaha
- other →
- Top types
- Blood pressure units
- Electric toothbrushes
- Epilators
- Feminine hygiene products
- Foot baths
- Hair trimmers & clippers
- Makeup & manicure cases
- Men's shavers
- Personal paper products
- Personal scales
- Shaver accessories
- Skin care
- Solariums
- Teeth care
- Women's shavers
- other →
- Top brands
- AEG
- Aeg-Electrolux
- Bosch
- Canon
- Casio
- Electrolux
- KitchenAid
- LG
- Panasonic
- Philips
- Samsung
- Sony
- Whirlpool
- Yamaha
- Zanussi
- other →
- Top types
- Hot beverage supplies
- other →
- Top brands
- other →
- Top types
- Cars
- Electric scooters
- Motor vehicle accessories & components
- Motor vehicle electronics
- Motorcycles
- Motorhomes
- Offroad Vehicle
- Scooters
- Utility Vehicle
- other →
- Top brands
- AEG
- Aeg-Electrolux
- Bosch
- Canon
- Casio
- Craftsman
- Electrolux
- LG
- Panasonic
- Philips
- Samsung
- Sharp
- Sony
- Yamaha
- Zanussi
- other →
- Top types
- Baby bathing & potting
- Baby furniture
- Baby safety
- Baby sleeping & bedding
- Baby travel
- Feeding, diapering & nursing
- Toys & accessories
- other →
- Top brands
- AEG
- Asus
- Bosch
- Canon
- Casio
- Electrolux
- HP
- LG
- Panasonic
- Philips
- Samsung
- Sony
- Whirlpool
- Yamaha
- Zanussi
- other →
- Top types
- Bicycles & accessories
- Bubble machines
- Camping, tourism & outdoor
- Fitness, gymnastics & weight training
- Martial arts equipment
- Skateboarding & skating
- Smoke machines
- Sport protective gear
- Target & table games
- Water sports equipment
- Winter sports equipment
- other →
- Top brands
- Craftsman
- Daikin
- Emerson
- Epson
- Frigidaire
- Harbor Freight Tools
- HP
- Miele
- Panasonic
- Philips
- ProForm
- Samsung
- Sennheiser
- Weider
- Yamaha
- other →
- Top types
- Pet hair clippers
- other →
- Top brands
- Andis
- other →
- Top types
- Pill Reminder Device
- Stairlifts
- other →
- Top brands
- Alber
- Bruno
- E-PIL
- Minivator
- Savaria
- other →
Exercise Programmation Assembleur 8086 Pdf Download
- Exercise Programmation Assembleur 8086 Pdf Editor. 1/31/2018 0 Comments Return 0; Finally, we consider this line. When terminating our program, it is useful to be.
- Programmation Posez votre question. Exercice de microprocesseur 8086 avec solution pdf - Meilleures. Parce que la je pense que juste en faisant un bout de code en assembleur ou en C ca.
- Emu8086 is a Microprocessor Emulator with an integrated 8086 Assembler and Free Tutorial. Emu8086 is a Microprocessor Emulator with an integrated 8086 Assembler and Free Tutorial. Emulator runs programs on a Virtual Machine, it emulates real hardware, such as screen, memory and input/output devices.