From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199606171639.JAA27270@koala.azstarnet.com> Date: Mon, 17 Jun 1996 09:39:55 -0700 From: David Mosberger-Tang Subject: Re: ioperm() and iopl() >>>>> On Mon, 17 Jun 1996 13:23:48 +0200, Martin Ostermann said: Martin> Ioperm() and iopl() seem to be sytem calls on any Linux Martin> platform, except for Alpha. What's the reason for this? Well, Alpha != x86 is the reason. In particular, the Alpha doesn't have ioperm or iopl-equivalent instructions. On the Alpha, all I/O is done through memory-mapped I/O (and there are good reasons for this). It certainly would be possible to make them syscalls, but this would mean that all port reads/writes (inb/outb etc) would _also_ have to be syscalls. I don't think anybody would like that performance-wise. For this reason, ioperm() and iopl() are emulation routines in the library that simply mmap() the appropriate portion of the kernel address space, so port I/O can be done in user-level space. BTW: If you say that "all other architecture have iopl() as a syscall"--- well, yes, sort of. Here is what the MIPS has: asmlinkage int sys_iopl(long ebx,long ecx,long edx, long esi, long edi, long ebp, long eax, long ds, long es, long fs, long gs, long orig_eax, long eip,long cs,long eflags,long esp,long ss) { return -ENOSYS; } Not particularly useful, is it? ;-) In other words: ioperm() and iopl() are non-portable and should be avoided whenever possible. It just so happens that the Alpha PCs have an I/O system that looks identical to an x86 PC, which makes it easy to implement a meaningful iopl() and ioperm() in user-level. Martin> When I use iopl() in an app, I'll get an runtime error, Martin> somewhat like "Couldn't determine system type -- Maybe Martin> /etc/alpha_io_system symlink is missing". Well, it is Martin> missing, but where is it supposed to point to? I don't have Martin> libc sources hanging around to look it up, so it would be Martin> neat if somebody could help me. What does "cat /proc/cpuinfo" show? I think you have a Jensen, so there should be a line like this: system type : Jensen If not, you can force the right system type with: ln -s Jensen /etc/alpha_io_system --david