IA32 Intel 32-bit Architecture

Size: px
Start display at page:

Download "IA32 Intel 32-bit Architecture"

Transcription

1 1 2 IA32 Intel 32-bit Architecture Intel 32-bit Architecture (IA32) 32-bit machine CISC: 32-bit internal and external data bus 32-bit external address bus 8086 general registers extended to 32 bit width EAX, EBX, ECX, EDX, ESP, EBP, ESI, EDI, EIP Expanded code set (32-bit instructions) Many Load + ALU instructions Hardware support for Operating System functions: Task management Virtual memory and paging Local data and protection 3 4 Operating Modes Real Mode Like a fast 8086 Only recognizes 8086 instruction set 16-bit integers and address s 20-bit physical address (can access lowest 1 MB of RAM) All IA32 processors initialize into real mode Protected Mode Uses full 32-bit features Can process new 32-bit instructions 32-bit integers and physical addresses (can access 4 GB of RAM) Hardware support for Operating System functions Windows/Linux/UNIX/OS2 run in protected mode Virtual 86 Creates a virtual 8086 environment as a task Can run multiple V86 tasks at one time DOS window under Windows runs in V86 mode General Purpose Registers AH AL EAX Accumulator BH BL EBX Base CH CL ECX Counter DH DL EDX Data SP ESP stack pointer BP EBP base pointer SI ESI source index DI EDI index IP EIP instruction pointer

2 5 6 Segment Registers Segmentation in IA32 Protected Mode Segment Registers Segment Shadow Registers Code Segment Selector CS Code Segment Descriptor Data Segment Selector DS Data Segment Descriptor Stack Segment Selector SS Stack Segment Descriptor Extra Segment Selector ES Extra Segment Descriptor Data-F Segment Selector FS Data-F Segment Descriptor Data-G Segment Selector GS Data-G Segment Descriptor New data segment registers: FS, GS Selector Pointer to segment location in memory In Real Mode, Selector = upper 16 bits of physical segment base address In Protected Mode, Selector = index to a Descriptor Table Descriptor Information about the segment Descriptor = Segment base address, Segment Size, Segment Type Segment Register Holds a pointer to a segment Pointer is called a Segment Selector Selector contains an index into a look-up table Descriptor Table is built in Main Memory (RAM) A Descriptor Table may be global or local Table entries are called segment Descriptors Each Descriptor defines one segment Descriptor contains segment base address, segment limit, access rights, and other properties 7 8 linear address + segment base address Segment Address Translation RAM linear address segment base address + descriptor selector Linear Address Space descriptor table Tasks in IA32 Each activity under OS is defined as a Task (process) Each task is allocated a Task State Segment (TSS) Holds information about Task (context) Defines Local (private) Segments for task: Data/Code/Stack Every Task May access (public and unique) Global Descriptor Table (GDT) May access its (private) Local Descriptor Table (LDT) Selector contains Table Indicator (TI) to choose LDT or GDT Index to choose entry (Descriptor) from Descriptor Table TSS1 task1 LDT1 TSS2 GDT task2 LDT2 TSS3 task3 LDT3

3 9 10 Addressing Table Registers GDT Register (Global Descriptor Table) GDT linear base address GDT limit IDT Register (Interrupt Descriptor Table) IDT linear base address IDT limit LDT Register (Local Descriptor Table) Shadow Register LDT Segment Selector LDT Segment Descriptor TSS Register (Task State Segment) Shadow Register TSS Segment Selector TSS Segment Descriptor Context Switch Enter new Selector in TSS Register CPU saves old context in TSS for old task CPU uses new TSS Selector to fetch new TSS Descriptor TSS Descriptor points to new Task State Segment (TSS) Hardware fetches information from new TSS: Selectors for CS, DS, ES, SS, FS, GS, and LDT Values for EAX EDX, EIP, EDI, ESI, EBP, ESP, Flags Hardware adjusts segment registers: CPU uses LDT Selector to fetch LDT Descriptor LDT Descriptor points to Local Descriptor Table CPU uses CS Selector to fetch CS Descriptor CS Descriptor points to Code Segment CPU uses DS Selector to fetch DS Descriptor DS Descriptor points to Data Segment CPU fetches remaining 4 Segment Descriptors Context for new task is loaded and new task can run Selector Format Segment Address Translation Index Table Index (TI) Request Privilege Level (RPL) 16-bit selector 13 bits 1 bit 2 bits 13-bits 1 bit 2 bits index TI RPL 13-bit Index to Descriptor in table 2 13 = = 8 1 K Descriptor table holds 8 K (8192) Descriptors GDT Descriptor Address = Table Base Address + Descriptor Offset Descriptor is 8 bytes in length Descriptor Offset = Index 8 = Index = Selector AND FFF8 LDT 8 K Descriptors/table 8 Bytes/Descriptor = 64 KB/table Table Index TI = 0 for GDT TI = 1 for LDT Request Privilege Level (RPL): used for protection mechanism + Address 32-bit segment base address 32-bit 32-bit linear address 64-bit descriptor

4 13 Segment Types Segment type is written in segment descriptor Code Segments Program instructions May be fetched as instructions May be local (to a task) or global Data Segments Holds data May be loaded or stored May be local or global System Segments GDT/LDT/IDT/TSS Occupy separate segments No access by user programs 14 Descriptor Format Base Access Limit Access Base Limit Access G D 0 0 P DPL S = 1 TYPE A User Segment G P DPL S = 0 TYPE System Segment Base: 32-bit segment base address Limit: 20-bit limit Segment Size = [1 + Limit] (4096) G Bytes G= 0 Byte Granularity: 2 20 bytes = 1 MB maximum segment size G= 1 4 KB Granularity: KB = 4 GB maximum segment size Code Type: D = 0 sets default 16-bit code and 16-bit effective address Required for DOS and runs under Windows D = 1 sets default 32-bit code and 32-bit effective address Runs under Windows 9x/NT/2000/XP and Linux/UNIX Present: P = 1 for segment in memory or P = 0 for swapped-out segment DPL: Descriptor Privilege Level System: S = 0 for system segment or S = 1 for user segment Type: Segment type code Access: A = 0 until segment is accessed; A = 1 after access Type Fields for User Segments (S = 1) 3-bit Type Field Code Segment Type = 1 C R C = 1 for Conforming code (protection scheme) R = 1 for Readable Code (MOV AX,CS:EA legal) Data Segment Type = 0 ED W ED = 1 for Expand Down (stack segment) W = 0 for Read-Only segment Base Access Limit Access Base Limit Access G D 0 0 P DPL S = 1 TYPE A User Segment Type Fields for System Segments (S = 0) 4-bit Type Field LDT Segment Type = 0010 Task State Segment Busy task: Type = 1011 Not busy: Type = Base Access Limit Access Base Limit Access G P DPL S = 0 TYPE System Segment

5 17 18 Gate Type System Segments (S = 0) Defines indirect access for system calls CPU finds Gate in descriptor table instead of normal descriptor Gate supplies new logical address as SEG:OFFSET 4-bit Type Field Task Gate Type = 0101 Interrupt Gate Type = 0110 Call Gate Type = 1100 Word Count Number of 32-bit words to copy from User Stack to Privileged Stack Privileged Stack user stack reserved for system calls Gate Format access 0 word count selector Segment Level Memory Protection Access bit 7 bit 6,5 bit 4 bits 3, 2, 1, 0 P DPL S = 0 type For every RAM access: Hardware Enforcement Hardware compares and segment limit Access denied if > segment limit Can be no accidental segment overflow Hardware checks segment type Cannot write to a segment defined as code Cannot fetch from a data segment Cannot read, write or fetch from a system segment Access Restrictions by Privilege Every segment has a classification: privilege level required for access Classification is Descriptor Protection Level (DPL) in access field of segment descriptor Every code segment has access rights: privilege level it may access Selector in CS register points to current code segment Current Privilege Level (CPL) = DPL of current CS Instruction in the current code segment cannot: Access data if data segment's DPL < CPL Jump to (or call) a new code segment with DPL < CPL

6 21 22 Protection Rings Access Rules Ring 0 is for the OS kernel Ring 1 is for less sensitive OS functions Ring 2 is for protected user functions Ring 3 is for user programs CS selector points to Code Segment descriptor Code Segment descriptor has access rights CPL All selectors contain Request Privilege Level (RPL) Usually a copy of the CPL An instruction in current Code Segment can: 1. Access a Data Segment with DPL, 2. Jump to (or call) a new Code Segment with DPL, If DPL max (CPL, RPL) Access Granted Access Denied The Trojan Horse Problem Paging Address Translation User program denied access to a protected segment (DPL < user CPL). User program passes a pointer (selector) to that segment in a system call. The OS can access the protected segment. user protected data OS call gate The selector has a Request Protection Level (RPL) field. The OS sets RPL = user CPL in the selector (pointer). Access is permitted if and only if DPL max (CPL, RPL) page table directory base directory page byte entry + + page table directory entry page table + page main memory byte page base address page table base address directory base address

7 25 26 Virtual Address to Physical Address segment shadow register index SEGMENT:OFFSET cache descriptor in CPU descriptor table paging enabled directory page descriptor Linear Base Address + Offset Linear Address paging not enabled Physical Address Linear Address 10 bits 10 bits 12 bits directory page table directory = index into directory (4 bytes per entry) 2 10 =1024 = 1K page table entries per directory 4 bytes per entry 4 KB per directory page table = index into selected page table 4 bytes per entry 4 KB per page table = index (of byte) into selected page 2 12 =4096 = 4K byte per page Linear Address Physical Address Translation Lookaside Buffer (TLB) (address cache) 2 10 page tables 2 10 page/page table 2 12 bytes/page = 2 32 bytes Entries in Page Directory and Page Table Translation Lookaside Buffer (TLB) upper 20 bits of page table physical address OS reserved 0 D A 0 U/S R/W P D dirty bit A accessed P = 0 = swapped-out P = 1 = present Segments with DPL = 0,1,2 inherit U/S = 0 (supervisor) Segments with DPL = 3 inherit U/S = 1 (user) Supervisor code has Read/Write permission for User Read/Write permission for Supervisor data pages User code has No access to supervisor data pages Read-only access to data pages with R/W = 0 Read/write access to data pages with R/W = 1 Cache of 32 last accessed linear to physical address translations CPU begins directory/pt/page access in parallel to TLB access If linear address is in TLB, TLB responds first and cancels RAM access TLB catches 98-99% of linear address accesses

8 29 30 Paging Options in P6 Architecture New flags in processor control registers PSE (page size extensions) Bit 4 of CR4 Enables large page sizes 4 MB pages or 2 MB pages (with PAE flag set) PAE (physical address extension) Bit 5 of CR4 Enables 36-Bit Physical Addressing 32-bit linear address 36-bit physical address Enables 64-Bit Physical Addressing 32-bit linear address 64-bit physical address Status Registers Control Registers CR0: Options CR1: Reserved CR2: Last Page Fault CR3: Directory Base Address EFLAG Registers CS:EIP Call Gate Format access 0 word selector count access byte bit 7 bit 6,5 bits 4,3,2,1,0 P DPL system call selector CS Shadow Register (CS descriptor) access 0 word count selector call gate GDT System Calls User program makes a system call through a Call Gate Current code jumps or calls to a new CS:EIP in the OS CS selector points to a special descriptor (Call Gate) in the GDT or LDT Call Gate is loaded to CS Shadow Register The hardware: 1. Recognizes the descriptor as a Call Gate 2. Loads the Destination Selector from the Call Gate to CS 3. Loads the Destination Offset from the Call Gate to EIP 4. Copies parameters according to the Word Count 5. System Call runs, with its address hidden from the user

9 33 34 Interrupt Service Interrupt Handling CS:EIP Instruction INT n IDT Interrupt Gate points to the Interrupt Service Routine (ISR) CS Shadow Register (CS descriptor) access 0 word count selector Instruction INT n is executed. CS:EIP of the next instruction is pushed onto stack. Interrupt Gate at address = IDT base + n 8 loaded to CS Shadow Register. Selector and Offset from Interrupt Gate loaded to CS:EIP CS:EIP is the address of the ISR (interrupt handler) ISR finishes with IRET, which pops the previous CS:EIP interrupt gate access 0 word count selector bit 7 bit 6,5 bits 4,3,2,1,0 P DPL The Interrupt Descriptor Table (IDT) contains the Interrupt Gates The IDT linear base address and limit is in the IDT register P6 family introduces APIC (Advanced PIC) Message Service Hardware Task Creation Task defined by writing a Task State Segment (TSS) TSS holds task context All register values LDT Selector Status Word Other OS information Back link to a previous task TSS descriptor (normal descriptor) placed in GDT or LDT TSS Selector (points to TSS descriptor) written in Task Gate Task Gate placed into GDT, LDT, or IDT TSS Contents back link stacks and stack pointers for CPL = 0, 1, 2 task switch to higher privilege level causes switch to a separate stack CR3 EIP EFLAGS EAX, ECX, EBX, EDX ESP, EBP, ESI, EDI ES, CS, SS, DS, FS, GS LDT Selector OS specific information

10 37 38 Task Gate Task Switching by Jump access 0 word count selector bit 7 bit 6,5 bits 4,3,2,1,0 P DPL CS:EIP JMP selector CS Shadow Register (CS descriptor) access 0 word count selector task gate GDT TSS descriptor TSS Register TSS Shadow Register All CPU Registers Task Context TSS Task Switching by Jump No nesting back link not set Current code executes JMP to CS:EIP CS selector points to Task Gate in GDT or LDT Descriptor (Task Gate) loaded to CS Shadow Register Hardware Recognizes descriptor as Task Gate Copies context of current task to its TSS Loads Destination Selector from Task Gate to TSS Register Selector in TSS Register points to TSS descriptor Loads TSS descriptor to TSS Shadow Register Loads new context from new TSS Runs new task from CS:EIP from new task context Task Switching by Call Instruction Current code executes CALL to CS:EIP Pushes CS:EIP of next instruction onto stack CS selector points to Task Gate in GDT or LDT Descriptor (Task Gate) loaded to CS Shadow Register Hardware Recognizes descriptor as Task Gate Copies context of current task to its TSS Makes temporary copy of current TSS Register Loads Destination Selector to TSS Register Selector in TSS Register points to TSS descriptor Loads TSS descriptor to TSS Shadow Register Loads context from new TSS to run called task Writes old TSS Selector into back link of new TSS

11 41 42 Task Switching by Call Instruction Called task ends with an IRET instruction (or preemption) The hardware Copies context of new task to TSS Loads back link into TSS Register Selector in TSS Register points to previous TSS descriptor Loads previous TSS descriptor to TSS Shadow Register Loads context from previous TSS to restore previous task New Instructions for IA32 Instruction Description ARPL r/m16,r16 Adjust RPL of r/m16 to not less than RPL of r16 LAR r16,r/m16 Load Access Rights: r16 r/m16 masked by FF00H LSL r16,r/m16 Load: r16 segment limit, selector r/m16 LSL r32,r/m32 Load: r32 segment limit, selector r/m32 SGDT, SIDT m Store GDTR to m, Store IDTR to m SLDT r/m16 Stores segment selector from LDTR in r/m16 STR r/m16 Stores segment selector from Task Register in r/m16 VERR r/m16 Set ZF=1 if segment specified with r/m16 can be read VERW r/m16 Set ZF=1 if segment specified with r/m16 can be written CLTS Clears Task Switch flag in CR0 LGDT m16&32 Load m into GDTR LIDT m16&32 Load m into IDTR LLDT r/m16 Load segment selector r/m16 into LDTR LTR r/m16 Load r/m16 into task register r = register m = memory pointer 16/32 = length in bits r16={ax, CX, DX, BX, SP, BP, SI, DI} r32={eax, ECX, EDX, EBX, ESP, EBP, ESI, EDI} Real Mode Start up mode for every Intel IA 32 processor Processor runs as very fast 8086 Can access only lowest 1 MB of memory OS boot code (BIOS) must be in low memory Uses protected mode hardware in a special way Shadow Registers On Selector load, build pseudo-descriptor: Load Base Address field with Selector 10h Load Limit with FFFFh Load CS Access word with G D 0 0 P DPL S CODE C R A Load DS Access word with G P DPL S CODE ED W A SS, ES, FS, GS created as data segments

12 45 46 Before Switching To Protected Mode Build a GDT At least one Data Segment At least one Code Segment Convert 8086 ISR vectors to IA-32 IDT Build a TSS for OS scheduler Put Task Gate for TSS into GDT Build Page Tables and Directory Linear Address = Physical Addresses Write Directory Physical Address into TSS Entering Protected Mode Set flag PE to enter protected mode JMP to Task Gate in GDT Loads Task Register Selector points to TSS Descriptor CPU loads scheduler context from TSS Set flag PG to enable Paging (optional) OS scheduler is running in Protected Mode with paging Can create new processes by writing TSSs and GDT entries Load GDT register and IDT register Virtual 86 Mode Create TSS for VM86 task Clear flag PE (protected mode off real mode) Pseudo-Descriptors (real mode type) Can access 1 MB of address space Programs run as in 8086 Set flag PG (Paging Enabled) bit addresses get re-mapped All VM86 processes same address space 00000h to FFFFFh Separate Page Table Directory for each VM86 task 20-bit address space re-mapped to individual 32-bit locations Use of IA32 Resources Under Linux Hardware/Software issues Most Linux code Written in C Compiled for platform independence PC-specific aspects of Linux source code located in arch/i386 Principal Linux strategies with IA32 Ignore hardware segmentation Migration away from hardware task management Full use of hardware paging

13 49 50 IA32 Segmentation in Linux Linux prefers a flat 4 GB memory space Create a pseudo-flat address space: Linux writes 4 normal segment descriptors in GDT Code Segment for kernel mode, with DPL = 0 Data Segment for kernel mode, with DPL = 0 User Code Segment, with DPL = 3 User Data Segment, with DPL = 3 Each descriptor points to entire address range to FF FF FF FF Each base address = Each segment limit = F FF FF with granularity G = 1 Each segment size is 4 GB Task Management in Linux Early Linux kernel For every task, two system segment descriptors TSS segment descriptor LDT descriptor Hardware-based task switching Uses TSS Register pointing to TSS Descriptor to load context from TSS Places TSS Selector directly into TSS Register Does not use Task Gate mechanism Task Management in Linux 2.2 For each task LDT descriptor TSS segment descriptor Only 4090 processes may be created: GDT has room for 8192 entries ( = 64 KB) 12 entries required for user and system segment descriptors 2 entries are created for every task: ( ) / 2 = 4090 Task Management in Linux 2.4 Software-based task switching Does not use IA32 tasks for process creation Defines tasks in UNIX-style task PID tables (no limit on task number) Does not write TSS segment descriptors in the GDT Only defines an LDT if the task requires one Does not use the Task Gate mechanism Performs UNIX-style software-based context switching

14 53 54 Paging in Linux Linux uses the full paging mechanism of IA32 Maintains page tables, using a different directory base address (CR3) for each task Address compatibility with 64-bit architectures Defines a "middle directory" On 64-bit machines Linear address divided into 3 table fields and 1 field On IA32 machines Middle directory field has 0-length (entry points to page table) Kernel code and data are never swapped out Begin at 2 nd megabyte Physical base address New instruction encoding for IA-32 Instruction Types Instruction prefix changes width of default instruction Code Type Operand Width Address Width 16-bit code 16 bits 32 bits 16 bits 32 bits No Prefix 0x66 No Prefix 0x67 32-bit code No Prefix 0x66 No Prefix 0x67 32-bits 16 bits 32-bits 16 bits Example for 16-bit code With prefix 66B Without prefix B dl,[bx+di] mov eax,0x B84433 mov ax,0x and New instruction encoding for IA-32 Addressing Modes Intel Microprocessor Flexible addressing in IA-32 Example of legal address on 386 mov eax,[eax+4*edi h] On Pentium family processors, index = 1, 2, 3, 4, 8

Tutorial 10 Protection Cont.

Tutorial 10 Protection Cont. Tutorial 0 Protection Cont. 2 Privilege Levels Lower number => higher privilege Code can access data of equal/lower privilege levels only Code can call more privileged data via call gates Each level has

More information

PROTECTION CHAPTER 4 PROTECTION

PROTECTION CHAPTER 4 PROTECTION Protection 4 CHAPTER 4 PROTECTION In protected mode, the Intel Architecture provides a protection mechanism that operates at both the segment level and the page level. This protection mechanism provides

More information

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 MICROPROCESSOR ARCHITECTURE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Introduction

More information

IA32/Linux Virtual Memory Architecture

IA32/Linux Virtual Memory Architecture IA32/Linux Virtual Memory Architecture Basic Execution Environment Application Programming Registers General-purpose registers 31 0 EAX AH AL EBX BH BL ECX CH CL EDX DH DL EBP ESI EDI BP SI DI Segment

More information

iapx Systems Electronic Computers M

iapx Systems Electronic Computers M iapx Systems Electronic Computers M 1 iapx History We analyze 32 bit systems: generalization to 64 bits is straigtforward Segment Registers (16 bits) Code Segment Stack Segment Data Segment Extra Ssegment

More information

Introduction to IA-32. Jo, Heeseung

Introduction to IA-32. Jo, Heeseung Introduction to IA-32 Jo, Heeseung IA-32 Processors Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

Hardware and Software Architecture. Chapter 2

Hardware and Software Architecture. Chapter 2 Hardware and Software Architecture Chapter 2 1 Basic Components The x86 processor communicates with main memory and I/O devices via buses Data bus for transferring data Address bus for the address of a

More information

INTRODUCTION TO IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung INTRODUCTION TO IA-32 Jo, Heeseung IA-32 PROCESSORS Evolutionary design Starting in 1978 with 8086 Added more features as time goes on Still support old features, although obsolete Totally dominate computer

More information

Complex Instruction Set Computer (CISC)

Complex Instruction Set Computer (CISC) Introduction ti to IA-32 IA-32 Processors Evolutionary design Starting in 1978 with 886 Added more features as time goes on Still support old features, although obsolete Totally dominate computer market

More information

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

6/17/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Introduction This chapter presents the microprocessor

More information

Chapter 2: The Microprocessor and its Architecture

Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Chapter 2: The Microprocessor and its Architecture Introduction This chapter presents the microprocessor

More information

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR MICROPROCESSOR ARCHITECTURE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 MICROPROCESSOR ARCHITECTURE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Introduction

More information

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86 Lecture 15 Intel Manual, Vol. 1, Chapter 3 Hampden-Sydney College Fri, Mar 6, 2009 Outline 1 2 Overview See the reference IA-32 Intel Software Developer s Manual Volume 1: Basic, Chapter 3. Instructions

More information

Basic Execution Environment

Basic Execution Environment Basic Execution Environment 3 CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel Architecture processor as seen by assembly-language programmers.

More information

Microkernel Construction

Microkernel Construction Kernel Entry / Exit SS2013 Control Transfer Microkernel User Stack A Address Space Kernel Stack A User Stack User Stack B Address Space Kernel Stack B User Stack 1. Kernel Entry (A) 2. Thread Switch (A

More information

Darshan Institute of Engineering & Technology

Darshan Institute of Engineering & Technology 1. Explain 80286 architecture. OR List the four major processing units in an 80286 microprocessor and briefly describe the function of each. Ans - The 80286 was designed for multi-user systems with multitasking

More information

The x86 Architecture

The x86 Architecture The x86 Architecture Lecture 24 Intel Manual, Vol. 1, Chapter 3 Robb T. Koether Hampden-Sydney College Fri, Mar 20, 2015 Robb T. Koether (Hampden-Sydney College) The x86 Architecture Fri, Mar 20, 2015

More information

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,... COMPUTER ARCHITECTURE II: MICROPROCESSOR PROGRAMMING We can study computer architectures by starting with the basic building blocks Transistors and logic gates To build more complex circuits Adders, decoders,

More information

Microkernel Construction

Microkernel Construction Microkernel Construction Kernel Entry / Exit Nils Asmussen 05/04/2017 1 / 45 Outline x86 Details Protection Facilities Interrupts and Exceptions Instructions for Entry/Exit Entering NOVA Leaving NOVA 2

More information

MOV Move INSTRUCTION SET REFERENCE, A-M. Description. Opcode Instruction 64-Bit Mode. Compat/ Leg Mode

MOV Move INSTRUCTION SET REFERENCE, A-M. Description. Opcode Instruction 64-Bit Mode. Compat/ Leg Mode Opcode Instruction 64-Bit Mode Compat/ Leg Mode 88 /r MOV r/m8,r8 Valid Valid Move r8 to r/m8. REX + 88 /r MOV r/m8 ***, r8 *** Valid N.E. Move r8 to r/m8. 89 /r MOV r/m16,r16 Valid Valid Move r16 to r/m16.

More information

MICROPROCESSOR ALL IN ONE. Prof. P. C. Patil UOP S.E.COMP (SEM-II)

MICROPROCESSOR ALL IN ONE. Prof. P. C. Patil UOP S.E.COMP (SEM-II) MICROPROCESSOR UOP S.E.COMP (SEM-II) 80386 ALL IN ONE Prof. P. C. Patil Department of Computer Engg Sandip Institute of Engineering & Management Nashik pc.patil@siem.org.in 1 Architecture of 80386 2 ARCHITECTURE

More information

Assembler Programming. Lecture 2

Assembler Programming. Lecture 2 Assembler Programming Lecture 2 Lecture 2 8086 family architecture. From 8086 to Pentium4. Registers, flags, memory organization. Logical, physical, effective address. Addressing modes. Processor Processor

More information

The Microprocessor and its Architecture

The Microprocessor and its Architecture The Microprocessor and its Architecture Contents Internal architecture of the Microprocessor: The programmer s model, i.e. The registers model The processor model (organization) Real mode memory addressing

More information

Addressing Modes on the x86

Addressing Modes on the x86 Addressing Modes on the x86 register addressing mode mov ax, ax, mov ax, bx mov ax, cx mov ax, dx constant addressing mode mov ax, 25 mov bx, 195 mov cx, 2056 mov dx, 1000 accessing data in memory There

More information

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź

Low Level Programming Lecture 2. International Faculty of Engineerig, Technical University of Łódź Low Level Programming Lecture 2 Intel processors' architecture reminder Fig. 1. IA32 Registers IA general purpose registers EAX- accumulator, usually used to store results of integer arithmetical or binary

More information

Unit 08 Advanced Microprocessor

Unit 08 Advanced Microprocessor Unit 08 Advanced Microprocessor 1. Features of 80386 The 80386 microprocessor is an enhanced version of the 80286 microprocessor Memory-management unit is enhanced to provide memory paging. The 80386 also

More information

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Machine-level Representation of Programs Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Program? 짬뽕라면 준비시간 :10 분, 조리시간 :10 분 재료라면 1개, 스프 1봉지, 오징어

More information

Part I. X86 architecture overview. Secure Operating System Design and Implementation x86 architecture. x86 processor modes. X86 architecture overview

Part I. X86 architecture overview. Secure Operating System Design and Implementation x86 architecture. x86 processor modes. X86 architecture overview X86 architecture overview Overview Secure Operating System Design and Implementation x86 architecture Jon A. Solworth Part I X86 architecture overview Dept. of Computer Science University of Illinois at

More information

3.6. PAGING (VIRTUAL MEMORY) OVERVIEW

3.6. PAGING (VIRTUAL MEMORY) OVERVIEW an eight-byte boundary to yield the best processor performance. The limit value for the GDT is expressed in bytes. As with segments, the limit value is added to the base address to get the address of the

More information

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam

Assembly Language. Lecture 2 - x86 Processor Architecture. Ahmed Sallam Assembly Language Lecture 2 - x86 Processor Architecture Ahmed Sallam Introduction to the course Outcomes of Lecture 1 Always check the course website Don t forget the deadline rule!! Motivations for studying

More information

Code segment Stack segment

Code segment Stack segment Registers Most of the registers contain data/instruction offsets within 64 KB memory segment. There are four different 64 KB segments for instructions, stack, data and extra data. To specify where in 1

More information

IA-32 Architecture COE 205. Computer Organization and Assembly Language. Computer Engineering Department

IA-32 Architecture COE 205. Computer Organization and Assembly Language. Computer Engineering Department IA-32 Architecture COE 205 Computer Organization and Assembly Language Computer Engineering Department King Fahd University of Petroleum and Minerals Presentation Outline Basic Computer Organization Intel

More information

x86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT

x86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT x86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT kaashoek@mit.edu Outline Enforcing modularity with virtualization Virtualize processor and memory x86 mechanism for virtualization

More information

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM EXPERIMENT WRITE UP AIM: Assembly language program for 16 bit BCD addition LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM TOOLS/SOFTWARE

More information

Computer Organization (II) IA-32 Processor Architecture. Pu-Jen Cheng

Computer Organization (II) IA-32 Processor Architecture. Pu-Jen Cheng Computer Organization & Assembly Languages Computer Organization (II) IA-32 Processor Architecture Pu-Jen Cheng Materials Some materials used in this course are adapted from The slides prepared by Kip

More information

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU)

Computer Processors. Part 2. Components of a Processor. Execution Unit The ALU. Execution Unit. The Brains of the Box. Processors. Execution Unit (EU) Part 2 Computer Processors Processors The Brains of the Box Computer Processors Components of a Processor The Central Processing Unit (CPU) is the most complex part of a computer In fact, it is the computer

More information

x86 Assembly Tutorial COS 318: Fall 2017

x86 Assembly Tutorial COS 318: Fall 2017 x86 Assembly Tutorial COS 318: Fall 2017 Project 1 Schedule Design Review: Monday 9/25 Sign up for 10-min slot from 3:00pm to 7:00pm Complete set up and answer posted questions (Official) Precept: Monday

More information

Assembly Language. Lecture 2 x86 Processor Architecture

Assembly Language. Lecture 2 x86 Processor Architecture Assembly Language Lecture 2 x86 Processor Architecture Ahmed Sallam Slides based on original lecture slides by Dr. Mahmoud Elgayyar Introduction to the course Outcomes of Lecture 1 Always check the course

More information

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics

Moodle WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics Moodle 4 WILLINGDON COLLEGE SANGLI (B. SC.-II) Digital Electronics Advanced Microprocessors and Introduction to Microcontroller Moodle developed By Dr. S. R. Kumbhar Department of Electronics Willingdon

More information

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998

Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998 Scott M. Lewandowski CS295-2: Advanced Topics in Debugging September 21, 1998 Assembler Syntax Everything looks like this: label: instruction dest,src instruction label Comments: comment $ This is a comment

More information

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model SYSC3601 Microprocessor Systems Unit 2: The Intel 8086 Architecture and Programming Model Topics/Reading SYSC3601 2 Microprocessor Systems 1. Registers and internal architecture (Ch 2) 2. Address generation

More information

Information Security II Prof. Kamakoti Department of Computer Science and Engineering Indian Institute of Technology, Madras

Information Security II Prof. Kamakoti Department of Computer Science and Engineering Indian Institute of Technology, Madras Information Security II Prof. Kamakoti Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 30 Task Switch recap - Week 6 (Refer Slide Time: 00:09) So welcome back

More information

EEM336 Microprocessors I. The Microprocessor and Its Architecture

EEM336 Microprocessors I. The Microprocessor and Its Architecture EEM336 Microprocessors I The Microprocessor and Its Architecture Introduction This chapter presents the microprocessor as a programmable device by first looking at its internal programming model and then

More information

iapx86 Protection Electronic Computers M

iapx86 Protection Electronic Computers M iapx86 Protection Electronic Computers M 1 Protection Multitasking (multiple processes) > the system must prevent an uncontrolled access of a process to the memory space of another process....and that

More information

Architecture of 8086 Microprocessor

Architecture of 8086 Microprocessor MCQ on Microprocessor and Interfacing Technique S.E.Compure (Sem-II) UNIT 1 Architecture of 8086 Microprocessor 1 marks Questions 1. Which is first microprocessor? (a) 8008 (b) 8085 (c) 8086 (d) 4004 2.

More information

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017

ICS143A: Principles of Operating Systems. Midterm recap, sample questions. Anton Burtsev February, 2017 ICS143A: Principles of Operating Systems Midterm recap, sample questions Anton Burtsev February, 2017 Describe the x86 address translation pipeline (draw figure), explain stages. Address translation What

More information

The Pentium Processor

The Pentium Processor The Pentium Processor Chapter 7 S. Dandamudi Outline Pentium family history Pentium processor details Pentium registers Data Pointer and index Control Segment Real mode memory architecture Protected mode

More information

MICROPROCESSOR TECHNOLOGY

MICROPROCESSOR TECHNOLOGY MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 5 Ch.2 A Top-Level View of Computer Function (Cont.) 24-Feb-15 1 CPU (CISC & RISC) Intel CISC, Motorola RISC CISC (Complex Instruction

More information

UNIT 2 PROCESSORS ORGANIZATION CONT.

UNIT 2 PROCESSORS ORGANIZATION CONT. UNIT 2 PROCESSORS ORGANIZATION CONT. Types of Operand Addresses Numbers Integer/floating point Characters ASCII etc. Logical Data Bits or flags x86 Data Types Operands in 8 bit -Byte 16 bit- word 32 bit-

More information

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP.

UMBC. contain new IP while 4th and 5th bytes contain CS. CALL BX and CALL [BX] versions also exist. contain displacement added to IP. Procedures: CALL: Pushes the address of the instruction following the CALL instruction onto the stack. RET: Pops the address. SUM PROC NEAR USES BX CX DX ADD AX, BX ADD AX, CX MOV AX, DX RET SUM ENDP NEAR

More information

The Instruction Set. Chapter 5

The Instruction Set. Chapter 5 The Instruction Set Architecture Level(ISA) Chapter 5 1 ISA Level The ISA level l is the interface between the compilers and the hardware. (ISA level code is what a compiler outputs) 2 Memory Models An

More information

CHAPTER 3 BASIC EXECUTION ENVIRONMENT

CHAPTER 3 BASIC EXECUTION ENVIRONMENT CHAPTER 3 BASIC EXECUTION ENVIRONMENT This chapter describes the basic execution environment of an Intel 64 or I A-32 processor as seen by assemblylanguage programmers. It describes how the processor executes

More information

MODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE

MODE (mod) FIELD CODES. mod MEMORY MODE: 8-BIT DISPLACEMENT MEMORY MODE: 16- OR 32- BIT DISPLACEMENT REGISTER MODE EXERCISE 9. Determine the mod bits from Figure 7-24 and write them in Table 7-7. MODE (mod) FIELD CODES mod 00 01 10 DESCRIPTION MEMORY MODE: NO DISPLACEMENT FOLLOWS MEMORY MODE: 8-BIT DISPLACEMENT MEMORY

More information

CS 16: Assembly Language Programming for the IBM PC and Compatibles

CS 16: Assembly Language Programming for the IBM PC and Compatibles CS 16: Assembly Language Programming for the IBM PC and Compatibles Discuss the general concepts Look at IA-32 processor architecture and memory management Dive into 64-bit processors Explore the components

More information

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to:

6/20/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Introduction Efficient software development for the microprocessor requires a complete familiarity with the addressing modes employed by each instruction. This chapter explains the operation of the stack

More information

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee

Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee Lecture (02) The Microprocessor and Its Architecture By: Dr. Ahmed ElShafee ١ INTERNAL MICROPROCESSOR ARCHITECTURE Before a program is written or instruction investigated, internal configuration of the

More information

Introduction to The x86 Microprocessor

Introduction to The x86 Microprocessor Introduction to The x86 Microprocessor Prof. V. Kamakoti Digital Circuits And VLSI Laboratory Indian Institute of Technology, Madras Chennai - 600 036. http://vlsi.cs.iitm.ernet.in Protected Mode Memory

More information

Memory Models. Registers

Memory Models. Registers Memory Models Most machines have a single linear address space at the ISA level, extending from address 0 up to some maximum, often 2 32 1 bytes or 2 64 1 bytes. Some machines have separate address spaces

More information

Interfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer?

Interfacing Compiler and Hardware. Computer Systems Architecture. Processor Types And Instruction Sets. What Instructions Should A Processor Offer? Interfacing Compiler and Hardware Computer Systems Architecture FORTRAN 90 program C++ program Processor Types And Sets FORTRAN 90 Compiler C++ Compiler set level Hardware 1 2 What s Should A Processor

More information

Northern India Engineering College, Delhi (GGSIP University) PAPER I

Northern India Engineering College, Delhi (GGSIP University) PAPER I PAPER I Q1.Explain IVT? ANS. interrupt vector table is a memory space for storing starting addresses of all the interrupt service routine. It stores CS:IP PAIR corresponding to each ISR. An interrupt vector

More information

2.5 Address Space. The IBM 6x86 CPU can directly address 64 KBytes of I/O space and 4 GBytes of physical memory (Figure 2-24).

2.5 Address Space. The IBM 6x86 CPU can directly address 64 KBytes of I/O space and 4 GBytes of physical memory (Figure 2-24). Address Space 2.5 Address Space The IBM 6x86 CPU can directly address 64 KBytes of I/O space and 4 GBytes of physical memory (Figure 2-24). Memory Address Space. Access can be made to memory addresses

More information

3. Process Management in xv6

3. Process Management in xv6 Lecture Notes for CS347: Operating Systems Mythili Vutukuru, Department of Computer Science and Engineering, IIT Bombay 3. Process Management in xv6 We begin understanding xv6 process management by looking

More information

Advanced Microprocessors

Advanced Microprocessors Advanced Microprocessors Notes #2 Software Architecture & Instruction Set Architecture Part 1 EE 467/567 Winter 2012 by Avinash Kodi SWA.1 Background Materials Textbook: 2.1, 2.2, 3.1 Other: IA-32 Intel

More information

BOOTSTRAP, PC BIOS, AND IA32 MEMORY MODES. CS124 Operating Systems Winter , Lecture 5

BOOTSTRAP, PC BIOS, AND IA32 MEMORY MODES. CS124 Operating Systems Winter , Lecture 5 BOOTSTRAP, PC BIOS, AND IA32 MEMORY MODES CS124 Operating Systems Winter 2015-2016, Lecture 5 2 Bootstrapping All computers have the same basic issue: They require a program to tell them what to do but

More information

MICROPROCESSOR TECHNOLOGY

MICROPROCESSOR TECHNOLOGY MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 16 Ch.7 The 80386 and 80486 Microprocessors 21-Apr-15 1 System Descriptors The system descriptor defines information about the system

More information

Module 3 Instruction Set Architecture (ISA)

Module 3 Instruction Set Architecture (ISA) Module 3 Instruction Set Architecture (ISA) I S A L E V E L E L E M E N T S O F I N S T R U C T I O N S I N S T R U C T I O N S T Y P E S N U M B E R O F A D D R E S S E S R E G I S T E R S T Y P E S O

More information

EC-333 Microprocessor and Interfacing Techniques

EC-333 Microprocessor and Interfacing Techniques EC-333 Microprocessor and Interfacing Techniques Lecture 3 The Microprocessor and its Architecture Dr Hashim Ali Fall - 2018 Department of Computer Science and Engineering HITEC University Taxila Slides

More information

Mechanisms for entering the system

Mechanisms for entering the system Mechanisms for entering the system Yolanda Becerra Fontal Juan José Costa Prats Facultat d'informàtica de Barcelona (FIB) Universitat Politècnica de Catalunya (UPC) BarcelonaTech 2017-2018 QP Content Introduction

More information

x86 architecture et similia

x86 architecture et similia x86 architecture et similia 1 FREELY INSPIRED FROM CLASS 6.828, MIT A full PC has: PC architecture 2 an x86 CPU with registers, execution unit, and memory management CPU chip pins include address and data

More information

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-11: 80x86 Architecture

ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-11: 80x86 Architecture ADVANCED PROCESSOR ARCHITECTURES AND MEMORY ORGANISATION Lesson-11: 80x86 Architecture 1 The 80x86 architecture processors popular since its application in IBM PC (personal computer). 2 First Four generations

More information

icroprocessor istory of Microprocessor ntel 8086:

icroprocessor istory of Microprocessor ntel 8086: Microprocessor A microprocessor is an electronic device which computes on the given input similar to CPU of a computer. It is made by fabricating millions (or billions) of transistors on a single chip.

More information

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University

COS 318: Operating Systems. Overview. Prof. Margaret Martonosi Computer Science Department Princeton University COS 318: Operating Systems Overview Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Announcements Precepts: Tue (Tonight)!

More information

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017

CS 31: Intro to Systems ISAs and Assembly. Martin Gagné Swarthmore College February 7, 2017 CS 31: Intro to Systems ISAs and Assembly Martin Gagné Swarthmore College February 7, 2017 ANNOUNCEMENT All labs will meet in SCI 252 (the robot lab) tomorrow. Overview How to directly interact with hardware

More information

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1

Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD /12/2014 Slide 1 Dr. Ramesh K. Karne Department of Computer and Information Sciences, Towson University, Towson, MD 21252 rkarne@towson.edu 11/12/2014 Slide 1 Intel x86 Aseembly Language Assembly Language Assembly Language

More information

Protection and System Calls. Otto J. Anshus

Protection and System Calls. Otto J. Anshus Protection and System Calls Otto J. Anshus Protection Issues CPU protection Prevent a user from using the CPU for too long Throughput of jobs, and response time to events (incl. user interactive response

More information

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

X86 Addressing Modes Chapter 3 Review: Instructions to Recognize X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src

More information

143A: Principles of Operating Systems. Lecture 6: Address translation. Anton Burtsev January, 2017

143A: Principles of Operating Systems. Lecture 6: Address translation. Anton Burtsev January, 2017 143A: Principles of Operating Systems Lecture 6: Address translation Anton Burtsev January, 2017 Address translation Segmentation Descriptor table Descriptor table Base address 0 4 GB Limit

More information

BASIC INTERRUPT PROCESSING

BASIC INTERRUPT PROCESSING Interrupts BASIC INTERRUPT PROCESSING This section discusses the function of an interrupt in a microprocessor-based system. Structure and features of interrupts available to Intel microprocessors. The

More information

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit

Assembly Language for Intel-Based Computers, 4 th Edition. Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 2: IA-32 Processor Architecture Included elements of the IA-64 bit Slides prepared by Kip R. Irvine Revision date: 09/25/2002

More information

Assembly Language for Intel-Based Computers, 4 th Edition. Kip R. Irvine. Chapter 2: IA-32 Processor Architecture

Assembly Language for Intel-Based Computers, 4 th Edition. Kip R. Irvine. Chapter 2: IA-32 Processor Architecture Assembly Language for Intel-Based Computers, 4 th Edition Kip R. Irvine Chapter 2: IA-32 Processor Architecture Chapter Overview General Concepts IA-32 Processor Architecture IA-32 Memory Management Components

More information

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions. 8086 Microprocessor Microprocessor Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions. It is used as CPU (Central Processing Unit) in computers.

More information

Instruction Set Architectures

Instruction Set Architectures Instruction Set Architectures Computer Systems: Section 4.1 Suppose you built a computer What Building Blocks would you use? Arithmetic Logic Unit (ALU) OP1 OP2 OPERATION ALU RES ALU + Registers R0: 0x0000

More information

Lab 2: Introduction to Assembly Language Programming

Lab 2: Introduction to Assembly Language Programming COE 205 Lab Manual Lab 2: Introduction to Assembly Language Programming - page 16 Lab 2: Introduction to Assembly Language Programming Contents 2.1. Intel IA-32 Processor Architecture 2.2. Basic Program

More information

Operating Systems Engineering Recitation #3 (part 2): Interrupt and Exception Handling on the x86. (heavily) based on MIT 6.

Operating Systems Engineering Recitation #3 (part 2): Interrupt and Exception Handling on the x86. (heavily) based on MIT 6. 236366 Operating Systems Engineering Recitation #3 (part 2): Interrupt and Exception Handling on the x86 (heavily) based on MIT 6.828 (2005, lec8) x86 Interrupt Nomenclature Hardware Interrupt (external)

More information

Reverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher

Reverse Engineering II: Basics. Gergely Erdélyi Senior Antivirus Researcher Reverse Engineering II: Basics Gergely Erdélyi Senior Antivirus Researcher Agenda Very basics Intel x86 crash course Basics of C Binary Numbers Binary Numbers 1 Binary Numbers 1 0 1 1 Binary Numbers 1

More information

Chapter 3: Addressing Modes

Chapter 3: Addressing Modes Chapter 3: Addressing Modes Chapter 3 Addressing Modes Note: Adapted from (Author Slides) Instructor: Prof. Dr. Khalid A. Darabkh 2 Introduction Efficient software development for the microprocessor requires

More information

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents.

UMBC. A register, an immediate or a memory address holding the values on. Stores a symbolic name for the memory location that it represents. Intel Assembly Format of an assembly instruction: LABEL OPCODE OPERANDS COMMENT DATA1 db 00001000b ;Define DATA1 as decimal 8 START: mov eax, ebx ;Copy ebx to eax LABEL: Stores a symbolic name for the

More information

Reverse Engineering II: The Basics

Reverse Engineering II: The Basics Reverse Engineering II: The Basics Gergely Erdélyi Senior Manager, Anti-malware Research Protecting the irreplaceable f-secure.com Binary Numbers 1 0 1 1 - Nibble B 1 0 1 1 1 1 0 1 - Byte B D 1 0 1 1 1

More information

143A: Principles of Operating Systems. Lecture 5: Address translation. Anton Burtsev October, 2018

143A: Principles of Operating Systems. Lecture 5: Address translation. Anton Burtsev October, 2018 143A: Principles of Operating Systems Lecture 5: Address translation Anton Burtsev October, 2018 Two programs one memory Or more like renting a set of rooms in an office building Or more like renting a

More information

Assembly Language Each statement in an assembly language program consists of four parts or fields.

Assembly Language Each statement in an assembly language program consists of four parts or fields. Chapter 3: Addressing Modes Assembly Language Each statement in an assembly language program consists of four parts or fields. The leftmost field is called the label. - used to identify the name of a memory

More information

W4118: interrupt and system call. Junfeng Yang

W4118: interrupt and system call. Junfeng Yang W4118: interrupt and system call Junfeng Yang Outline Motivation for protection Interrupt System call 2 Need for protection Kernel privileged, cannot trust user processes User processes may be malicious

More information

CS3210: Booting and x86. Taesoo Kim

CS3210: Booting and x86. Taesoo Kim 1 CS3210: Booting and x86 Taesoo Kim 2 What is an operating system? e.g. OSX, Windows, Linux, FreeBSD, etc. What does an OS do for you? Abstract the hardware for convenience and portability Multiplex the

More information

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Contents at a Glance About the Author...xi

More information

16.317: Microprocessor Systems Design I Fall 2013

16.317: Microprocessor Systems Design I Fall 2013 16.317: Microprocessor Systems Design I Fall 2013 Exam 2 Solution 1. (20 points, 5 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling

More information

CS3210: Booting and x86

CS3210: Booting and x86 CS3210: Booting and x86 Lecture 2 Instructor: Dr. Tim Andersen 1 / 34 Today: Bootstrapping CPU -> needs a first instruction Memory -> needs initial code/data I/O -> needs to know how to communicate 2 /

More information

Chapter 11. Addressing Modes

Chapter 11. Addressing Modes Chapter 11 Addressing Modes 1 2 Chapter 11 11 1 Register addressing mode is the most efficient addressing mode because the operands are in the processor itself (there is no need to access memory). Chapter

More information

16-Bit Intel Processor Architecture

16-Bit Intel Processor Architecture IBM-PC Organization 16-Bit Intel Processor Architecture A-16 bit microprocessor can operate on 16 bits of data at a time. 8086/8088 have the simplest structure 8086/8088 have the same instruction set,

More information

Assembly I: Basic Operations. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Assembly I: Basic Operations. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Assembly I: Basic Operations Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Basic Execution Environment RAX RBX RCX RDX RSI RDI RBP RSP R8 R9 R10

More information

Registers. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth

Registers. Ray Seyfarth. September 8, Bit Intel Assembly Language c 2011 Ray Seyfarth Registers Ray Seyfarth September 8, 2011 Outline 1 Register basics 2 Moving a constant into a register 3 Moving a value from memory into a register 4 Moving values from a register into memory 5 Moving

More information

CMSC Lecture 03. UMBC, CMSC313, Richard Chang

CMSC Lecture 03. UMBC, CMSC313, Richard Chang CMSC Lecture 03 Moore s Law Evolution of the Pentium Chip IA-32 Basic Execution Environment IA-32 General Purpose Registers Hello World in Linux Assembly Language Addressing Modes UMBC, CMSC313, Richard

More information