免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1562 | 回复: 1
打印 上一主题 下一主题

[内核入门] arch/mips/kernel/head.S [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2015-02-08 14:11 |只看该作者 |倒序浏览
本帖最后由 torchof2008 于 2015-02-08 14:13 编辑

arch/mips/kernel/head.S中设置setup_c0_status时的

    .macro setup_c0_status set clr
    .set    push
#ifdef CONFIG_MIPS_MT_SMTC
    /*
     * For SMTC, we need to set privilege and disable interrupts only for
     * the current TC, using the TCStatus register.
     */
    mfc0    t0, CP0_TCSTATUS
    /* Fortunately CU 0 is in the same place in both registers */
    /* Set TCU0, TMX, TKSU (for later inversion) and IXMT */
    li t1, ST0_CU0 | 0x08001c00
    or t0, t1
    /* Clear TKSU, leave IXMT */
    xori    t0, 0x00001800
    mtc0    t0, CP0_TCSTATUS
    _ehb
    /* We need to leave the global IE bit set, but clear EXL...*/
    mfc0    t0, CP0_STATUS
    or t0, ST0_CU0 | ST0_EXL | ST0_ERL | \set | \clr
    xor t0, ST0_EXL | ST0_ERL | \clr
    mtc0    t0, CP0_STATUS
#else
    mfc0    t0, CP0_STATUS
    or t0, ST0_CU0|\set|0x1f|\clr
    xor t0, 0x1f|\clr
    mtc0    t0, CP0_STATUS
    .set    noreorder
    sll zero,3              # ehb
#endif
    .set    pop
    .endm

上面代码中,setup_c0_status set clr中的 set clr和| \set | \clr、|\set|0x1f|\clr是什么意思呢?查了一些资料没有找到答案,麻烦知道的网友解答一些。谢谢~~

论坛徽章:
22
丑牛
日期:2014-08-15 14:32:0015-16赛季CBA联赛之同曦
日期:2017-12-14 15:28:14黑曼巴
日期:2017-08-10 08:14:342017金鸡报晓
日期:2017-02-08 10:39:42黑曼巴
日期:2016-11-15 15:48:38CU十四周年纪念徽章
日期:2016-11-09 13:19:1015-16赛季CBA联赛之同曦
日期:2016-04-08 18:00:03平安夜徽章
日期:2015-12-26 00:06:30程序设计版块每日发帖之星
日期:2015-12-03 06:20:002015七夕节徽章
日期:2015-08-21 11:06:17IT运维版块每日发帖之星
日期:2015-08-09 06:20:002015亚冠之吉达阿赫利
日期:2015-07-03 08:39:42
2 [报告]
发表于 2015-02-08 17:53 |只看该作者

就是宏展开。
例如setup_c0_status 10 20中的
     or t0, ST0_CU0|\set|0x1f|\clr
就成了
     or t0, ST0_CU0|10|0x1f|20

这些东西没什么资料,看看基本这么回事就行了。关于mips最好的书是see mips run,可以看看
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP