Re: Newbie question about accessing memory in kernel space

2 messages, 2 authors, 2005-05-25 · open the first message on its own page

Re: Newbie question about accessing memory in kernel space

From: Matt Porter <mporter@kernel.crashing.org>
Date: 2005-05-24 20:31:29

On Tue, May 24, 2005 at 09:19:28PM +0200, Niklaus Giger wrote:
Hi

I am working on a custom PPC405 board where I have a 2.6.10 kernel with RTAI 
patches (fusion) running.

I am trying to access some custom CPLD chip hanging at 0x7D000000. In my 
intial board (hcu3_map_io) I added a corresponding io_block_mapping.
Is a "corresponding" mapping a 1:1 mapping? Don't do that.  You cannot
map stuff that way since it is below TASK_SIZE i.e. it's in user address
space, not kernel address space.
Now I compiled a module which tries to access the CPLD during the insmod phase
and I get the following output.

Oops: kernel access of bad area, sig: 11 [#1]
<snip>
What is wrong with my code? 
You mapped the device into user virtual address space.  The TLB
replacement code is unable to load a TLB entry for a page outside
of kernel space...so you crash.

Don't use io_block_map()...it allows you to shoot yourself in the
foot very easily (as you just witnessed). Use ioremap() to map
your device.

-Matt

Re: Newbie question about accessing memory in kernel space

From: Niklaus Giger <hidden>
Date: 2005-05-25 11:31:32

Am Dienstag, 24. Mai 2005 22.31 schrieb Matt Porter:
On Tue, May 24, 2005 at 09:19:28PM +0200, Niklaus Giger wrote:
quoted
Hi
quoted
Oops: kernel access of bad area, sig: 11 [#1]
<snip>
quoted
What is wrong with my code?
You mapped the device into user virtual address space.  The TLB
replacement code is unable to load a TLB entry for a page outside
of kernel space...so you crash.

Don't use io_block_map()...it allows you to shoot yourself in the
foot very easily (as you just witnessed). Use ioremap() to map
your device.
ioremap() fixed my problem.

Thanks a lot for your help.

Best regards

Niklaus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help