|
1、配置及环境
环境:ubuntu 9.04 + skyeye-1.3.0 + OKL4-3.0
$ tools/build.py machine=gta01 project=iguana example=sleeping_barber kdb_serial=True PYFREEZE=False enable_fastpaths=true debug_trace=5 verbose=false
2、运行时出现pagefault,
MAP_MEMORY: V:0xe00000 O:0x0 (P=30e00000) S:0x1400000 N:0x9 A=0x3 R=0x7
SETUP_SEGMENT: P:0x30798000..0x30799000, rwx:6, attrib:ff
MAP_MEMORY: V:0x2dc000 O:0x0 (P=30798000) S:0x1000 N:0xa A=0x3 R=0x6
--- KD# System started (press 'g' to continue) ---
> go
Assertion "current->get_post_syscall_callback() != NULL" failed in file 'pistachio/src/thread.cc', line 978 (fn=f000dd1c)
--- KD# assert ---
> go
kernel access raised user pagefault @ 00000000, ip=00000000, space=f0107e4c, esp = f0023b2c
current tcb = f0103d20
--- KD# kpf ---
> go
handle_pagefault:219: unhandled pagefault @ 00000000, 00000000
--- KD# unhandled pagefault ---
> go
最后跟踪到traps.spp中的 arm_common_return,
引起pagefault的原因,是 ARMv4(GTA01)不支持 clzeq 指令, 这也可说明为什么gumstix测试正常。
from: http://wiki.ok-labs.com/forum#nabble-td730527
diff -urp okl4_2.1.1-patch.9/arch/arm/pistachio/v5/src/traps.spp okl4_2.1.1-patch.9.mod/arch/arm/pistachio/v5/src/traps.spp
--- okl4_2.1.1-patch.9/arch/arm/pistachio/v5/src/traps.spp 2008-06-16 15:16:54.000000000 +1000
+++ okl4_2.1.1-patch.9.mod/arch/arm/pistachio/v5/src/traps.spp 2008-08-20 17:05:16.260771801 +1000
@@ -219,10 +219,11 @@ LABEL(fiq_vec)
SET_USER_DACR
LOAD_CONTEXT_INTO_SP
/* LOAD_CONTEXT_INTO_SP will have z flag set if return to user */
- ldreq r1, [r0, #OFS_TCB_POST_SYSCALL_CALLBACK]
- clzeq r1, r1 /* r1 contains callback function, 0xFXXXXXXX */
+ ldr r1, [r0, #OFS_TCB_POST_SYSCALL_CALLBACK]
cmpeq r1, #0 /* r1 should be 0, if has callback function */
+ bne kernel_fixup
+normal_return:
ldr lr, [sp, #PT_CPSR]
ldmib sp, {r0-r14}^
nop
@@ -230,7 +231,16 @@ LABEL(fiq_vec)
ldr lr, [sp, #PT_PC]
add sp, sp, #PT_SIZE
- subnes pc, lr, #1
+ subs pc, lr, #1
+
+ /*
+ * Two possible cases to get here:
+ * -normal return to kernel mode - need to jump back
+ * -post syscall callback - need to fall through
+ */
+kernel_fixup:
+ cmp r1, #0
+ beq normal_return
/* If there is a post-syscall callback, handle that now. */
ldr r0, =arm_perform_callback_from_interrupt
修改之后,则一切正常。
3、测试
$ skyeye -c skyeye_gta01.conf -e build/images/image.boot
OKL4 - (provider: Open Kernel Labs) built on Mar 17 2010 09:30:08 using gcc version 3.4.4.
--- KD# System started (press 'g' to continue) ---
> go
*****************************************
* Iguana system, Copyright 1996-2006 *
* ERTOS - National ICT Australia *
*****************************************
vbase is 0x38000000, vend is 0xcfffffff
addr is 0x38000000, vbase is 0x38000000
Start Sleeping barber test #1: 1 customers
Barber 5/7 finished: 1 hair cut done, 1 customers
Sleeping barber test #1 finished
$ cat skyeye_gta01.conf
arch: arm
cpu: arm920t
mach: s3c2410x
# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x10000000
mem_bank: map=M, type=RW, addr=0x30000000, size=0x08000000
# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x18000000
# mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
# net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1
# nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
# lcd: type=s3c2410x, mod=gtk
# regfile:r1=193
# dbct:state=on
uart: mod=term
4、其它
1)skyeye对于V4不支持的指令(clzeq)引起pagefault,而不是未定义指令异常,这有些奇怪。
2)对OKL4的整个处理流程有个基本的认识和理解。
3)对objdump的作用及OKL4已提供的调试工具,也有个更深层次的认识
[ 本帖最后由 goosen 于 2010-3-17 10:08 编辑 ] |
|