3 ms·
Emulated Iopl()
- acqq 7y agoThe most interesting for me was the comment: "I actually have a project that uses iopl to provide shell script access to ioport. Yes, you can write device drivers in shell script ... http://git.annexia.org/?p=ioport.git;a=summary http://git.annexia.org/?p=ioport.git;a=summary " And there in README: "At first glance it would seem that /dev/port would be the best way to access I/O ports. However /dev/port under Linux is fundamentally flawed because it only allows byte-sized access to ports. For example if you write a single long (4 bytes) it will turn that into 4 individual outb operations. Instead we use iopl(2) to raise our I/O privilege level so that we can do the correct in<size> and out<size> operation as requested."
- rwmj 7y agoOh hello! It's possible to write (only very simple) device drivers with ioport, here's an example: https://rwmj.wordpress.com/2009/03/09/ioport-command-line-access-to-io-ports/ https://rwmj.wordpress.com/2009/03/09/ioport-command-line-ac... To address your point about /dev/port (I think I was having this conversation on one of the internal Red Hat kernel devel channels): https://rwmj.wordpress.com/2016/04/06/ioport/ https://rwmj.wordpress.com/2016/04/06/ioport/ I still think it needs to be fixed. I should also for completeness mention vfio, which is a rather better way to get access to some devices from userspace.