linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Newbie question about accessing memory in kernel space
@ 2005-05-24 19:19 Niklaus Giger
  2005-05-24 20:17 ` Wolfgang Grandegger
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Niklaus Giger @ 2005-05-24 19:19 UTC (permalink / raw)
  To: linuxppc-embedded, rtai

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.

I can see the CPLD when I access the address via my Abatron BDI debugger.

In a user space test program I did a
    map_base = mmap((void *)target, nSize, PROT_READ | PROT_WRITE, MAP_SHARED, 
fd, target);
and was able to access the CPLD, too.

In user and kernel space the procedure looks like this:
void sys_set_tick_control_register_value(uint16 value)
{
    static uint16    *tickControlRegister       = (uint16*)
					HCU_TICK_CONTROL_REGISTER_ADDRESS;   
   *tickControlRegister = value;
}

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]
NIP: C302B0C4 LR: C302B350 SP: C1DABED0 REGS: c1dabe20 TRAP: 0300    Not 
tainted
MSR: 00029030 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 7D000000, DSISR: 00800000
TASK = c1d827b0[27] 'insmod' THREAD: c1daa000
Last syscall: 128
PLB0: bear= 0x04000004 acr=   0x00000000 besr=  0x00000000
PLB0 to OPB: bear= 0xef6007ff besr0= 0x00000000 besr1= 0x00000000

GPR00: C302B348 C1DABED0 C1D827B0 0000002B 00000CAC FFFFFFFF C01C0000 00029030
GPR08: C01CBB30 C3030000 00000000 7D000000 00000000 10075308 01FFBC00 007FFF77
GPR16: 00000000 00000001 10050000 00000002 7FFFFF68 10070000 00000001 C3030000
GPR24: C3030000 C3030000 FFFFFFFF 00000000 C3030000 C3030000 C0189318 C302BEC0
NIP [c302b0c4] sys_set_tick_control_register_value+0x8/0x10 [kTickTest]
LR [c302b350] init_module+0xd0/0x10c [kTickTest]
Call trace:
 [c0030954] sys_init_module+0x218/0x328
 [c0002900] syscall_dotrace_cont+0x24/0x38
Segmentation fault

What is wrong with my code? 

Any hints would be appreciated.

Thanks in advance.

^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <20050525020004.CCA3A67A3F@ozlabs.org>]

end of thread, other threads:[~2005-05-25 13:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-24 19:19 Newbie question about accessing memory in kernel space Niklaus Giger
2005-05-24 20:17 ` Wolfgang Grandegger
2005-05-24 20:31 ` Matt Porter
2005-05-25 11:31   ` Niklaus Giger
2005-05-24 23:58 ` Roger Larsson
2005-05-25 11:35   ` Niklaus Giger
     [not found] <20050525020004.CCA3A67A3F@ozlabs.org>
2005-05-25 13:17 ` David Bruce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).