Normally user programs are prevented from handling I/O directly by I/O instructions in them. For CPUs having explicit I/O instructions, such I/O protection is ensured by having the I/O instruction privileged. In a CPU with memory mapped I/O, there is no explicit I/O instruction. Which one of the following is true for a CPU with memory mapped I/O?
View worked solution
Answer: A
In a CPU with memory-mapped I/O, there are no dedicated I/O instructions (like IN or OUT). Instead, I/O device registers are mapped directly to specific addresses in the physical memory address space. Standard memory access instructions (such as LOAD and STORE) are used to perform I/O operations.
To prevent unauthorized user programs from directly accessing these I/O devices, the system relies on memory protection:
- The operating system configures the Memory Management Unit (MMU) or page tables so that the memory addresses assigned to I/O devices are marked as privileged (accessible only in kernel/supervisor mode).
- If a user-level program attempts to access these restricted memory addresses, the hardware detects a protection violation and generates a trap.
- The operating system routines handle this trap to enforce security and prevent unauthorized access.
Thus, I/O protection in a memory-mapped I/O system is ensured by the operating system routine(s) through memory virtualization and protection management.
Free practice · Your answers on this page are not saved.
