SlideShare a Scribd company logo
x86 CPU ARCHITECTURE
SANGRAM KESARI RAY <SHANKAR.RAY030@GMAIL.COM>
CPU DESIGN
• C LO C K / / S Y N C H R O N I Z AT I O N F O R O P E R AT I O N S – R E A D I N G F R O M M E M O RY, D O I N G A R I T H M E T I C
I N A L U, E TC .
• C O N T R O L U N I T
• A R I T H M E T I C LO G I C U N I T
• B U S ( PA R A L L E L W I R E S A C R O SS T H E C O M P O N E N TS, E TC H E D O N T H E M OT H E R B O A R D / / B E T W E E N
C P U A N D M E M O RY, E TC .)
• I N S T R U C T I O N E X E C UT I O N :
F E TC H ( I N S T R U C T I O N F R O M M E M O RY - >
D E C O D E ( F R O M B I N A RY B I T PATT E R N ) - >
E X E C UT E ( U P D AT E F LA G S ) - >
S TO R E ( I F A N Y O U T P U T O P E R A N D )
PROGRAM EXECUTION
• OS LOADS A PROGRAM INTO MEMORY
• OS EXECUTES THE PROGRAM’ S FIRST INSTRUCTION (ENTRY
POINT)
• FROM HERE THE PROGRAM RUNS BY ITSELF
• WHEN THE PROGRAM ENDS THE OS REMOVES IT FROM
MEMORY
CPU OPERATION MODES
• PROTECTED MODE //NO DIRECT ACCESS TO SYSTEM
MEMORY, EACH PROGRAM HAS 2 GB ADDRESS SPACE
• REAL-ADDRESS MODE //DIRECT ACCESS TO SYSTEM
MEMORY, EACH PROGRAM HAS 1 MB ADDRESS SPACE
• VIRTUAL-8086 MODE //CPU SWITCHING FROM PROTECTED
TO REAL MODE
• SYSTEM MANAGEMENT MODE //USED BY SYSTEM FIRMWARE
REGISTERS
• GENERAL PURPOSE REGISTERS –
E A X / / A C C U M U L A T O R R E G I S T E R - H O L D S D A T A
E C X / / C O U N T E R R E G I S T E R - L O O P C O U N T E R
E D X / / D A T A R E G I S T E R - H O L D S D A T A
E B X / / B A S E R E G I S T E R - P O I N T E R T O D A T A
E S I / / S O U R C E I N D E X - P O I N T E R T O S O U R C E S T R E A M
E D I / / D E S T I N A T I O N I N D E X - P O I N T E R T O D E S T I N A T I O N S T R E A M
E B P / / B A S E P O I N T E R - P O I N T E R T O B A S E O F T H E S T A C K
E S P / / S T A C K P O I N T E R - P O I N T E R T O T O P O F T H E S T A C K
CONT.
• SEGMENT REGISTERS –
C S / / C O D E S E G M E N T - P O I N T E R T O S T A R T I N G A D D R E S S O F P R O G R A M
D S / / D A T A S E G M E N T - P O I N T E R T O S T A R T I N G A D D R E S S O F P R O G R A M D A T A
S S / / S T A C K S E G M E N T - D E F I N E S S T A C K A R E A
E S / / E X T R A S E G M E N T - P O I N T E R T O D E S T I N A T I O N
F S / / G E N E R A L P U R P O S E S E G M E N T R E G I S T E R
G S / / G E N E R A L P U R P O S E S E G M E N T R E G I S T E R
INSTRUCTION POINTER
• EIP //POINTER TO NEXT INSTRUCTION
NOTE: SYSTEM SECURITY IS ALL AB OUT CONTROLLING THE EIP REGISTER – DIRECTLY/IN -
DIRECTLY TO CAUSE ABNORMAL CODE EXECUTION.
EFLAGS
• A 32-BIT REGISTER STORES RESULTS OF A CERTAIN OPERATION IN THE C PU
0-BIT //CARRY FLAG -IF AN ARITHMETIC OPERATION CAUSED CARRY/B ORR OW
2-BIT //PARITY FLAG -SET IF NUMBER OF BITS IN LSB IS EVEN
4-BIT //ADJUST FLAG -IF A CARRY OCCURS FROM LOWER NIBBLE
6-BIT //ZERO FLAG -SET IF RESULT OF AN OPERATION IS ZERO
7-BIT //SIGN FLAG -SET IF RESULT OF AN OPERATION IS NEGATIVE
8-BIT //TRAP FLAG -SET IF STEP -BY-STEP DEBUGGING
CONT.
9 - B I T / / I N T E R R U P T I O N F L A G - S E T I F I N T E R R U P T S A R E E N A B L E D
1 0 - B I T / / D I R E C T I O N F L A G - I F S E T R E A D I N G M E M O R Y B A C K WA R D S
1 1 - B I T / / O V E R F L O W F L A G - I F A N O U T P U T I S L A R G E R F O R A R E G I S T E R TO H O L D
1 2 - 1 3 - B I T / / I / O P R I V I L E G E L E V E L F I E L D S - I / O P R I V I L E G E L E V E L O F C U R R E N T P R O C E S S
1 4 - B I T / / N E S T E D TA S K F L A G - S E T I F C U R R E N T P R O C E S S I S L I N K E D TO T H E N E X T P R O C E S S
1 6 - B I T / / R E S U M E F L A G - I F S E T, R E S P O N D TO D E B U G E X C E P T I O N S
1 7 - B I T / / V I RT U A L- 8 0 8 6 M O D E - S E T I F I N 8 0 8 6 C O M PA B I T I B I L I TY M O D E
1 8 - B I T / / A L I G N M E N T- F L A G - S E T I F C P U D E T E C T S A N U N -A L I G N E D M E M O R Y O P E R A N D , S TO R I N G
A W O R D I N A N O D D - B Y T E A D D R E S S
CONT.
19-BIT //VIRTUAL INTERRUPT FLAG - SET AF TER HANDLING A PENDING I NTERRUPT
20-BIT //VIRTUAL INTERRUPT PENDING FLAG - SET IF AN INTERRUPT IS PENDING
21-BIT //IDENTIFICATION FLAG -IF SET, CPU SUPPORT CUPID INSTRUCT ION
ALL OTHER BITS ARE RESERVED FOR CPU
MMX REGISTERS
• 8 64 -BIT REGISTERS //THEY ARE LIKE GENERAL PURPOSE REGISTERS
• MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7
XMM REGISTERS
• 8 128 -BIT REGISTERS //THEY ARE LIKE GENERAL PURPOSE REGISTERS
• XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7
FLOATING-POINT UNIT
• T O B E U S E D F O R F L O A T I N G - P O I N T A R I T H M E T I C
• 8 8 0 - B I T D A T A - R E G I S T E R S - S T 0 , S T 1 , S T 2 , S T 3 , S T 4 , S T 5 , S T 6 , S T 7
• 2 4 8 - B I T P O I N T E R R E G I S T E R S -
F I P ( F P U I N S T R U C T I O N P O I N T E R ) ,
F S C ( F P U D A T A P O I N T E R )
• 3 1 6 - B I T C O N T R O L R E G I S T E R S -
F T A G ( T A G R E G I S T E R )
F C T R L ( C O N T R O L R E G I S T E R )
F S T A T ( S T A T U S R E G I T E R )
• 1 1 1 - B I T O P C O D E R E G I S T E R / / S T O R E S O P C O D E O F T H E L A S T N O N - C O N T R O L I N S T R U C T I O N , L I K E A D D I T I O N , E T C
X86-64 BIT PROCESSORS
• 64-BIT LONG ADDRESSES
• CURRENTLY ONLY LOWER 48 -BITS ARE USED
• HAS TWO MODES – COMPATIBILITY MODE TO RUN 16/32 -BIT OPERANDS AND 64- BIT MODE
TO RUN 64 - BIT OPERANDS
• 16 64 -BIT GENERAL PURPOSE REGISTER- RAX, RBX, RCX, RDX, RDI , RSI , RBP, RSP, R8 -R15
• 64-BIT RFLAGS REGISTER //UPPER 32 -BITS ARE NOT USED, FLAGS WORK SAME AS 32 -BIT
HOW
COMPUTER
WORKS
Q > I encourage the reading to figure
out how typing something in notepad
actually gets displayed on the screen?
BRAVE ARE THOSE WHO COULD MAKE
IT THIS FAR! Next time when we meet,
we’ll start with Assembly
programming using Visual Studio and
MASM Assembler. Bye!
APPLICATION
OS
BIOS
HARDWARE

More Related Content

Similar to Assembly Language Tutorials for Windows - 02 x86-64 Architecture

pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptxpdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
GustavoJesus32
 
What every C++ programmer should know about modern compilers (w/o comments, A...
What every C++ programmer should know about modern compilers (w/o comments, A...What every C++ programmer should know about modern compilers (w/o comments, A...
What every C++ programmer should know about modern compilers (w/o comments, A...
Sławomir Zborowski
 
TV Everywhere Innovation at NET Serviços
TV Everywhere Innovation at NET ServiçosTV Everywhere Innovation at NET Serviços
TV Everywhere Innovation at NET Serviços
Carmelo Iaria
 
Evolution of high power am transmitter technology
Evolution of high power am transmitter technologyEvolution of high power am transmitter technology
Evolution of high power am transmitter technology
R.Narasimha Swamy
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
Marina Kolpakova
 
Pintrace: Distributed tracing @Pinterest
Pintrace: Distributed tracing @PinterestPintrace: Distributed tracing @Pinterest
Pintrace: Distributed tracing @Pinterest
Suman Karumuri
 
Jawsdays2018 180310
Jawsdays2018 180310Jawsdays2018 180310
Jawsdays2018 180310
Daisuke Yoshioka
 
Výlet do funkcionálního světa Elmu - GDG Praha 2017
Výlet do funkcionálního světa Elmu - GDG Praha 2017Výlet do funkcionálního světa Elmu - GDG Praha 2017
Výlet do funkcionálního světa Elmu - GDG Praha 2017
Tomáš Látal
 
E xact micro 10 photometer v4
E xact micro 10 photometer v4E xact micro 10 photometer v4
E xact micro 10 photometer v4
Ronnie Lewis
 
Location-Based Mobile Ordering
Location-Based Mobile OrderingLocation-Based Mobile Ordering
Location-Based Mobile Ordering
Nicholas Kent
 
Addressing Modes and Formats.pdf
Addressing Modes and Formats.pdfAddressing Modes and Formats.pdf
Addressing Modes and Formats.pdf
K17HCMNguyenVuTruong
 
CATIA – Computer Aided Three Dimensional Interactive Application.pptx
CATIA – Computer Aided Three Dimensional Interactive Application.pptxCATIA – Computer Aided Three Dimensional Interactive Application.pptx
CATIA – Computer Aided Three Dimensional Interactive Application.pptx
PrathameshKale23
 
Catalogue thang tải thức ăn Ryoden Dumbwaiter G-Series
Catalogue thang tải thức ăn Ryoden Dumbwaiter G-SeriesCatalogue thang tải thức ăn Ryoden Dumbwaiter G-Series
Catalogue thang tải thức ăn Ryoden Dumbwaiter G-Series
ThangmaythietbiThang
 
Design durch Entwicklung
Design durch EntwicklungDesign durch Entwicklung
Design durch Entwicklung
Patrik de Jong
 
Emotion and the Internet of Things
Emotion and the Internet of ThingsEmotion and the Internet of Things
Emotion and the Internet of Things
Changeist
 
AGV Solutions
AGV SolutionsAGV Solutions
AGV Solutions
DaleSmith131
 
VIRTUAL 2.pptx
VIRTUAL  2.pptxVIRTUAL  2.pptx
VIRTUAL 2.pptx
PratikBose10
 
Vacantes de secundario ciclo superior mad 2013 2014
Vacantes de secundario ciclo superior mad 2013 2014 Vacantes de secundario ciclo superior mad 2013 2014
Vacantes de secundario ciclo superior mad 2013 2014
Agrupacion Almafuerte
 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016
DISID
 
SEO orientado a Ventas - DSMVALENCIA 2017
SEO orientado a Ventas - DSMVALENCIA 2017SEO orientado a Ventas - DSMVALENCIA 2017
SEO orientado a Ventas - DSMVALENCIA 2017
Luis M Villanueva
 

Similar to Assembly Language Tutorials for Windows - 02 x86-64 Architecture (20)

pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptxpdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
pdfcoffee.com_otis-gen-2-regen-baa21000h-plano-7-pdf-free (1).pptx
 
What every C++ programmer should know about modern compilers (w/o comments, A...
What every C++ programmer should know about modern compilers (w/o comments, A...What every C++ programmer should know about modern compilers (w/o comments, A...
What every C++ programmer should know about modern compilers (w/o comments, A...
 
TV Everywhere Innovation at NET Serviços
TV Everywhere Innovation at NET ServiçosTV Everywhere Innovation at NET Serviços
TV Everywhere Innovation at NET Serviços
 
Evolution of high power am transmitter technology
Evolution of high power am transmitter technologyEvolution of high power am transmitter technology
Evolution of high power am transmitter technology
 
Code GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limitersCode GPU with CUDA - Identifying performance limiters
Code GPU with CUDA - Identifying performance limiters
 
Pintrace: Distributed tracing @Pinterest
Pintrace: Distributed tracing @PinterestPintrace: Distributed tracing @Pinterest
Pintrace: Distributed tracing @Pinterest
 
Jawsdays2018 180310
Jawsdays2018 180310Jawsdays2018 180310
Jawsdays2018 180310
 
Výlet do funkcionálního světa Elmu - GDG Praha 2017
Výlet do funkcionálního světa Elmu - GDG Praha 2017Výlet do funkcionálního světa Elmu - GDG Praha 2017
Výlet do funkcionálního světa Elmu - GDG Praha 2017
 
E xact micro 10 photometer v4
E xact micro 10 photometer v4E xact micro 10 photometer v4
E xact micro 10 photometer v4
 
Location-Based Mobile Ordering
Location-Based Mobile OrderingLocation-Based Mobile Ordering
Location-Based Mobile Ordering
 
Addressing Modes and Formats.pdf
Addressing Modes and Formats.pdfAddressing Modes and Formats.pdf
Addressing Modes and Formats.pdf
 
CATIA – Computer Aided Three Dimensional Interactive Application.pptx
CATIA – Computer Aided Three Dimensional Interactive Application.pptxCATIA – Computer Aided Three Dimensional Interactive Application.pptx
CATIA – Computer Aided Three Dimensional Interactive Application.pptx
 
Catalogue thang tải thức ăn Ryoden Dumbwaiter G-Series
Catalogue thang tải thức ăn Ryoden Dumbwaiter G-SeriesCatalogue thang tải thức ăn Ryoden Dumbwaiter G-Series
Catalogue thang tải thức ăn Ryoden Dumbwaiter G-Series
 
Design durch Entwicklung
Design durch EntwicklungDesign durch Entwicklung
Design durch Entwicklung
 
Emotion and the Internet of Things
Emotion and the Internet of ThingsEmotion and the Internet of Things
Emotion and the Internet of Things
 
AGV Solutions
AGV SolutionsAGV Solutions
AGV Solutions
 
VIRTUAL 2.pptx
VIRTUAL  2.pptxVIRTUAL  2.pptx
VIRTUAL 2.pptx
 
Vacantes de secundario ciclo superior mad 2013 2014
Vacantes de secundario ciclo superior mad 2013 2014 Vacantes de secundario ciclo superior mad 2013 2014
Vacantes de secundario ciclo superior mad 2013 2014
 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016
 
SEO orientado a Ventas - DSMVALENCIA 2017
SEO orientado a Ventas - DSMVALENCIA 2017SEO orientado a Ventas - DSMVALENCIA 2017
SEO orientado a Ventas - DSMVALENCIA 2017
 

More from Sangram Kesari Ray

Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1
Sangram Kesari Ray
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-3
Assembly Language Tutorials for Windows - 04 Data Transfers Part-3Assembly Language Tutorials for Windows - 04 Data Transfers Part-3
Assembly Language Tutorials for Windows - 04 Data Transfers Part-3
Sangram Kesari Ray
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Sangram Kesari Ray
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-1
Assembly Language Tutorials for Windows - 04 Data Transfers Part-1Assembly Language Tutorials for Windows - 04 Data Transfers Part-1
Assembly Language Tutorials for Windows - 04 Data Transfers Part-1
Sangram Kesari Ray
 
Assembly Language Tutorials for Windows - 03 Assembly Language Programming
Assembly Language Tutorials for Windows - 03 Assembly Language ProgrammingAssembly Language Tutorials for Windows - 03 Assembly Language Programming
Assembly Language Tutorials for Windows - 03 Assembly Language Programming
Sangram Kesari Ray
 
Assembly Language Tutorials for Windows - 01 Computer Programming
Assembly Language Tutorials for Windows - 01 Computer ProgrammingAssembly Language Tutorials for Windows - 01 Computer Programming
Assembly Language Tutorials for Windows - 01 Computer Programming
Sangram Kesari Ray
 
03 Win32 API - Creating a Window
03 Win32 API - Creating a Window03 Win32 API - Creating a Window
03 Win32 API - Creating a Window
Sangram Kesari Ray
 

More from Sangram Kesari Ray (7)

Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1Assembly Language Tutorials for Windows - 05 Procedures Part 1
Assembly Language Tutorials for Windows - 05 Procedures Part 1
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-3
Assembly Language Tutorials for Windows - 04 Data Transfers Part-3Assembly Language Tutorials for Windows - 04 Data Transfers Part-3
Assembly Language Tutorials for Windows - 04 Data Transfers Part-3
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
Assembly Language Tutorials for Windows - 04 Data Transfers Part-2
 
Assembly Language Tutorials for Windows - 04 Data Transfers Part-1
Assembly Language Tutorials for Windows - 04 Data Transfers Part-1Assembly Language Tutorials for Windows - 04 Data Transfers Part-1
Assembly Language Tutorials for Windows - 04 Data Transfers Part-1
 
Assembly Language Tutorials for Windows - 03 Assembly Language Programming
Assembly Language Tutorials for Windows - 03 Assembly Language ProgrammingAssembly Language Tutorials for Windows - 03 Assembly Language Programming
Assembly Language Tutorials for Windows - 03 Assembly Language Programming
 
Assembly Language Tutorials for Windows - 01 Computer Programming
Assembly Language Tutorials for Windows - 01 Computer ProgrammingAssembly Language Tutorials for Windows - 01 Computer Programming
Assembly Language Tutorials for Windows - 01 Computer Programming
 
03 Win32 API - Creating a Window
03 Win32 API - Creating a Window03 Win32 API - Creating a Window
03 Win32 API - Creating a Window
 

Recently uploaded

E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
Yara Milbes
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
Philip Schwarz
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
Peter Muessig
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
pavan998932
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
Shane Coughlan
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 

Recently uploaded (20)

E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
SMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API ServiceSMS API Integration in Saudi Arabia| Best SMS API Service
SMS API Integration in Saudi Arabia| Best SMS API Service
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Hand Rolled Applicative User Validation Code Kata
Hand Rolled Applicative User ValidationCode KataHand Rolled Applicative User ValidationCode Kata
Hand Rolled Applicative User Validation Code Kata
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemUI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
UI5con 2024 - Keynote: Latest News about UI5 and it’s Ecosystem
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
What is Augmented Reality Image Tracking
What is Augmented Reality Image TrackingWhat is Augmented Reality Image Tracking
What is Augmented Reality Image Tracking
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
openEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain SecurityopenEuler Case Study - The Journey to Supply Chain Security
openEuler Case Study - The Journey to Supply Chain Security
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 

Assembly Language Tutorials for Windows - 02 x86-64 Architecture

  • 1. x86 CPU ARCHITECTURE SANGRAM KESARI RAY <SHANKAR.RAY030@GMAIL.COM>
  • 2. CPU DESIGN • C LO C K / / S Y N C H R O N I Z AT I O N F O R O P E R AT I O N S – R E A D I N G F R O M M E M O RY, D O I N G A R I T H M E T I C I N A L U, E TC . • C O N T R O L U N I T • A R I T H M E T I C LO G I C U N I T • B U S ( PA R A L L E L W I R E S A C R O SS T H E C O M P O N E N TS, E TC H E D O N T H E M OT H E R B O A R D / / B E T W E E N C P U A N D M E M O RY, E TC .) • I N S T R U C T I O N E X E C UT I O N : F E TC H ( I N S T R U C T I O N F R O M M E M O RY - > D E C O D E ( F R O M B I N A RY B I T PATT E R N ) - > E X E C UT E ( U P D AT E F LA G S ) - > S TO R E ( I F A N Y O U T P U T O P E R A N D )
  • 3. PROGRAM EXECUTION • OS LOADS A PROGRAM INTO MEMORY • OS EXECUTES THE PROGRAM’ S FIRST INSTRUCTION (ENTRY POINT) • FROM HERE THE PROGRAM RUNS BY ITSELF • WHEN THE PROGRAM ENDS THE OS REMOVES IT FROM MEMORY
  • 4. CPU OPERATION MODES • PROTECTED MODE //NO DIRECT ACCESS TO SYSTEM MEMORY, EACH PROGRAM HAS 2 GB ADDRESS SPACE • REAL-ADDRESS MODE //DIRECT ACCESS TO SYSTEM MEMORY, EACH PROGRAM HAS 1 MB ADDRESS SPACE • VIRTUAL-8086 MODE //CPU SWITCHING FROM PROTECTED TO REAL MODE • SYSTEM MANAGEMENT MODE //USED BY SYSTEM FIRMWARE
  • 5. REGISTERS • GENERAL PURPOSE REGISTERS – E A X / / A C C U M U L A T O R R E G I S T E R - H O L D S D A T A E C X / / C O U N T E R R E G I S T E R - L O O P C O U N T E R E D X / / D A T A R E G I S T E R - H O L D S D A T A E B X / / B A S E R E G I S T E R - P O I N T E R T O D A T A E S I / / S O U R C E I N D E X - P O I N T E R T O S O U R C E S T R E A M E D I / / D E S T I N A T I O N I N D E X - P O I N T E R T O D E S T I N A T I O N S T R E A M E B P / / B A S E P O I N T E R - P O I N T E R T O B A S E O F T H E S T A C K E S P / / S T A C K P O I N T E R - P O I N T E R T O T O P O F T H E S T A C K
  • 6. CONT. • SEGMENT REGISTERS – C S / / C O D E S E G M E N T - P O I N T E R T O S T A R T I N G A D D R E S S O F P R O G R A M D S / / D A T A S E G M E N T - P O I N T E R T O S T A R T I N G A D D R E S S O F P R O G R A M D A T A S S / / S T A C K S E G M E N T - D E F I N E S S T A C K A R E A E S / / E X T R A S E G M E N T - P O I N T E R T O D E S T I N A T I O N F S / / G E N E R A L P U R P O S E S E G M E N T R E G I S T E R G S / / G E N E R A L P U R P O S E S E G M E N T R E G I S T E R
  • 7. INSTRUCTION POINTER • EIP //POINTER TO NEXT INSTRUCTION NOTE: SYSTEM SECURITY IS ALL AB OUT CONTROLLING THE EIP REGISTER – DIRECTLY/IN - DIRECTLY TO CAUSE ABNORMAL CODE EXECUTION.
  • 8. EFLAGS • A 32-BIT REGISTER STORES RESULTS OF A CERTAIN OPERATION IN THE C PU 0-BIT //CARRY FLAG -IF AN ARITHMETIC OPERATION CAUSED CARRY/B ORR OW 2-BIT //PARITY FLAG -SET IF NUMBER OF BITS IN LSB IS EVEN 4-BIT //ADJUST FLAG -IF A CARRY OCCURS FROM LOWER NIBBLE 6-BIT //ZERO FLAG -SET IF RESULT OF AN OPERATION IS ZERO 7-BIT //SIGN FLAG -SET IF RESULT OF AN OPERATION IS NEGATIVE 8-BIT //TRAP FLAG -SET IF STEP -BY-STEP DEBUGGING
  • 9. CONT. 9 - B I T / / I N T E R R U P T I O N F L A G - S E T I F I N T E R R U P T S A R E E N A B L E D 1 0 - B I T / / D I R E C T I O N F L A G - I F S E T R E A D I N G M E M O R Y B A C K WA R D S 1 1 - B I T / / O V E R F L O W F L A G - I F A N O U T P U T I S L A R G E R F O R A R E G I S T E R TO H O L D 1 2 - 1 3 - B I T / / I / O P R I V I L E G E L E V E L F I E L D S - I / O P R I V I L E G E L E V E L O F C U R R E N T P R O C E S S 1 4 - B I T / / N E S T E D TA S K F L A G - S E T I F C U R R E N T P R O C E S S I S L I N K E D TO T H E N E X T P R O C E S S 1 6 - B I T / / R E S U M E F L A G - I F S E T, R E S P O N D TO D E B U G E X C E P T I O N S 1 7 - B I T / / V I RT U A L- 8 0 8 6 M O D E - S E T I F I N 8 0 8 6 C O M PA B I T I B I L I TY M O D E 1 8 - B I T / / A L I G N M E N T- F L A G - S E T I F C P U D E T E C T S A N U N -A L I G N E D M E M O R Y O P E R A N D , S TO R I N G A W O R D I N A N O D D - B Y T E A D D R E S S
  • 10. CONT. 19-BIT //VIRTUAL INTERRUPT FLAG - SET AF TER HANDLING A PENDING I NTERRUPT 20-BIT //VIRTUAL INTERRUPT PENDING FLAG - SET IF AN INTERRUPT IS PENDING 21-BIT //IDENTIFICATION FLAG -IF SET, CPU SUPPORT CUPID INSTRUCT ION ALL OTHER BITS ARE RESERVED FOR CPU
  • 11. MMX REGISTERS • 8 64 -BIT REGISTERS //THEY ARE LIKE GENERAL PURPOSE REGISTERS • MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7
  • 12. XMM REGISTERS • 8 128 -BIT REGISTERS //THEY ARE LIKE GENERAL PURPOSE REGISTERS • XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7
  • 13. FLOATING-POINT UNIT • T O B E U S E D F O R F L O A T I N G - P O I N T A R I T H M E T I C • 8 8 0 - B I T D A T A - R E G I S T E R S - S T 0 , S T 1 , S T 2 , S T 3 , S T 4 , S T 5 , S T 6 , S T 7 • 2 4 8 - B I T P O I N T E R R E G I S T E R S - F I P ( F P U I N S T R U C T I O N P O I N T E R ) , F S C ( F P U D A T A P O I N T E R ) • 3 1 6 - B I T C O N T R O L R E G I S T E R S - F T A G ( T A G R E G I S T E R ) F C T R L ( C O N T R O L R E G I S T E R ) F S T A T ( S T A T U S R E G I T E R ) • 1 1 1 - B I T O P C O D E R E G I S T E R / / S T O R E S O P C O D E O F T H E L A S T N O N - C O N T R O L I N S T R U C T I O N , L I K E A D D I T I O N , E T C
  • 14. X86-64 BIT PROCESSORS • 64-BIT LONG ADDRESSES • CURRENTLY ONLY LOWER 48 -BITS ARE USED • HAS TWO MODES – COMPATIBILITY MODE TO RUN 16/32 -BIT OPERANDS AND 64- BIT MODE TO RUN 64 - BIT OPERANDS • 16 64 -BIT GENERAL PURPOSE REGISTER- RAX, RBX, RCX, RDX, RDI , RSI , RBP, RSP, R8 -R15 • 64-BIT RFLAGS REGISTER //UPPER 32 -BITS ARE NOT USED, FLAGS WORK SAME AS 32 -BIT
  • 15. HOW COMPUTER WORKS Q > I encourage the reading to figure out how typing something in notepad actually gets displayed on the screen? BRAVE ARE THOSE WHO COULD MAKE IT THIS FAR! Next time when we meet, we’ll start with Assembly programming using Visual Studio and MASM Assembler. Bye! APPLICATION OS BIOS HARDWARE