[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Axcessing *R_PAR1_CTRL_DATA from programs under Linux.

On Mon, Apr 30, 2001 at 01:52:11PM +0200, Jonas Aaberg wrote:
> On 2001.04.30 12:13:05 Jonas Aaberg wrote:
> > 
> > On 2001.04.30 12:24:47 Mikael Starvik wrote:
> > > The internal registers are not available from userspace
> > > (I don't think you can find any platform with a MMU
> > > that lets you tamper with hardware registers directly).
> > > If you need to access the registers you should do it
> > > from kernel space e.g. from a device driver.
> > I thought so too, but I found it quite nice to be able to
> > do that in userspace on the old Etrax, so I hoped there
> > was a way to do that. 
> > 
> > Thanks for your answer.
> But on a second thought, for example the X server must be
> able to change internal registers to switch to graphic mode.
> So I think it can be possible from a program running with
> chmod +s, owner root to change internal registers, somehow.
> Could it be possible to memory map the interal register area
> as shared memory? Just an idea, mabye it is impossible.

process has to be running as root, and if you are trying to access ports
upto 0x3ff you can use "ioperm" to change to get access to the ports, if you
are using ports beyond that number, X for e.g. you must use "iopl" which
gives you access to all 65536 I/O ports, exaple:

static inline void wdt_timeout(u_int32_t sec)
    sec *= 25000000;
    outl((sec>>16)|(sec<<16), 0xf4c0);
    outw(0xf01e, 0xf4c8);
    outw(0x0fe1, 0xf4c8);

This would touch the watchdog on a t-systems i386 platform.


                                    | 1. Wild enthusiam
Historic Project Stages for all     | 2. Gradual disillusionment
Silicon Valley Projects.            | 3. Search for the guilty
                                    | 4. Punishment of the innocents
Where are you at?                   | 5. Promotion of non-participants