[okl4-developer] how to resolve page_fault
Josh Matthews
jmatthews at ok-labs.com
Wed Jan 21 09:35:16 EST 2009
Hi Sean,
Good to see you're making progress with the port :-)
On Tue, January 20, 2009 10:16 am, Sean Chiang wrote:
<..>
> The reason why I got no respond is because of PAGE_FAULT when switching
> from idle thread to _hello_ thread.
>
> We could see the instruction address(pc) when page fault happened is
> _0x001056a0_
> from okl4.log.
>
> 00105640 <hello-device_setup_impl>:
> ...
> 105690: e284400c add r4, r4, #12 ; 0xc
> 105694: daffffef ble 105658 <hello-device_setup_impl+0x18>
> 105698: e5952068 ldr r2, [r5, #104]
> 10569c: e59fe160 ldr lr, [pc, #352] ; 105804
> <hello.text+0x5804>
> 1056a0: e5923000 ldr r3, [r2]
>
> According the asm code,
>
> r2 = memory(r5+#104) = memory(0x200d98+#104) = memory(0x200e00) = 0x0
> r3 = memory(r2) = memory(0x0)
>
> When I dump the memory (0x0), it show ######## always, I thought that's
> why page_fault. I'll keep trying and any idea/hint how to resolve this
problem
> is very > appreciated. ;)
Your assumption is correct - the "#" output in KDB indicates there's no
mapping at that address. In this case, it's most likely that you're
hitting a null pointer exception (you obviously wouldn't want 0x0 mapped,
since it's used to represent NULL).
Some pointers for debugging this: I'd assume this is occurring in your
serial driver (since that's the only driver that the hello example uses).
libserial's serial_init function calls device_setup, which gets marshaled
through to your s3c2442_uart's device_setup_impl function - this is where
to start looking for the error. An input is likely bad - in particular,
check the resources that are passed to device_setup_impl. You can see
libserial hardcodes the memory resource to an elfweaver-provided
environment variable called "MAIN_SERIAL_MEM0" - check that this exists
(either in your machine.xml [you should see a physical segment called
"serial_mem0", elfweaver just prepends it with the name of the first
space, which is always "MAIN"] or by running an objdump -s on your system
image, searching for cell_env, and checking the constants).
Hope that gives you a place to start - let us know how you go.
Best regards,
Josh
More information about the Developer
mailing list