why the ioctl return an error bad address when i try to ctrol an pci device?
Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
why the ioctl return an error bad address when i try to ctrol an pci device?
hello,i recently debug an pci device,but when i try to use to syscall to read the config register i got an error bad address from the ioctl.
the code is below:
fd: fd=open("/dev/Plx/Plx9054",O_RDWR|O_NONBLOCK);
this code works well.
unsigned long args=1;
ioctl: i=ioctl(fd,PLX_IOCTL_CHIP_TYPE_GET,args);
the cmd PLX_IOCTL_CHIP_TYPE_GET is used to get the chip type of the pci device.It's defined in the PlxIoctl.h.(I used the PLX SDK to compile my pci driver)The args I don't know how to use it.so here i give it an one.But the syscall ioctl return an error bad address.what's wrong?
i trace the function ioctl defined in the pci drive.here is the code:
PLX_RET_IOCTL
Dispatch_IoControl(
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
struct inode *inode,
#endif
struct file *filp,
unsigned int cmd,
unsigned long args
)
{ int status;
VOID *pOwner;
PLX_PARAMS IoBuffer;
PLX_PARAMS *pIoBuffer;
DEVICE_EXTENSION *pdx;
DebugPrintf_Cont(("\n"));
// Get the device extension
if (iminor(filp->f_dentry->d_inode) == PLX_MNGMT_INTERFACE)
{
// Management interface node only supports some IOCTLS
pdx = NULL;
}
else
{
pdx = ((DEVICE_OBJECT*)(filp->private_data))->DeviceExtension;
}
// Copy the I/O Control message from user space
status =
copy_from_user(
&IoBuffer,
(PLX_PARAMS*)args,
sizeof(PLX_PARAMS)
);
if (status != 0)
{
ErrorPrintf((
"ERROR - Unable to copy user I/O message data\n"
));
}
of coure i also has been given an error unable to copy user I/O message data from the debug monitor.
But why? can any body help me ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.