NASM - The Netwide Assembler

NASM Forum => Programming with NASM => Topic started by: nobody on December 18, 2008, 07:44:20 PM

Title: How to have permission to access ports?
Post by: nobody on December 18, 2008, 07:44:20 PM
I write a simple code to read a port with the in instruction but when i run the program the in al, dx create a segmentation fault.

I find that to use in or out instruction in linux i first need permission but i don't know how?

The code:

global _start

section .data

section .text

_start:

mov dx, 03f8h
in al, dx

xor ebx, ebx      ; send 0 as 'exit code'
mov eax, 1      ; terminate process
int 80h         ; execute the syscall
Title: Re: How to have permission to access ports?
Post by: nobody on July 01, 2009, 11:50:33 PM
I think you should use a1 (that's a one)  instead of al (that's an L).
Title: Re: How to have permission to access ports?
Post by: Frank Kotler on July 02, 2009, 02:56:29 AM
What effect do you get by replacing "al", a register name, with "a1", an undefined symbol??? Won't assemble for me. :(

Try sys_ioperm.

Best,
Frank