这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 嵌入式开发 » MCU » [求助]请教linuxppc(2.4.25)代码中head_44x.S中的一段代

共2条 1/1 1 跳转至

[求助]请教linuxppc(2.4.25)代码中head_44x.S中的一段代码

菜鸟
2006-12-19 21:13:44     打赏

/*
* Search TLB for entry that we are currently using.
* Invalidate all entries but the one we are using.
*/
/* Load our current PID->MMUCR TID and MSR IS->MMUCR STS */
mfspr r3,SPRN_MMUCR /* Get MMUCR */
lis r4,PPC44x_MMUCR_STS@h
ori r4,r4,PPC44x_MMUCR_TID@l /* Create mask */
andc r3,r3,r4 /* Clear out TID/STS bits */
mfspr r4,SPRN_PID /* Get PID */
or r3,r3,r4 /* Set TID bits */
mfmsr r5 /* Get MSR */
andi. r5,r5,MSR_IS@l /* TS=1? */
beq wmmucr /* If not, leave STS=0 */
oris r3,r3,PPC44x_MMUCR_STS@h /* Set STS=1 */
wmmucr: mtspr SPRN_MMUCR,r3 /* Put MMUCR */
sync

bl invstr /* Find our address */
invstr: mflr r5 /* Make it accessible */
tlbsx r23,0,r5 /* Find entry we are in */
li r4,0 /* Start at TLB entry 0 */
li r3,0 /* Set PAGEID inval value */
1: cmpw r23,r4 /* Is this our entry? */
beq skpinv /* If so, skip the inval */
tlbwe r3,r4,PPC44x_TLB_PAGEID /* If not, inval the entry */
skpinv: addi r4,r4,1 /* Increment */
cmpwi r4,64 /* Are we done? */
bne 1b /* If not, repeat */
isync /* If so, context change */

因为没有调试器,只能通过点灯来寻找程序挂起的地方

前面的代码点灯都能通过,执行到这段代码时出现问题

我在这段程序的 isync 后加上点灯,没有反应

我试着注释掉 bne 1b 之后,点灯通过了

感觉这段代码应该没有什么问题,不知道为什么点灯不能通过

请高手多多指教! 谢谢!




关键词: 求助     请教     linuxppc     2.4.25     代码         

菜鸟
2006-12-26 19:27:00     打赏
2楼
It's reasonable since all TLB entries except what you are using were disabled. I think the address of your led is faraway from the address you are running. If it is, the address of led cound't be translated.

You also could add a TLB entry that includes the address of your led, then turn on the led. It should be on.

共2条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]