[net.unix] Getting OUT from C

mower@sunybcs.UUCP (James E. Mower) (06/09/86)

I'm trying to write to an internal port within the AT running under
XENIX.  Unfortunately, I don't know enough assembler to get to the 
OUT function directly (I keep getting segmentation faults when I try
to write to port 991 (decimal)) so I am looking for a comparable way
to get to it from the C compiler under XENIX.  Can anyone tell me how
this might be done?  Thanks in advance.

ee171bap@sdcc13.UUCP (SHAWN BOSLEY) (06/11/86)

In article <60@sunybcs.UUCP> mower@sunybcs.UUCP (James E. Mower) writes:
>I'm trying to write to an internal port within the AT running under
>XENIX.  Unfortunately, I don't know enough assembler to get to the 
>OUT function directly (I keep getting segmentation faults when I try
>to write to port 991 (decimal)) so I am looking for a comparable way

You are probably using the OUT instruction properly. It's the
protected mode of the 80286 that won't allow you to use an OUT
instruction unless your process is running at the most priviledged
level. Only the kernel is allowed to run at that level. The only
way under XENIX to use such instructions is to write a device driver
and link it to the kernel.

>to get to it from the C compiler under XENIX.  Can anyone tell me how
>this might be done?  Thanks in advance.

The C compiler won't do any better. You could alter pointer
variables but this would only work if I/O is memory mapped (which it
isn't). Even is I/O memory mapped, the protected mode won't allow
you to reference memory segments that don't belong to you.

Hope this helps!

-- Shawn Bosley