2002-02-09 07:27:03

by Daniel Stodden

[permalink] [raw]
Subject: read()/write() vs. ptr dereference question


hi.

as correctly pointed out throughout the relevant literature, accessing
I/O memory through lame pointer dereferences is not portable and on
linux use of read()/write() instead is highly recommended.

i've come across an application where some piece of code expects some
piece of memory (RAM) returned from some other piece of code and the
latter one might actually benefit from pointing at something not memory
but rather something located in PCI memory space instead.

i'm currently mostly concerned about intel and ppc and obviously it will
be okay there. otoh, sparc may be of future interest. i don't know too
much about sparc but according to the headers sparc64 definitely won't
work.
(right here? or would it work and io.h uses just a better alternative?)

my main question regarding portability is: is there some kind of macro
anywhere, like #if __IO_AND_PHYS_LOOK_THE_SAME, which i just haven't
found yet or do i need to explicitly check for any arch in question?

[or: should such a macro exist? might somehow clean up the headers a
little...]

thanx,
daniel

--
___________________________________________________________________________
mailto:[email protected]



Attachments:
signature.asc (232.00 B)
This is a digitally signed message part