cancel
Showing results for 
Search instead for 
Did you mean: 
Observer
Observer
9,218 Views
Registered: ‎04-01-2014

XAPP1022 reworked, NULL pointer dereference

Jump to solution

Hello all,

 

I'm using the XAPP1022 to build a linux driver for Virtex7.

Each time I want to write from the application into the FPGA I get this output:

     BUG: unable to handle kernel NULL pointer dereference at (null)

 


The read fct works fine. So I don't understand the problem.

 

This is the app. code I use:

 


 

#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <fcntl.h>
#include <errno.h>

char devname[] = "/dev/PCIeDrv";
int g_devFile = -1;

struct TransferData  {

        unsigned int data[2048];

} *gReadData, *gWriteData;


int WriteData(char* buff, int size)
{
        int ret = write(g_devFile, buff, size);
                                                                                
        return (ret);                                //returns 0
}

int ReadData(char *buff, int size)
{
        int ret = read(g_devFile, buff, size);

        return (ret);                                //returns 0
}

int main()
{
  int i, j;
  int iter_count = 100000;

  char* devfilename = devname;
  g_devFile = open(devfilename, O_RDWR);

  if ( g_devFile < 0 )  {
    printf("Error opening device file\n");
    return 0;
  }

  gReadData = (TransferData  *) malloc(sizeof(struct TransferData));    
  gWriteData = (TransferData  *) malloc(sizeof(struct TransferData));    

  for (j = 0; j < iter_count; j++)
  {
    for(i=0; i<2048; i++)
      gWriteData->data[i]=rand();

    WriteData((char*) gWriteData, 4);                        //4Byte von gWriteData in g_devFile

    ReadData((char *) gReadData, 4);                        //4Byte von g_devFile in gReadData

    for(i=0; i<1; i++) {
      if (gReadData->data[i] != gWriteData->data[i])        //Überprüfen des ersten int Werts
        printf("DWORD miscompare [%d] -> expected %x : found %x \n", i, gWriteData->data[i], gReadData->data[i]);
    }

    if ((j % 1000) == 0)
      printf("Pass #[%d]\n", j);
  }
}


 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
16,344 Views
Registered: ‎04-01-2014

Re: XAPP1022 reworked, NULL pointer dereference

Jump to solution

Hi,

 

thanks for ur reply.

There was an mistake regarding the device ID.

 

Now it works

View solution in original post

0 Kudos
2 Replies
Highlighted
Scholar
Scholar
9,201 Views
Registered: ‎02-03-2010

Re: XAPP1022 reworked, NULL pointer dereference

Jump to solution

Hi ,

 

I would suggest to check kernel related known issues.

 

I see some issues like one below threads

 

http://kb.parallels.com/en/120478

 

https://wiki.ubuntu.com/DebuggingKernelOops

 

Can you check if you can use the tested kernel which is Fedora10 for Xapp1022 ?

 

Regards,

Koti Reddy

--------------------------------------------------​--------------------------------------------
Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful.

Give Kudos to a post which you think is helpful.
--------------------------------------------------​-------------------------------------------
0 Kudos
Highlighted
Observer
Observer
16,345 Views
Registered: ‎04-01-2014

Re: XAPP1022 reworked, NULL pointer dereference

Jump to solution

Hi,

 

thanks for ur reply.

There was an mistake regarding the device ID.

 

Now it works

View solution in original post

0 Kudos