PDA

View Full Version : Linux->Nasm->Flush ports



yousafsajjad
July 9th, 2010, 10:10 PM
Hi,

I am using the following code to flush port:

in al, 081h
out 081h, al

but it is giving me segmentation fault. Does anyone how I can do it.

xb12x
July 10th, 2010, 12:18 AM
If you're doing this from inside a Linux User-level application you will cause an exception/fault. Linux is a protected O.S. which means you cannot access hardware directly from a User-level application. Your code does not have the necessary permissions.

If you want to access hardware your application must call a driver (System-level code).

yousafsajjad
July 10th, 2010, 05:23 AM
yeah you are right .. i am calling an assembly function from C. So I need to get permission to that port using ioperm() first and than it works.