Protected Instructions
• A subset of instructions of every CPU is restricted to use
only by the OS
• Known as protected (privileged) instructions
• Only the operating system can
• Directly access I/O devices (disks, printers, etc.)
• Security, fairness (why?)
• Manipulate memory management state
• Page table pointers, page protection, TLB management, etc.
• Manipulate protected control registers
• Kernel mode, interrupt level
• Halt instruction (why?)
OS Protection
• Hardware must support (at least) two modes of operation:
kernel mode and user mode
• Mode is indicated by a status bit in a protected control register
• User programs execute in user mode
• OS executes in kernel mode (OS == “kernel”)
• Protected instructions only execute in kernel mode
• CPU checks mode bit when protected instruction executes
• Setting mode bit must be a protected instruction
• Attempts to execute in user mode are detected and prevented
• x86: General Protection Fault
Memory Protection
• OS must be able to protect programs from each other
• OS must protect itself from user programs
• We need hardware support
• Again: once OS gives the CPU to the user programs, OS loses
control
• Memory management hardware provides memory
protection mechanisms
• Base and limit registers
• Page table pointers, page protection, TLB
• Virtual memory
• Segmentation
• Manipulating memory management hardware uses
protected (privileged) operations
Protected Instructions• A subset of instructions of every CPU is restricted to useonly by the OS• Known as protected (privileged) instructions• Only the operating system can• Directly access I/O devices (disks, printers, etc.)• Security, fairness (why?)• Manipulate memory management state• Page table pointers, page protection, TLB management, etc.• Manipulate protected control registers• Kernel mode, interrupt level• Halt instruction (why?)OS Protection• Hardware must support (at least) two modes of operation:kernel mode and user mode• Mode is indicated by a status bit in a protected control register• User programs execute in user mode• OS executes in kernel mode (OS == “kernel”)• Protected instructions only execute in kernel mode• CPU checks mode bit when protected instruction executes• Setting mode bit must be a protected instruction• Attempts to execute in user mode are detected and prevented• x86: General Protection FaultMemory Protection• OS must be able to protect programs from each other• OS must protect itself from user programs• We need hardware support• Again: once OS gives the CPU to the user programs, OS losescontrol• Memory management hardware provides memoryprotection mechanisms• Base and limit registers• Page table pointers, page protection, TLB• Virtual memory• Segmentation• Manipulating memory management hardware usesprotected (privileged) operations
การแปล กรุณารอสักครู่..
