How to prevent user processes accessing I/O ports directly?
How to prevent user processes accessing I/O ports directly?
Just as the title, how to prevent user processes accessing I/O ports directly? I know on some archs I/O ports are mapped to memory. So I can prevent user processes accessing the given memory range. But how about isolated I/O? Is there any way to prevent the user process, for example, directly using in and out instructions to manipulate hardwares? I want to force them to use system calls.
Re: How to prevent user processes accessing I/O ports direct
When the CPU encounters an in or out, it checks weather the IOPL is greater or equal to the CPL. If not, it checks the IOMAP in the TSS. If the corresponding entry is 1, the task has no access to the port and a GPF is triggered.