NASM Forum > Programming with NASM
How to have permission to access ports?
(1/1)
nobody:
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
nobody:
I think you should use a1 (that's a one) instead of al (that's an L).
Frank Kotler:
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
Navigation
[0] Message Index
Go to full version