iansjack wrote:
@BenLunt: Could I ask you to expand on the statement that hardware can be damaged by writing to I/O ports?
I know that, at one time, careless programming of a video card could damage a CRT monitor, but I don't know of any other examples. It would be very useful to have a list of hardware that could be damaged in this way.
yes it would be useful to have a list like this. Let me start a list:
1. All of them
2. see 1
(smile)
There are few, if any, hardware devices that will watch for and catch harmful programming. That would be too expensive to implement. It is assumed that you as the programmer will read the documentation, understand the documentation, and write "unharmful" code.
Granted, writing bogus data to most hardware will simple place the hardware in an unknown state. However, there is other damage that can be done as well.
For example, the RTL8169 network card will dump its internal counters to a buffer you specify. If you write bogus data to the buffer register, then set the command byte to dump the internals, again by writing bogus data to that register, the card will write to the address specified. This address could be an address within your kernel's task management code, re-writing the task manager. What kind of damage could come of that?
The point is, to program hardware via direct access (Port I/O or mem-mapped I/O), you need to know what you are doing.
Ben