Oops in fault.c, Unable to handle kernel paging request at virtualaddress 00000004

M

mattng604

Hi,

I am trying to typecast a void* pointer to a structure I defined
called _sfrdm336_mdb. However, when I try, I get the following error:
Oops in fault.c, Unable to handle kernel paging request at virtual
address 00000004 .

Could you please help me? I'm very stuck! I even tried ioremap() to
map the physical address kmalloc returns to a virtual address. The
problem occurs when I try to do the typecast (sFRDM336_MDB *) below:

/
******************************************************************************/
typedef struct _sfrdm336_mdb
{
INT4 errModule; /* Global error Indicator for
module
calls */
UINT2 valid; /* Indicates that this structure
has been
initialized */
eFRDM336_MOD_STATE stateModule; /* Module state; can be one of
the following
FRDM336_MOD_START,
FRDM336_MOD_IDLE or
FRDM336_MOD_READY */
UINT2 maxDevs; /* Maximum number of devices
supported */
UINT2 numDevs; /* Number of devices currently
registered */
UINT2 maxInitProfs; /* Maximum number of
initialization
profiles */
sFRDM336_DDB *pddb; /* (array of) Device Data Blocks
(DDB) in
context memory */
sFRDM336_DIV *pinitProfs; /* (array of) Initialization
profiles in
context memory */
} sFRDM336_MDB;


sFRDM336_MDB *frdm336Mdb; // TOP OF FILE, public variable

INT4 frdm336ModuleOpen ()
{

frdm336Mdb = (sFRDM336_MDB *) kmalloc(sizeof(sFRDM336_MDB),
GFP_KERNEL);

sysFrdm336MemSet(frdm336Mdb, 0, size);

return 0;

} /* frdm336ModuleOpen */
/
******************************************************************************/


Thanks in advance for your help!
Matt
 
S

santosh

Hi,

I am trying to typecast a void* pointer to a structure I defined
called _sfrdm336_mdb. However, when I try, I get the following error:
Oops in fault.c, Unable to handle kernel paging request at virtual
address 00000004 .

Could you please help me? I'm very stuck! I even tried ioremap() to
map the physical address kmalloc returns to a virtual address. The
problem occurs when I try to do the typecast (sFRDM336_MDB *) below:

<snip>

If this kernel has groups devoted to it, please ask there. If you are
developing this on your own then please ask in
<news:alt.os.development>.
 
C

CBFalconer

santosh said:
<snip>

If this kernel has groups devoted to it, please ask there. If you
are developing this on your own then please ask in
<news:alt.os.development>.

No need. A void* pointer is automatically converted to anything.
Simply have a ponter defined as type "sfrdm336_mdb*" [1] and assign
the void * to it. All done.

[1] Note that the initial _ in the type name is not allowed, and
invades the implementors namespace. This may be the cause of his
troubles.
 
B

Barry Schwarz

Hi,

I am trying to typecast a void* pointer to a structure I defined

It is never necessary to cast a void* to another pointer to object
type. Your problem lies elsewhere.
called _sfrdm336_mdb. However, when I try, I get the following error:

You have a struct tag named _sfrdm336_mdb but your struct type is
either sFRDM336_MDB or struct _sfrdm336_mdb, never plain
_sfrdm336_mdb.
Oops in fault.c, Unable to handle kernel paging request at virtual
address 00000004 .

It would be nice if you told us whether this was a compile time, link
time, or run time message.
Could you please help me? I'm very stuck! I even tried ioremap() to
map the physical address kmalloc returns to a virtual address. The
problem occurs when I try to do the typecast (sFRDM336_MDB *) below:

No it doesn't.
/
******************************************************************************/
typedef struct _sfrdm336_mdb
{
INT4 errModule; /* Global error Indicator for
module
calls */
UINT2 valid; /* Indicates that this structure
has been
initialized */
eFRDM336_MOD_STATE stateModule; /* Module state; can be one of
the following
FRDM336_MOD_START,
FRDM336_MOD_IDLE or
FRDM336_MOD_READY */
UINT2 maxDevs; /* Maximum number of devices
supported */
UINT2 numDevs; /* Number of devices currently
registered */
UINT2 maxInitProfs; /* Maximum number of
initialization
profiles */
sFRDM336_DDB *pddb; /* (array of) Device Data Blocks
(DDB) in
context memory */
sFRDM336_DIV *pinitProfs; /* (array of) Initialization
profiles in
context memory */
} sFRDM336_MDB;


sFRDM336_MDB *frdm336Mdb; // TOP OF FILE, public variable

INT4 frdm336ModuleOpen ()
{

frdm336Mdb = (sFRDM336_MDB *) kmalloc(sizeof(sFRDM336_MDB),
GFP_KERNEL);

Since kmalloc is not a standard function, you will probably get much
better advice in a newsgroup devoted to whatever system it is provided
with.
sysFrdm336MemSet(frdm336Mdb, 0, size);

return 0;

} /* frdm336ModuleOpen */
/
******************************************************************************/


Thanks in advance for your help!
Matt


Remove del for email
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top