Pointer & GPC question..._(re)

Sat, 23 Aug 1997 17:28:37 +0200



Orlando Llanes wrote:

> How would I do low level access for memory with a normal user privilege?
> Why can't I just define a pointer and write data to it? Ugh, Linux is a
> good OS, but it can be a pain in the butox :P

Of course you can do it this way for your (i.e. this process's) memory.
Sorry if I didn't make this clear. You need root privileges to access
all memory -- that's the point of memory protection in a good OS
(because a normal program can't accidentally overwrite/crash other
processes or the kernel).

The other thing is (as far as I've understood it so far) that Linux
uses paging, so the same pointer doesn't necessarily mean the same
thing in two different processes (because the memory of these
processes is paged differently). Therefore, there's the /dev/mem
device to allow you (i.e. root) to access memory at absolute
addresses.

About the video memory, I don't know very much. I think the user
who uses a certain console *should* have direct access to its video
memory, but I don't know if this is so. (Either this or accessing
the ports is the reason why svgalib programs need root privileges.) 

If this wasn't quite correct/complete, plase someone correct me.


Frank Heckenbach (heckenb@mi.uni-erlangen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es