[comp.sys.m68k] How to access local I/O devices from a user process in SysV/68?

rasit@cs.UAlberta.CA (M. Rasit Eskicioglu) (12/03/90)

Dear netters,

I want to write code that would access to Local I/O Devices directly. For
example, I want to read LANCE registers. As they are not mapped into the
user's space in SysV/68V3R6, I always get memory protection error (signal 11). 
Is there a way to accomplish this task. It is possible, in SunOS for example,
to map those locations into the user space via system calls. 

Any suggestions?

Thanks,

rasit

-- 
+------------------------------------+------------------------+---------------+
| M. Rasit Eskicioglu                |  rasit@alberta.uucp    | M  M RRR  EEE |
| University of Alberta              |  rasit@cs.UAlberta.CA  | MMMM R  R E   |
| Department of Computing Science    |  eski@ualtamts.bitnet  | MMMM RRR  EE  |
| Edmonton, Alberta T6G 2H1          | rasit@ualtamts.bitnet  | M  M R R  E   |
| CANADA                        rasit%alberta@ualtamts.bitnet | M  M R  R EEE |
| Voice : (403)492-3854  +----------------------------------------------------+
| Fax   : (403)492-1071  |
+------------------------+

riku@field.fi (Riku Kalinen / Systems) (12/04/90)

In article <1990Dec3.040634.1428@cs.UAlberta.CA> rasit@cs.UAlberta.CA
(M. Rasit Eskicioglu) writes:

>I want to write code that would access to Local I/O Devices directly. For
>example, I want to read LANCE registers. As they are not mapped into the
>user's space in SysV/68V3R6, I always get memory protection error (signal 11). 
As You should. It is not safe to access I/O hw from user task.

>Is there a way to accomplish this task. It is possible, in SunOS for example,
>to map those locations into the user space via system calls. 

This sounds, in general, bad idea to my ears. I am not sure, if it is
possible at all, but shmxxx calls might get something out for you.



-- 
Riku "the bit" Kalinen                    E-Mail : riku@gandalf.Field.FI
FAE/Systems, Field Oy.                    Telex  : 122022 field sf
                                          Phone  : +358 0 757 1011
"Welcome to the party, pal!" (Die Hard)   G3 Fax : +358 0 798 853

stevea@mcdclv.UUCP (Steve Alexander) (12/05/90)

In article <1990Dec3.040634.1428@cs.UAlberta.CA> rasit@cs.UAlberta.CA (M. Rasit Eskicioglu) writes:
>Dear netters,
>
>I want to write code that would access to Local I/O Devices directly. For
>example, I want to read LANCE registers. As they are not mapped into the
>user's space in SysV/68V3R6, I always get memory protection error (signal 11).

Look at shmget(2), shmctl(2), and shmop(2) in the Programmers
Reference manual (note the IPC_PHYS parameter).  Physical shared
memory MUST be allocated on 4KB memory page boundaries under sysV/68.
Also see the chapter on Interprocess Communication Techniques (IPC) in
the Programmers Guide manual for examples.

Stevea


-- 
Steve Alexander            | a twelve ton cast iron soda cracker,
Motorola Cleveland         | the stress on an aluminum plastic injection mold,
                           | silly snowflakes dancing wildly for no one,
                           | scotch tape, sticky on NO sides.            [sja]

michael@mcdchg.chg.mcd.mot.com (Michael Bodine) (12/07/90)

Steve Alexander (stevea@mcdclv.UUCP) writes:
> In article <1990Dec3.040634.1428@cs.UAlberta.CA> rasit@cs.UAlberta.CA (M. Rasit Eskicioglu) writes:
> >I want to write code that would access to Local I/O Devices directly. For
> >example, I want to read LANCE registers. As they are not mapped into the
> >user's space in SysV/68V3R6, I always get memory protection error (signal 11).
> Look at shmget(2), shmctl(2), and shmop(2) in the Programmers
> Reference manual (note the IPC_PHYS parameter).  Physical shared
> memory MUST be allocated on 4KB memory page boundaries under sysV/68.
> Also see the chapter on Interprocess Communication Techniques (IPC) in
> the Programmers Guide manual for examples.
As noted elsewhere, it's not considered kosher for user tasks to access
hardware.  In general, you would have to prevent unix from using the devices
in question by taking them out of the sysgen, then use the shm interface to
map them into your user task.  Therefore, you wouldn't be able to run the
networking or Xwindow extensions to the operating system when trying to run
this way.  Usually, if you're going to access i/o, you do it from a device
driver, which is part of the kernel, and memory protection is not a problem.
For devices which are off-board, such as a third-party I/O controller, since
unix won't know about the device, you can use shm without any special
considerations other than setting the physical mapping bit as Steve notes.
-- 
[  Michael Bodine, michael@chg.mcd.mot.com, Dial: (708) 576-7840, FAX: x8875  ]
[  Motorola TSD; Loc IL38; 1100 Woodfield; Suite 334;  Schaumburg, Il  60173  ]