access directly to I/O ports on PC hardware in ubuntu give segmentation fault
-
i am using outl (unsigned int __value, unsigned short int __port) & inl (unsigned short int __port) that are not part of compilation but it is used in run time . it gives me segmentation error.
I am using Ubuntu 16.04
and qt5i get /usr/include/x86_64-linux-gnu/sys/io.h is located correctly.
-
i am using outl (unsigned int __value, unsigned short int __port) & inl (unsigned short int __port) that are not part of compilation but it is used in run time . it gives me segmentation error.
I am using Ubuntu 16.04
and qt5i get /usr/include/x86_64-linux-gnu/sys/io.h is located correctly.
@anil_arise In what way is it related to Qt?
Did you try to debug your app to see where and why it crashes?
From the information you provided others can only guess... -
@anil_arise In what way is it related to Qt?
Did you try to debug your app to see where and why it crashes?
From the information you provided others can only guess...@jsulm this is the simple code of two methods;;;;;...............
#include <sys/io.h>
typedef unsigned long DWORD;
// PCI Device Read/Write I/O
#define PCI_CONFIG_ADDR 0xCF8
#define PCI_CONFIG_DATA 0xCFCDWORD SMBUS::PCI_Read(int size_t)
{
DWORD dwAddrVal;
dwAddrVal= inl(PCI_CONFIG_DATA);
usleep(10);
return dwAddrVal;
}void SMBUS::PCI_Write(DWORD dwDataVal,int size_t)
{
outl(dwDataVal,PCI_CONFIG_ADDR);
usleep(10);
}............................................
in this code when i got crash when go to inl() or outl() these are predefined function of sys/io.h -
@jsulm this is the simple code of two methods;;;;;...............
#include <sys/io.h>
typedef unsigned long DWORD;
// PCI Device Read/Write I/O
#define PCI_CONFIG_ADDR 0xCF8
#define PCI_CONFIG_DATA 0xCFCDWORD SMBUS::PCI_Read(int size_t)
{
DWORD dwAddrVal;
dwAddrVal= inl(PCI_CONFIG_DATA);
usleep(10);
return dwAddrVal;
}void SMBUS::PCI_Write(DWORD dwDataVal,int size_t)
{
outl(dwDataVal,PCI_CONFIG_ADDR);
usleep(10);
}............................................
in this code when i got crash when go to inl() or outl() these are predefined function of sys/io.h@anil_arise Please read https://linux.die.net/man/2/inl
Especially:
"You use ioperm(2) or alternatively iopl(2) to tell the kernel to allow the user space application to access the I/O ports in question. Failure to do this will cause the application to receive a segmentation fault."