Maybe you have to compile with optimisations turned on as they may not be
functions as such, but macros. It's the same with inb/outb.
If you are calling from user space i think you have to have a higher CPU
privilege level. Call the iopl() function. This has to be done as root or it
>===== Original Message From Paul Jakma <paulj at alphyra.ie> =====
>i may be wrong, but:
>>- you can not call kernel functions from userspace
>- you can not call libc functions from the kernel
>>the below is just not going to work.
>>there are syscalls to access IO ports, outb/inb/etc...
>>iirc, memory mapped IO is only possible from userspace by mmap()'ing
>appropriate part of /dev/mem. (and iirc this is how X does it).
>dangerous if you get it wrong though.
>>otherwise you could write a small kernel driver to present that memory
>as a device and allow applications to mmap() it. best to ask on
>linux-kernel about this.
>>On Wed, 4 Jul 2001, Oliver Ryan wrote:
>>>> first time user of this group. Thanks in advance. Hope my
>> etiquette/procedure is correct.
>>>> This is a small program I'm trying to use to read a 32 bit word at an
>> offset of 0x20 from an address in PCI memory (0xfc020000). The number I
>> want to read was memory mapped to here from a PCI device (the address is
>> from PCI_BASE_ADDRESS_2). However it won't compile, giving the error
>> "undefined reference to 'readl' ", even though I've included the asm/io.h
>> header file.
>>>> int main(void)
>> int *base, status;
>>>> base = (int*)0xfc020000;
>> status=readl(*(base) + 0x20);
>>>> printf(" %x", status);
>>>>>> Rgds. Oliver.
>>>> Dept. of Physics,
>> National University of Ireland, Galway,
>>>> Tel: +353 (0)91 524411 ext. 2716
>> Fax: +353 (0)91 750584
>Irish Linux Users' Group: ilug at linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
>List maintainer: listmaster at linux.ie
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!