Communicating
with the controllers becomes as easy as writing to and reading from memory.
Memory-mapped I/O offers several advantages. First, since I/O uses the same instructions as memory
references, I/O programs (drivers) can be written entirely in a high-level language. Second, protection against
issuing I/O commands in user mode can be effected using the memory protection hardware already required for
enforcing bounds on a user program??™s access to memory. No special mechanism for detecting the privileged
status of I/O commands is required.
A disadvantage of memory-mapped I/O becomes apparent when the computer design includes separate
buses for memory and I/O. Since the controllers cannot ???see??? the transfers to memory, some mechanism is
necessary to intercept reads and writes to I/O mapped-memory locations and pass them off to the I/O bus.
Another disadvantage of memory-mapped I/O is that most modern computers, in order to speed access to
memory, use local ???cache??? memory to hold the contents of recently accessed memory locations. A cache holds
a copy of what is in memory in a location closer to the CPU. If a driver needs to read the control flag register
to learn if the interface is busy, and the contents of the memory location are cached, the driver may never see
the device become available.
Pages:
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274