CS 3803 Lab 6 Interrupts Assigned 2/25/10 Point Value: 30

Size: px
Start display at page:

Download "CS 3803 Lab 6 Interrupts Assigned 2/25/10 Point Value: 30"

Transcription

1 CS 3803 Lab 6 Interrupts Assigned 2/25/10 Point Value: 30 Purpose Interrupts are crucial to an operating system. They are used to get status and data from the timer, keyboard, and disk drives to mention a few. In this lab we will learn how to set up protected mode interrupts for the INTEL processor. A significant portion of this lab is based on the material in Fundamentals of Embedded Software by Daniel Lewis. Overview of interrupts The INTEL 8253 Programmable Interrupt Controller (PIC) is used in the PC to handle interrupts from external devices such as the timer and the keyboard. The PIC will handle interrupt requests (IRQs) from an external device, prioritize the request, and then inform the CPU of the interrupts. The PIC will send a signal to the CPU that an interrupt has occurred. The CPU will complete the execution of the current instruction and then send a signal back to the PIC informing the PIC that is ready to receive the interrupt. The PIC will then place the interrupt number on a data bus which the CPU will then read. The CPU will use the interrupt number as an index into the Interrupt Descriptor Table (IDT). The IDT is a structure used by the INTEL processor to handle interrupts in protected mode. The table contains up to 256 interrupt descriptors each of which point to the location of an Interrupt Service Routine (ISR). The CPU will index to a descriptor in the IDT and then transfer control to the ISR. When control is passed to an ISR, interrupts are disabled. If warranted, the ISR will reenable interrupts, process the interrupt, and then send an interrupt acknowledge signal to the PIC. The CPU will then return control to the program that was interrupted. When the PIC receives the acknowledgement, it will send other interrupts to the CPU if any are present. There are three classes of interrupts: Processor exceptions Hardware interrupts Software interrupts Processor interrupts include such actions as divided by zero and addressing outside of a segment limit. There will be about 20 processor interrupts that we will address. 1

2 A software interrupt is invoked by the INT instruction. We will not address these types of interrupts in this lab. Hardware interrupts are those that are requested from an external device such as the timer or keyboard. In this lab we will learn how to handle keyboard interrupts. Setting up the IDT The IDT is a table with a maximum of 256 descriptors. The descriptors contain the information needed to transfer control to an ISR. A descriptor is an 8 byte structure. There are three types of descriptors: Task Gate descriptor Trap Gate descriptor Interrupt Gate descriptor In this lab we will work with Interrupt Gate descriptors. We will use the IDT_DESCRIPTOR C declaration: typedef struct IDT_DESCRIPTOR WORD16 offset_0 ; /* Offset, bits 15-0 */ WORD16 selector ; /* Selector value */ BYTE8 not_used ; /* Must be set to 0's */ BYTE8 flags ; /* Access rights, etc. */ WORD16 offset_16; /* Offset, bits */ attribute ((packed)) IDT_DESCRIPTOR ; The fields, offset_0 and offset_16, contain the offset of the ISR pointed to by the selector field. The selector is an entry in the Global Descriptor Table (GDT). The GDT was setup by GRUB to contain a segment of memory for our kernel. The IDT's selector points to this area of memory. The selector contains information such as the base address, length, and protection for this segment of memory. In a later lab we will examine the GDT in more depth. The flags field of the descriptor is concerned with access rights for the ISR. The IDT is an array declared as: IDT_DESCRIPTOR idt[256]; We need to initialize the IDT before we can use it. The Init_IDT function sets up the IDT. The if statement is used to determine if the interrupt handles processor exceptions (INTEL_INT) or hardware exceptions (PIC1_INT and PIC2_INT). We are interested in 2

3 the PIC interrupts. In this function, the hardware exceptions are set to ISRs that do nothing. Later we will reset them to meet our needs. A more complete set of code to initialize the IDT is found in Appendix A. void Init_IDT(void) extern void ISR_PIC1(void) asm("isr_pic1") ; extern void ISR_PIC2(void) asm("isr_pic2") ; IDT_DESCRIPTOR *p ; int i ; p = idt ; for (i = 0; i < ENTRIES(idt); i++, p++) ISR isr ; p->selector = code_selector ; p->not_used = 0x00 ; p->flags = 0x8E ; if (INTEL_INT(i)) isr = _intel_isr[i] ; else if (PIC1_INT(i)) isr = ISR_PIC1 ; else if (PIC2_INT(i)) isr = ISR_PIC2 ; else isr = ISR_User ; p->offset_0 = ((WORD16 *) &isr)[0] ; p->offset_16 = ((WORD16 *) &isr)[1] ; asm volatile ("lidt %0" : : "m" (idt_info)) ; To initialize the IDT to handle a different ISR the SetISR function is used. The function is passed an index into the IDT table and the address of the ISR. The address of the ISR is assigned to the offsets fields. typedef void (*ISR)(void) ; /* Pointer to an ISR */ void SetISR(int int_numb, ISR isr) IDT_DESCRIPTOR *p = &idt[int_numb] ; p->offset_0 = ((WORD16 *) &isr)[0] ; p->offset_16 = ((WORD16 *) &isr)[1] ; Other code of interest is shown below: 3

4 GLOBAL ISR_PIC1 ISR_PIC1: PUSH EAX MOV AL,20h OUT 020h,AL POP EAX IRET GLOBAL ISR_PIC2 ISR_PIC2: PUSH EAX MOV AL,20h OUT 020h,AL OUT 0A0h,AL POP EAX IRET SECTION.data ; ; Global Descriptor Table (GDT) ; gdt_info: DW (3*8)-1; 16-bit GDT limit DD gdt ; 32-bit GDT address gdt: null_descriptor: DW 0 ; seg length <0..15> DW 0 ; base address <0..15> DB 0 ; base address <16..23> DB 0 ; seg type and misc flags DB 0 ; seg length <16..19> & access flags DB 0 ; base address <24..31> code_descriptor: DW 0FFFFh ; seg length <0..15> DW 0 ; base address <0..15> DB 0 ; base address <16..23> DB 09Ah ; seg type and misc flags DB 0CFh ; seg length <16..19> & access flags DB 0 ; base address <24..31> data_descriptor: 4

5 DW 0FFFFh ; seg length <0..15> DW 0 ; base address <0..15> DB 0 ; base address <16..23> DB 092h ; seg type and misc flags DB 0CFh ; seg length <16..19> & access flags DB 0 ; base address <24..31> CODE_SELECTOR EQU code_descriptor - gdt DATA_SELECTOR EQU data_descriptor - gdt GLOBAL code_selector ; (Needed in init-idt.c) code_selector: DW CODE_SELECTOR Exercise 1 Create a new directory for Lab 5 and copy the files from your Lab 4 into this new directory. On the common drive is a set of starter files. Two of these files are init-idt.c and isr.asm. These files contain the code needed to initialize the IDT. Modify your files to use the lib.h file. This file contains common declarations that we will use for this and subsequent labs. lib.h is found in Appendix B. Add a dummy function to your kernel.c file for an enqueue function that we will use later in this lab. It signature is: BOOL Enqueue(int scancode) BOOL Enqueue(int scancode) return TRUE; asm("enqueue"); Re-assemble or compile these files. Link these files to your kernel. You will need to modify the link command to include the new.o files. At this point we have not called the Init_IDT function. Execute your kernel to make sure that it is still working properly. 5

6 Keyboard Interrupts Modern PCs have two PICs. The first is used to handle typical hardware interrupts. The second is used to handle additional interrupts and is cascaded off of the first PIC. To program the 8259 PICs, a series of up to 4 Initialization Command Words (ICW) are sent to each PIC. This is followed by up to 4 Operation Command Words (OCW) that are used to control the modes used by the PIC such as which interrupts are masked initially. Of interest to us in this lab are ICW2 and OCW1. ICW2 is used to inform the PIC what number should be passed to the CPU on the data bus when an interrupt is generated. When we initialized the IDT, specific entries were set aside for hardware interrupts. Specifically, entries 240 through 247 were set aside for PIC1 interrupts. PCs use IRQ0 for timer interrupts and IRQ1 for keyboard interrupts. How does the PIC know to send an interrupt number of 240 for a timer interrupt and a 241 for a keyboard interrupt? The answer is: ICW2 contains the base number for interrupts supported by the PIC. The IRQ number is added to the base number. The result is then sent to the CPU which uses it as in index into the IDT. Another function of the PIC is to mask off interrupts. OCW1 is used to control which IRQs are handled by the first PIC. The Init8259 function initializes the PICs and sets up the initial masks. These can be changed later as needed. The source code is found in Appendix C. Exercise 2 Add INIT8259.c to your Lab 4 directory. Call Init8259 from your kernel. Compile INIT8259.c and link it to your kernel. Execute your kernel to make sure that it is still working properly. Enabling Keyboard Interrupts To enable keyboard interrupts we need to create the keyboard ISR, modify the IDT to handle the ISR, and to unmask the PIC to enable the interrupts. Most ISRs are written in assembler unless the C complier supports the creation of interrupts. One approach is to write the interrupt portions of the interrupt in assembler and then call a C function to perform the intended functionality of the interrupt. This is the approach that we will take. 6

7 When an interrupt occurs, the CPU will disable interrupts. Depending on the nature of the interrupt, an ISR will: Save relevant registers Process the interrupt Re-enable interrupts (STI) Send an End-Of-Interrupt (EOI) command to the PIC And then return using the IRET instruction. STI is used at the beginning of an ISR if it wants to permit other interrupts to occur. IRET is needed instead of RET so that the CPU can correctly restore the program stack and return control to the interrupted program. A keyboard interrupt routine is provided. It saves the EAX register and then restores it before the routine returns. It checks to see if data is ready. If data is ready, it calls the C function, Enqueue, to save the character. In either case, it then sends the EOI command to the PIC. KeyboardISR: STI PUSHA IN AL,64h ; Keyboard Status Port AND AL,01h ; Data Ready? JZ KybdISR1 IN AL,60h ; Keyboard Data Port MOVZX EAX,AL PUSH EAX CALL Enqueue ADD ESP,4 KybdISR1: MOV AL,20h ;EOI command OUT 020h,AL POPA IRET In order to use this ISR, we will use the SetISR function to modify the IDT and then unmask IRQ1 so that keyboard interrupts are enabled. Add the InstallKeyboardISR function to your kernel and call the function after the Init8259 function call. Port 0x21 returns the current mask settings. Writing to port 0x21 will set the mask settings for the PIC. 7

8 extern void KeyboardISR(void) asm ("KeyboardISR") ; void InstallKeyboardISR(void) SetISR(IRQ2INT(IRQ_KYBD), KeyboardISR) ; outportb(0x21, inportb(0x21) & ~0x02) ; /* Unmask IRQ1 (Keyboard) */ Exercise 3 In your kernel call Init_IDT and then InstallKeyboardISR. Create a keyboard buffer with supporting Enqueue and Dequeue functions. Enqueue Add a character to the buffer Dequeue Removes character from the buffer The buffer should be a simple wrap-around array that is non-blocking. If the buffer is full, then the Enqueue function will return without adding a character. The character will be lost. If the buffer is empty, the Dequeue function should return 0. NOTE: It is important to disable interrupts around critical sections of code. The best way of doing this is to use: PUSHF ; CLI ; before the code and then use POPF ; STI; after the code. I recommend doing this for the enqueue and dequeue functions. I would also add it to the update_cursor function for the four outportb calls. The PUSHF, POPF, CLI, and STI statements are in-line assembly declarations for their equivalent assembly language instructions. The definitions of these functions are found in lib.h. To make the Enqueue function visible to the keyboard ISR, use the following statement before your definition of Enqueue: 8

9 BOOL Enqueue(BYTE8 scan_code) asm("enqueue") ; Modify your getchar function to use the dequeue function instead of polling the keyboard as you did in Lab3. Execute your kernel to make sure that it functions the same way that Lab 3 did except now your are using interrupts. 9

10 Appendix A /* ============================================================ */ /* File: INIT-IDT.C */ /* */ /* ============================================================ */ #include "lib.h" #define _HW_INT_BASE (256-16) /* Use last 16 vectors */ /* */ /* Format of an entry in the Interrupt Descriptor Table (IDT). */ /* Note: Not needed if you use SetISR (see below). */ /* */ typedef struct IDT_DESCRIPTOR WORD16 offset_0 ; /* Offset, bits 15-0 */ WORD16 selector ; /* Selector value */ BYTE8 not_used ; /* Must be set to 0's */ BYTE8 flags; /* Access rights, etc. */ WORD16 offset_16; /* Offset, bits */ attribute ((packed)) IDT_DESCRIPTOR ; /* */ /* Operand used by the LIDT instruction. */ /* Note: Not needed if you use SetISR (see below). */ /* */ typedef struct IDT_INFO WORD16 limit ; DWORD32 addrs ; attribute ((packed)) IDT_INFO ; extern WORD16 code_selector asm ("code_selector") ; #define INTEL_INT(n) (0 <= n && n < 32) #define PIC1_INT(n) (IRQ2INT(0) <= n && n <= IRQ2INT(7)) #define PIC2_INT(n) (IRQ2INT(8) <= n && n <= IRQ2INT(15)) #define PRIVATE static PRIVATE void Abort(char *msg) CLI ; print(msg) ; print("; system halted.") ; for (;;) ; PRIVATE void ISR00(void) Abort("Divide error"); PRIVATE void ISR01(void) Abort("Debug Interrupt"); PRIVATE void ISR02(void) Abort("Non-Maskable Interrupt"); PRIVATE void ISR03(void) Abort("Breakpoint Interrupt"); PRIVATE void ISR04(void) Abort("Overflow"); PRIVATE void ISR05(void) Abort("BOUND Range Exceeded"); 10

11 PRIVATE void ISR06(void) Abort("Invalid Opcode"); PRIVATE void ISR07(void) Abort("No Math CoProcessor"); PRIVATE void ISR08(void) Abort("Double Fault"); PRIVATE void ISR09(void) Abort("Math CoProcessor Overrun"); PRIVATE void ISR10(void) Abort("Invalid TSS"); PRIVATE void ISR11(void) Abort("Segment Not Present"); PRIVATE void ISR12(void) Abort("Stack Segment Fault"); PRIVATE void ISR13(void) Abort("General Protection"); PRIVATE void ISR14(void) Abort("Page Fault"); PRIVATE void ISR16(void) Abort("Math CoProcessor Error"); PRIVATE void ISR17(void) Abort("Alignment Check"); PRIVATE void ISR18(void) Abort("Machine Check"); PRIVATE void ISR19(void) Abort("SIMD floating-point exception"); PRIVATE void ISR_Rsvd(void) Abort("Intel Reserved Interrupt"); PRIVATE void ISR_User(void) Abort("Unassigned Interrupt"); PRIVATE ISR _intel_isr[] = ISR00, /* Divide by zero */ ISR01, /* Debug exception */ ISR02, /* NMI */ ISR03, /* One byte interrupt */ ISR04, /* Interrupt on overflow */ ISR05, /* Array bounds error */ ISR06, /* Invalid opcode */ ISR07, /* Math not available */ ISR08, /* Double fault */ ISR09, /* Math segment overflow */ ISR10, /* Invalid TSS */ ISR11, /* Segment not present */ ISR12, /* Stack fault */ ISR13, /* General protection */ ISR14, /* Page fault */ ISR16, /* Math error */ ISR17, /* Alignment Check */ ISR18, /* Machine Check */ ISR19, /* SIMD floating-point except.*/ ISR_Rsvd /* Reserved */ ; PRIVATE IDT_DESCRIPTOR idt[256] ; PRIVATE IDT_INFO idt_info = sizeof(idt) - 1, (DWORD32) idt ; int IRQ2INT(int irq) 11

12 return _HW_INT_BASE + irq ; ISR GetISR(int int_numb) IDT_DESCRIPTOR *p = &idt[int_numb] ; DWORD32 offset ; offset = (((DWORD32) p->offset_16) << 16) + p->offset_0 ; return (ISR) offset ; void SetISR(int int_numb, ISR isr) IDT_DESCRIPTOR *p = &idt[int_numb] ; p->offset_0 = ((WORD16 *) &isr)[0] ; p->offset_16 = ((WORD16 *) &isr)[1] ; /* Hide this function's name from C programs! */ //void Init_IDT(void) asm ("Init_IDT") ; void Init_IDT(void) extern void ISR_PIC1(void) asm("isr_pic1") ; extern void ISR_PIC2(void) asm("isr_pic2") ; IDT_DESCRIPTOR *p ; int i ; p = idt ; for (i = 0; i < ENTRIES(idt); i++, p++) ISR isr ; p->selector = code_selector ; p->not_used = 0x00 ; p->flags = 0x8E ; if (INTEL_INT(i)) isr = _intel_isr[i] ; else if (PIC1_INT(i)) isr = ISR_PIC1 ; else if (PIC2_INT(i)) isr = ISR_PIC2 ; else isr = ISR_User ; p->offset_0 = ((WORD16 *) &isr)[0] ; p->offset_16 = ((WORD16 *) &isr)[1] ; asm volatile ("lidt %0" : : "m" (idt_info)) ; 12

13 Appendix B /* ============================================================ */ /* File: lib.h */ /* */ /* ============================================================ */ #ifndef LIB_H /* Avoid multiple inclusions */ #definelib_h /* A few data types to make the operand size more obvious. */ typedef int BOOL ; typedef unsigned char BYTE8 ; typedef unsigned short int WORD16 ; typedef unsigned long int DWORD32 ; typedef void (*ISR)(void) ; /* Pointer to an ISR */ #define BYTE unsigned char #define WORD unsigned short #define DWORD unsigned int /* Constants for use with data type BOOL (above). */ #ifndef TRUE #definetrue 1 #endif #ifndef FALSE #definefalse 0 #endif /* Macros to extract the LSByte and MSByte of a WORD16 value */ #definelsb(u) ((u) & 0xFF) #definemsb(u) ((u) >> 8) /* Returns number of elements in an array. (Use in for loops.) */ #defineentries(a) (sizeof(a)/sizeof(a[0])) 13

14 /* Declaration prefix to hide an object from the linker. */ #defineprivate static /* Define a NULL pointer. */ #ifndef NULL #definenull ((void *) 0) #endif /* 386 instructions needed when writing ISR's. Note that IRET */ /* pops the pointer to the stack frame that was established by */ /* code that the compiler generates at every function entry. */ #definepushcs asm volatile ("PUSHL %CS") ; #definepushf asm volatile ("PUSHFL") #definepopf asm volatile ("POPFL") #definesti asm volatile ("STI") #definecli asm volatile ("CLI") #definepusha asm volatile ("PUSHAL") #definepopa asm volatile ("POPAL") #defineenter asm volatile ("ENTER $0,$0") #defineleave asm volatile ("LEAVE") #defineiret asm volatile ("IRET") /* Support for functions implemented in IO.ASM */ void outportb(word16, BYTE8) ; BYTE8 inportb(word16) ; int IRQ2INT(int irq) ; ISR GetISR(int int_numb) ; void SetISR(int int_numb, ISR isr) ; /* Support for functions implemented in KEYBOARD.C */ BYTE8 GetScanCode(void) ; BOOL ScanCodeRdy(void) ; BOOL SetsKybdState(BYTE8) ; WORD16 ScanCode2Ascii(BYTE8 code) ; #endif 14

15 Appendix C INIT8259.C /* */ /* File: INIT8259.C */ /* */ /* */ #include "lib.h" #define PIC1_BASE_VCTR IRQ2INT(0) #define PIC2_BASE_VCTR IRQ2INT(8) /* 8259 Command and Data ports... */ #define PIC1_CMND 0x20 #define PIC1_DATA 0x21 #define PIC2_CMND 0xA0 #define PIC2_DATA 0xA1 /* Bit fields in 1st Control Word (ICW1) */ #define ICW1_USE_ICW4 0x01 /* 0/1 => ICW4 no/yes */ #define ICW1_SINGLE 0x02 /* 0/1 => cascaded/single PICs */ #define ICW1_INTERVAL4 0x04 /* 0/1 => MOD 8/4 vectors */ #define ICW1_LEVEL 0x08 /* 0/1 => Edge/Level triggered */ #define ICW1_INIT 0x10 /* 1 => Initialization */ #define ICW1_BASE_VCTR 0xE0 /* Bit field (not value) */ /* Bit fields in 2nd Control Word (ICW2) */ #define ICW2_BASE_VCTR 0xFF /* Bit field (not value) */ /* Bit fields in 3rd Control Word (ICW3) */ #define ICW3_SLAVE_ID 0x07 /* Bit field (not value) */ #define ICW3_IR7_SLAVE 0x80 #define ICW3_IR6_SLAVE 0x40 #define ICW3_IR5_SLAVE 0x20 #define ICW3_IR4_SLAVE 0x10 #define ICW3_IR3_SLAVE 0x08 #define ICW3_IR2_SLAVE 0x04 #define ICW3_IR1_SLAVE 0x02 #define ICW3_IR0_SLAVE 0x01 /* Bit fields in 4th Control Word (ICW4) */ #define ICW4_8086 0x01 /* 8086/88 (MCS-80/85) mode */ #define ICW4_AUTO 0x02 /* Auto (normal) EOI */ 15

16 #define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */ #define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */ #define ICW4_SFNM 0x10 /* Special fully nested (not) */ #define PIC1_ICW1 (ICW1_INIT ICW1_USE_ICW4) #define PIC1_ICW2 PIC1_BASE_VCTR #define PIC1_ICW3 ICW3_IR2_SLAVE #define PIC1_ICW4 ICW4_8086 #define PIC2_ICW1 (ICW1_INIT ICW1_USE_ICW4) #define PIC2_ICW2 PIC2_BASE_VCTR #define PIC2_ICW3 2 /* PIC2 Slave ID # */ #define PIC2_ICW4 ICW4_8086 #define PIC1_OCW1 0xFB /* Mask interrupts except PIC2 */ #define PIC2_OCW1 0xFF /* Mask off all interrupts */ /* Hide this function's name from C programs! */ //void Init8259(void) asm ("Init8259") ; void Init8259(void) PUSHF ; CLI ; outportb(pic1_cmnd, PIC1_ICW1) ; outportb(pic2_cmnd, PIC2_ICW1) ; /* Position hardware vectors just after Intel vectors */ outportb(pic1_data, PIC1_ICW2) ; outportb(pic2_data, PIC2_ICW2) ; /* Master: 20h/21h (ch 2), Slave: A0h/A1h (ID #2) */ outportb(pic1_data, PIC1_ICW3) ; outportb(pic2_data, PIC2_ICW3) ; /* 8086 mode (use vectors) */ outportb(pic1_data, PIC1_ICW4) ; outportb(pic2_data, PIC2_ICW4) ; /* mask all interrupts */ outportb(pic1_data, PIC1_OCW1) ; outportb(pic2_data, PIC2_OCW1) ; POPF ; 16

The K Project. Interrupt and Exception Handling. LSE Team. May 14, 2018 EPITA. The K Project. LSE Team. Introduction. Interrupt Descriptor Table

The K Project. Interrupt and Exception Handling. LSE Team. May 14, 2018 EPITA. The K Project. LSE Team. Introduction. Interrupt Descriptor Table and Exception Handling EPITA May 14, 2018 (EPITA) May 14, 2018 1 / 37 and Exception Handling Exception : Synchronous with program execution (e.g. division by zero, accessing an invalid address) : Asynchronous

More information

+ Overview. Projects: Developing an OS Kernel for x86. ! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT)

+ Overview. Projects: Developing an OS Kernel for x86. ! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT) + Projects: Developing an OS Kernel for x86 Low-Level x86 Programming: Exceptions, Interrupts, and Timers + Overview! Handling Intel Processor Exceptions: the Interrupt Descriptor Table (IDT)! Handling

More information

The Purpose of Interrupt

The Purpose of Interrupt Interrupts 3 Introduction In this chapter, the coverage of basic I/O and programmable peripheral interfaces is expanded by examining a technique called interrupt-processed I/O. An interrupt is a hardware-initiated

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

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

Homework / Exam. Return and Review Exam #1 Reading. Machine Projects. Labs. S&S Extracts , PIC Data Sheet. Start on mp3 (Due Class 19)

Homework / Exam. Return and Review Exam #1 Reading. Machine Projects. Labs. S&S Extracts , PIC Data Sheet. Start on mp3 (Due Class 19) Homework / Exam Return and Review Exam #1 Reading S&S Extracts 385-393, PIC Data Sheet Machine Projects Start on mp3 (Due Class 19) Labs Continue in labs with your assigned section 1 Interrupts An interrupt

More information

Homework. Reading. Machine Projects. Labs. Intel 8254 Programmable Interval Timer (PIT) Data Sheet. Continue on MP3

Homework. Reading. Machine Projects. Labs. Intel 8254 Programmable Interval Timer (PIT) Data Sheet. Continue on MP3 Homework Reading Intel 8254 Programmable Interval Timer (PIT) Data Sheet Machine Projects Continue on MP3 Labs Continue in labs with your assigned section 1 Restrictions on ISR Code Software that was executing

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

Chapter 12: INTERRUPTS

Chapter 12: INTERRUPTS Chapter 12: INTERRUPTS 12 1 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.

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

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal)

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from the execution of an instruction or by some other internal

More information

Computer Labs: I/O and Interrupts

Computer Labs: I/O and Interrupts Computer Labs: I/O and Interrupts 2 o MIEIC Pedro F. Souto (pfs@fe.up.pt) October 3, 2010 I/O Operation I/O devices are the interface between the computer and its environment Most of the time, the processor

More information

7/19/2013. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter Objectives 12 1 BASIC INTERRUPT PROCESSING

7/19/2013. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter Objectives 12 1 BASIC INTERRUPT PROCESSING Chapter 12: Interrupts Introduction In this chapter, the coverage of basic I/O and programmable peripheral interfaces is expanded by examining a technique called interrupt-processed I/O. An interrupt is

More information

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal)

An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from the execution of an instruction or by some other internal

More information

Chapter 12: Interrupts

Chapter 12: Interrupts Chapter 12: Interrupts Introduction In this chapter, the coverage of basic I/O and programmable peripheral interfaces is expanded by examining a technique called interrupt-processed I/O. An interrupt is

More information

Week 11 Programmable Interrupt Controller

Week 11 Programmable Interrupt Controller Week 11 Programmable Interrupt Controller 8259 Programmable Interrupt Controller The 8259 programmable interrupt controller (PIC) adds eight vectored priority encoded interrupts to the microprocessor.

More information

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 TOPICS TODAY I/O Architectures Interrupts Exceptions FETCH EXECUTE CYCLE 1.7 The von Neumann Model This is a general

More information

8086 Interrupts and Interrupt Responses:

8086 Interrupts and Interrupt Responses: UNIT-III PART -A INTERRUPTS AND PROGRAMMABLE INTERRUPT CONTROLLERS Contents at a glance: 8086 Interrupts and Interrupt Responses Introduction to DOS and BIOS interrupts 8259A Priority Interrupt Controller

More information

Interrupts. Chapter 20 S. Dandamudi. Outline. Exceptions

Interrupts. Chapter 20 S. Dandamudi. Outline. Exceptions Interrupts Chapter 20 S. Dandamudi Outline What are interrupts? Types of interrupts Software interrupts Hardware interrupts Exceptions Interrupt processing Protected mode Real mode Software interrupts

More information

Understanding the Interrupt Control Unit of the 80C186EC/80C188EC Processor

Understanding the Interrupt Control Unit of the 80C186EC/80C188EC Processor A AP-731 APPLICATION NOTE Understanding the Interrupt Control Unit of the 80C186EC/80C188EC Processor Sean Kohler Application Engineer Intel Corporation 5000 West Chandler Boulevard Chandler, AZ 85226

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

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

PC Interrupt Structure and 8259 DMA Controllers

PC Interrupt Structure and 8259 DMA Controllers ELEC 379 : DESIGN OF DIGITAL AND MICROCOMPUTER SYSTEMS 1998/99 WINTER SESSION, TERM 2 PC Interrupt Structure and 8259 DMA Controllers This lecture covers the use of interrupts and the vectored interrupt

More information

CHAPTER 6 INTERRUPT AND EXCEPTION HANDLING

CHAPTER 6 INTERRUPT AND EXCEPTION HANDLING CHATER 6 INTERRUT AND EXCETION HANDLING This chapter describes the interrupt and exception-handling mechanism when operating in protected mode on an I ntel 64 or I A-32 processor. Most of the information

More information

IA32 Intel 32-bit Architecture

IA32 Intel 32-bit Architecture 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

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

Intel x86 instruction set architecture

Intel x86 instruction set architecture Intel x86 instruction set architecture Graded assignment: hand-written resolution of exercise II 2) The exercises on this tutorial are targeted for the as86 assembler. This program is available in the

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

Computer Architecture and System Software Lecture 06: Assembly Language Programming

Computer Architecture and System Software Lecture 06: Assembly Language Programming Computer Architecture and System Software Lecture 06: Assembly Language Programming Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Assignment 3 due thursday Midterm

More information

These three counters can be programmed for either binary or BCD count.

These three counters can be programmed for either binary or BCD count. S5 KTU 1 PROGRAMMABLE TIMER 8254/8253 The Intel 8253 and 8254 are Programmable Interval Timers (PTIs) designed for microprocessors to perform timing and counting functions using three 16-bit registers.

More information

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013) UNIT I THE 8086 MICROPROCESSOR PART A (2 MARKS) 1. What are the functional

More information

Programming the 8259 PIC: A Tech-Tip Example and Boilerplate

Programming the 8259 PIC: A Tech-Tip Example and Boilerplate Programming the 8259 PIC: A Tech-Tip Example and Boilerplate Thomas W. Associate Professor, New Mexico State University, Department of Engineering Technology PO Box 3001, MSC 3566, Las Cruces, NM 88003-8001,

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

CS 550 Operating Systems Spring Interrupt

CS 550 Operating Systems Spring Interrupt CS 550 Operating Systems Spring 2019 Interrupt 1 Revisit -- Process MAX Stack Function Call Arguments, Return Address, Return Values Kernel data segment Kernel text segment Stack fork() exec() Heap Data

More information

Systems Programming and Computer Architecture ( ) Timothy Roscoe

Systems Programming and Computer Architecture ( ) Timothy Roscoe Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 AS 2016 Exceptions 1 17: Exceptions Computer Architecture

More information

Come and join us at WebLyceum

Come and join us at WebLyceum Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad

More information

ECE 485/585 Microprocessor System Design

ECE 485/585 Microprocessor System Design Microprocessor System Design Lecture 3: Polling and Interrupts Programmed I/O and DMA Interrupts Zeshan Chishti Electrical and Computer Engineering Dept Maseeh College of Engineering and Computer Science

More information

CS609 Final Term Solved MCQs with References Without Repetitions 14/02/2013

CS609 Final Term Solved MCQs with References Without Repetitions 14/02/2013 1 CS609 Final Term Solved MCQs with References Without Repetitions 14/02/2013 In BPB, root directory is saved in. (BIOS parameter block) Cluster#0 Cluster#1 (Ref) Cluster#2 Cluster#3 In NTFS, total sizes

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

3.1 DATA MOVEMENT INSTRUCTIONS 45

3.1 DATA MOVEMENT INSTRUCTIONS 45 3.1.1 General-Purpose Data Movement s 45 3.1.2 Stack Manipulation... 46 3.1.3 Type Conversion... 48 3.2.1 Addition and Subtraction... 51 3.1 DATA MOVEMENT INSTRUCTIONS 45 MOV (Move) transfers a byte, word,

More information

Objectives. Saving Interrupt Vectors. Writing a Custom Interrupt Handler. Examples of use of System functions for Input-Output and Interrupts

Objectives. Saving Interrupt Vectors. Writing a Custom Interrupt Handler. Examples of use of System functions for Input-Output and Interrupts ICT106 Fundamentals of Computer Systems Week 11 Practical Examples of use of System functions for Input-Output and Interrupts Objectives To illustrate how to write interrupt service routine (ISR) for Intel

More information

complex instruction set compute. reduced instruction set compute FETCH&EXECUTE. Instruction Register -

complex instruction set compute. reduced instruction set compute FETCH&EXECUTE. Instruction Register - 3600 XT 8086 AT 80286 386 486 PENTIUM 586 complex instruction set compute FETCH reduced instruction set compute BYTE 4 FETCH RISC CISC 111 112 113 114 115 CISC 121 122 123 RISC 131 132 133 11 12 13 14

More information

Chapter 8 PC Peripheral Chips - Pt 3 Interrupts

Chapter 8 PC Peripheral Chips - Pt 3 Interrupts Chapter 8 PC Peripheral Chips - Pt 3 Interrupts PC Architecture for Technicians: Level-1 Systems Manufacturing Training and Employee Development Copyright 1996 Intel Corp. Ch 8 - Page 1 OBJECTIVES: AT

More information

EEM336 Microprocessors I. Data Movement Instructions

EEM336 Microprocessors I. Data Movement Instructions EEM336 Microprocessors I Data Movement Instructions Introduction This chapter concentrates on common data movement instructions. 2 Chapter Objectives Upon completion of this chapter, you will be able to:

More information

Buffer Overflow Attack

Buffer Overflow Attack Buffer Overflow Attack What every applicant for the hacker should know about the foundation of buffer overflow attacks By (Dalgona@wowhacker.org) Email: zinwon@gmail.com 2005 9 5 Abstract Buffer overflow.

More information

Interrupt handling and context switching

Interrupt handling and context switching Interrupt handling and context switching slide 1 these two topics are separate and we will examine them in turn Interrupts slide 2 applications Shell daemons utilities Device drivers HW Kernel compiler

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

MPLAB X Debugging Techniques

MPLAB X Debugging Techniques TLS0102-004 MPLAB X Debugging Techniques Exception Conditions Author: Rob Ostapiuk, Stu Chandler Microchip Technology Exception Events Causes and Tools for Resolving Them Exception Events Definition An

More information

Embedded Systems Programming

Embedded Systems Programming Embedded Systems Programming x86 Memory and Interrupt (Module 8) Yann-Hang Lee Arizona State University yhlee@asu.edu (480) 727-7507 Summer 2014 X86 ISA Data Representations Little-endian byte ordering

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

1. state the priority of interrupts of Draw and explain MSW format of List salient features of

1. state the priority of interrupts of Draw and explain MSW format of List salient features of Q.1) 1. state the priority of interrupts of 80286. Ans- 1. Instruction exceptions 2. Single step 3. NMI 4. Processor extension segment overrun 5. INTR 6. INT 2. Draw and explain MSW format of 80286. Ans-

More information

ECE 391 Exam 1 Review Session - Spring Brought to you by HKN

ECE 391 Exam 1 Review Session - Spring Brought to you by HKN ECE 391 Exam 1 Review Session - Spring 2018 Brought to you by HKN DISCLAIMER There is A LOT (like a LOT) of information that can be tested for on the exam, and by the nature of the course you never really

More information

For more notes of DAE

For more notes of DAE Created by ARSLAN AHMED SHAAD ( 1163135 ) AND MUHMMAD BILAL ( 1163122 ) VISIT : www.vbforstudent.com Also visit : www.techo786.wordpress.com For more notes of DAE CHAPTER # 8 INTERRUPTS COURSE OUTLINE

More information

System Programming. Prof. Dr. Antônio Augusto Fröhlich. Nov 2006

System Programming. Prof. Dr. Antônio Augusto Fröhlich.   Nov 2006 SysProg Antônio Augusto Fröhlich (http://www.lisha.ufsc.br) 88 System Programming Prof. Dr. Antônio Augusto Fröhlich guto@lisha.ufsc.br http://www.lisha.ufsc.br/~guto Nov 2006 SysProg Antônio Augusto Fröhlich

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

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems OS Structures and System Calls Prof. Margaret Martonosi Computer Science Department Princeton University http://www.cs.princeton.edu/courses/archive/fall11/cos318/ Outline Protection

More information

UNIT-IV. The semiconductor memories are organized as two-dimensional arrays of memory locations.

UNIT-IV. The semiconductor memories are organized as two-dimensional arrays of memory locations. UNIT-IV MEMORY INTERFACING WITH 8086: The semi conductor memories are of two types: Static RAM Dynamic RAM The semiconductor memories are organized as two-dimensional arrays of memory locations. For Ex:

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

CS 410/510. Mark P Jones Portland State University. Week 4: Memory Management

CS 410/510. Mark P Jones Portland State University. Week 4: Memory Management CS 410/510 Languages & Low-Level Programming Mark P Jones Portland State University Fall 2018 Week 4: Memory Management 1 Copyright Notice These slides are distributed under the Creative Commons Attribution

More information

Pre-virtualization internals

Pre-virtualization internals Pre-virtualization internals Joshua LeVasseur 3 March 2006 L4Ka.org Universität Karlsruhe (TH) Compile time overview Compiler C code Assembler code OS source code Hand-written assembler Afterburner Assembler

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

Lab 2: 80x86 Interrupts

Lab 2: 80x86 Interrupts ELEC-4601: Microprocessor Systems The Point Lab 2: 80x86 Interrupts Writing software to properly respond to a hardware interrupt is fussy. There is a hardware path from the incoming interrupt signal all

More information

Chapters 2, 3: bits and pieces. Chapters 2 & 3. Chapters 2, 3: bits and pieces. Chapters 2, 3: bits and pieces. Using C. A last word about hardware

Chapters 2, 3: bits and pieces. Chapters 2 & 3. Chapters 2, 3: bits and pieces. Chapters 2, 3: bits and pieces. Using C. A last word about hardware Chapters 2 & 3 Chapters 2, 3: bits and pieces A review of hardware essentials Most of you have seen this material in other classes Still worth a careful read: may give you new insight We ll touch briefly

More information

Department of Computer Science and Engineering

Department of Computer Science and Engineering Department of Computer Science and Engineering QUESTION BANK Subcode/Subject : CS1304 Microprocessor & Microcontroller Year/Sem: III / V UNIT I THE 8085 MICROPROCESSOR PART A ( 2Marks) 1. How AD0-AD7 are

More information

SOEN228, Winter Revision 1.2 Date: October 25,

SOEN228, Winter Revision 1.2 Date: October 25, SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain

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

4) In response to the the 8259A sets the highest priority ISR, bit and reset the corresponding IRR bit. The 8259A also places

4) In response to the the 8259A sets the highest priority ISR, bit and reset the corresponding IRR bit. The 8259A also places Lecture-52 Interrupt sequence: The powerful features of the 8259A in a system are its programmability and the interrupt routine address capability. It allows direct or indirect jumping to the specific

More information

CSE 451 Autumn Final Solutions mean 77.53, median 79, stdev 12.03

CSE 451 Autumn Final Solutions mean 77.53, median 79, stdev 12.03 CSE 451 Autumn 2016 Final Solutions 15 10 5 0 0 10 20 30 40 50 60 70 80 90 100 mean 77.53, median 79, stdev 12.03 I. Warm-up (a) (15 points) Circle true or false for each statement (no need to justify

More information

Concurrent programming: Introduction I

Concurrent programming: Introduction I Computer Architecture course Real-Time Operating Systems Concurrent programming: Introduction I Anna Lina Ruscelli - Scuola Superiore Sant Anna Contact info Email a.ruscelli@sssup.it Computer Architecture

More information

Interrupt Handler: Top Half. Changwoo Min

Interrupt Handler: Top Half. Changwoo Min 1 Interrupt Handler: Top Half Changwoo Min 2 Yeah! Project 3 was released! s2dsm (Super Simple Distributed Shared Memory) Part 1. Analyze userfaultfd demo code Part 2. Pairing memory regions between two

More information

CS 550 Operating Systems Spring System Call

CS 550 Operating Systems Spring System Call CS 550 Operating Systems Spring 2018 System Call 1 Recap: The need for protection When running user processes, the OS needs to protect itself and other system components For reliability: buggy programs

More information

CanSecWest Nicolás A. Economou Andrés Lopez Luksenberg

CanSecWest Nicolás A. Economou Andrés Lopez Luksenberg CanSecWest 2012 Nicolás A. Economou Andrés Lopez Luksenberg INTRO There have been as many new MBR threats found in the first seven months of 2011 as there were in previous three years.... Symantec Intelligence

More information

Program Control Instructions

Program Control Instructions Program Control Instructions Introduction This chapter explains the program control instructions, including the jumps, calls, returns, interrupts, and machine control instructions. This chapter also presents

More information

sequence is not needed. (ROM space). Another application is to use the poll mode to expand the number of priority levels to more than 64.

sequence is not needed. (ROM space). Another application is to use the poll mode to expand the number of priority levels to more than 64. Lecture-55 Poll Command: In this mode the INT output is not used for the microprocessor internal interrupt enable F/F is reset, disabling its interrupt input, service to device is achieved by software

More information

M80C286 HIGH PERFORMANCE CHMOS MICROPROCESSOR WITH MEMORY MANAGEMENT AND PROTECTION

M80C286 HIGH PERFORMANCE CHMOS MICROPROCESSOR WITH MEMORY MANAGEMENT AND PROTECTION HIGH PERFORMANCE CHMOS MICROPROCESSOR WITH MEMORY MANAGEMENT AND PROTECTION Military Y High Speed CHMOS III Technology Pin for Pin Clock for Clock and Functionally Compatible with the HMOS M80286 Y 10

More information

eaymanelshenawy.wordpress.com

eaymanelshenawy.wordpress.com Lectures on Memory Interface Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Email : eaymanelshenawy@yahoo.com eaymanelshenawy.wordpress.com Chapter

More information

Computer Architecture and Assembly Language. Practical Session 5

Computer Architecture and Assembly Language. Practical Session 5 Computer Architecture and Assembly Language Practical Session 5 Addressing Mode - "memory address calculation mode" An addressing mode specifies how to calculate the effective memory address of an operand.

More information

Computer Systems Lecture 9

Computer Systems Lecture 9 Computer Systems Lecture 9 CPU Registers in x86 CPU status flags EFLAG: The Flag register holds the CPU status flags The status flags are separate bits in EFLAG where information on important conditions

More information

Embedded Systems. Input/Output Programming

Embedded Systems. Input/Output Programming Embedded Systems Input/Output Programming Dr. Jeff Jackson Lecture 11-1 Outline External I/O devices I/O software Polled waiting loops Interrupt-driven I/O Direct memory access (DMA) Synchronization, transfer

More information

O S E. Operating-System Engineering. Thread Abstraction Layer Tal

O S E. Operating-System Engineering. Thread Abstraction Layer Tal O O S E E al Object Orientation Operating-System Engineering hread Abstraction Layer al implementation of {fly,feather,lightweight threads by three components: thread yard.2 thread executive..9 thread

More information

COS 318: Operating Systems

COS 318: Operating Systems COS 318: Operating Systems OS Structures and System Calls Jaswinder Pal Singh Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/) Outline Protection mechanisms

More information

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

6/29/2011. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter 6: Program Control Instructions Introduction This chapter explains the program control instructions, including the jumps, calls, returns, interrupts, and machine control instructions. This chapter

More information

Assembler Programming. Lecture 10

Assembler Programming. Lecture 10 Assembler Programming Lecture 10 Lecture 10 Mixed language programming. C and Basic to MASM Interface. Mixed language programming Combine Basic, C, Pascal with assembler. Call MASM routines from HLL program.

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

Midterm Exam #2 Answer Key

Midterm Exam #2 Answer Key Midterm Exam #2 Answer Key Name: Student ID #: I have read and understand Washington State University s policy on academic dishonesty and cheating YOU Signed: Problem 1) Consider the following fragment

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

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

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

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network

9/19/18. COS 318: Operating Systems. Overview. Important Times. Hardware of A Typical Computer. Today CPU. I/O bus. Network Important Times COS 318: Operating Systems Overview Jaswinder Pal Singh and a Fabulous Course Staff Computer Science Department Princeton University (http://www.cs.princeton.edu/courses/cos318/) u Precepts:

More information

MICROPROCESSORS & MICRO CONTROLLER COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

MICROPROCESSORS & MICRO CONTROLLER COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK KINGS COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK SUBJECT CODE: EC1257 SUBJECT NAME: MICROPROCESSOR AND MICROCONTROLLER YEAR : II IT SEM : IV UNIT I THE 8085 MICROPROCESSOR

More information

Chapter 3. Assembly Language Programming with 8086

Chapter 3. Assembly Language Programming with 8086 Chapter 3 Assembly Language Programming with 8086 UNIT - III Assembly Language Programming with 8086- Machine level programs, Machine coding the programs, Programming with an assembler, Assembly Language

More information

AMD-K5. Software Development Guide PROCESSOR

AMD-K5. Software Development Guide PROCESSOR AMD-K5 TM PROCESSOR Software Development Guide Publication # 20007 Rev: D Amendment/0 Issue Date: September 1996 This document contains information on a product under development at Advanced Micro Devices

More information

Experiment 8 8 Subroutine Handling Instructions and Macros

Experiment 8 8 Subroutine Handling Instructions and Macros Introduction Experiment 8 8 Subroutine Handling Instructions and Macros In this experiment you will be introduced to subroutines and how to call them. You will verify the exchange of data between a main

More information

PCI Bus & Interrupts

PCI Bus & Interrupts PCI Bus & Interrupts PCI Bus A bus is made up of both an electrical interface and a programming interface PCI (Peripheral Component Interconnect) A set of specifications of how parts of a computer should

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

Xosdev Chapter 1 [The Bootloader] by mr. xsism

Xosdev Chapter 1 [The Bootloader] by mr. xsism Xosdev Chapter 1 [The Bootloader] by mr. xsism Planning/Setting goals When coding an Operating systtem or even a simple kernel you usually start with a bootloader. But what is a bootloader? A bootloader

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

Description of the Simulator

Description of the Simulator Description of the Simulator The simulator includes a small sub-set of the full instruction set normally found with this style of processor. It includes advanced instructions such as CALL, RET, INT and

More information

MICROPROCESSOR TECHNOLOGY

MICROPROCESSOR TECHNOLOGY MICROPROCESSOR TECHNOLOGY Assis. Prof. Hossam El-Din Moustafa Lecture 13 Ch.6 The 80186, 80188, and 80286 Microprocessors 21-Apr-15 1 Chapter Objectives Describe the hardware and software enhancements

More information

Lecture-61 Initialization Control Word 2 (ICW2):

Lecture-61 Initialization Control Word 2 (ICW2): Lecture-61 Initialization Control Word 2 (ICW2): After issuing ICW1 on even address, the PIC is ready to accept initialization Control Word 2. It is issued to an address having A 0 =1, i.e., on odd address.

More information