Elad Lahav
|
Re: [QNX7] pci_device_read_* segfaults, then hangs
|
Elad Lahav
01/25/2018 9:58 AM
post118468
|
Re: [QNX7] pci_device_read_* segfaults, then hangs
SIGSEGV/4/2 is a general protection fault. You are probably reading
from the wrong address.
--Elad
On Thu, 2018-01-25 at 09:21 -0500, Benjamin Richner wrote:
> Hello,
>
> I am familiarising myself with the new pci-server of QNX7. That is
> why I wrote a tiny example tool that enumerates all PCI devices and
> reads the device ID, as follows:
>
> //------------------------------------------------------
> #include <stdio.h>
>
> #include <pci/pci.h>
> #include <pci/cap_pcie.h>
>
> int main() {
>
> uint_t idx = 0;
> pci_bdf_t bdf;
> while ((bdf = pci_device_find(idx, PCI_VID_ANY, PCI_DID_ANY,
> PCI_CCODE_ANY)) != PCI_BDF_NONE)
> {
> /* get next device instance */
> printf("Found device %d\n", idx);
>
> pci_err_t err;
> pci_did_t did;
> err = pci_device_read_did(bdf, &did);
>
> ++idx;
>
> }
>
> printf("Exited main\n");
> return 0;
> }
> //------------------------------------------------------
>
>
> The problem is that this program segfaults when I run it, here's the
> telnet output:
>
> #
> # /tmp/qnx7test_c
> Found device 0
>
> Process 213017 (qnx7test_c) terminated SIGSEGV code=4 fltno=2
> ip=b822afa7(/lib/dll/pci/pci_hw-Intel_x86.so@hwmod_init+0x00000207)
> mapaddr=00005fa7.
> Memory fault (core dumped)
> #
> #
>
>
> The "pci_device_read_did" command caused the segfault. When I run the
> program again, it simply blocks at the exact same place (no segfault
> anymore though!).
>
> I am completely stumped, I have no idea what the problem could be.
>
> Can anyone help me?
>
> Best regards,
> Benjamin
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post118465
> To cancel your subscription to this discussion, please e-mail ostech-
> core_os-unsubscribe@community.qnx.com
|
|
|