From: David Mosberger-Tang <davidm@AZStarNet.com>
Subject: Re: ioperm() and iopl()
Date: Mon, 17 Jun 1996 09:39:55 -0700 [thread overview]
Message-ID: <199606171639.JAA27270@koala.azstarnet.com> (raw)
>>>>> On Mon, 17 Jun 1996 13:23:48 +0200, Martin Ostermann <ost@comnets.rwth-aachen.de> 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
next reply other threads:[~1996-06-17 16:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-17 16:39 David Mosberger-Tang [this message]
-- strict thread matches above, loose matches on Subject: below --
1996-06-18 15:20 ioperm() and iopl() David Mosberger-Tang
1996-06-18 12:24 Martin Ostermann
1996-06-17 11:23 Martin Ostermann
1996-06-17 13:55 ` Erik Troan
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox