📄 pagetab.s
字号:
;本程序执行了MMU初始化,使能,设置domain,目的是使0x10000000开始的地址映射到0x0处.;以便可以修改异常向量表.;如果全速执行,暂停之后,r0的内容是0x56781234,则证明发生了swi,并且正确处理了它。; pagetab.s - pagetable definition; Copyright (C) 1997 Advanced RISC Machines Limited.; All Rights Reserved; BlankPageTable defines whether 'pagetab.s' exports an empty table,; or a completed page table. There is an identical define in; 'encache.c', and the two should be kept in step. GBLL BlankPageTableBlankPageTable SETL {FALSE}; Generate either a blank page table for the C code to fill in, or; generate a full page table at assemble-time IF BlankPageTable ; Generate a blank page table with the % directive AREA pagetab, ALIGN=14, DATA, NOINIT EXPORT pagetablepagetable % 16*1024 ELSE ; Generate a full page table, using repetitive assembly; Access Permissions - not shifted into position.NO_ACCESS * 0 ; Depending on the 'R' and 'S' bit, 0SVC_R * 0 ; represents one of these accessALL_R * 0 ; permissions (see A.R.M. section 7.8)SVC_RW * 1NO_USR_W * 2ALL_ACCESS * 3; U, C and B bits in their correct positions (see A.R.M. section 7.6.5)U_BIT * 16C_BIT * 8B_BIT * 4; Entry type (see A.R.M. section 7.6.5)SECTION * 2PAGE * 1INVALID * 0 MACRO L1Entry $type, $addr, $dom, $ucb, $acc [ $type = SECTION DCD ( (($addr) :AND: &FFF00000) :OR: \ (($acc) :SHL: 10) :OR: \ (($dom) :SHL: 5) :OR: $ucb :OR: $type ) MEXIT ] [ $type = PAGE DCD ( (($addr) :AND: &FFFFFC00) :OR: \ (($dom) :SHL: 5) :OR: \ (($ucb) :AND: U_BIT) :OR: $type ) | DCD 0 ; Invalid Level 1 Page Table Entry ] MEND AREA init,CODE,READONLY entry b myrst b . b myswimyrst ldr r0,= mycopystart ldr r1,=pagetab mov r3,#00 ldrcc r2,[r0],#4;cc/lo无符号数小于 strcc r2,[r1],#4 add r3,r3,#1 cmp r3,#0x100 bcc %b0 ldr r1,=pagetab MCR p15,0,r1,c2,c0 MRC p15,0,r1,c3,c0,0 ldr r1,=0xffffffff MCR p15,0,r1,c3,c0,0 mrc p15,0,r0,c1,c0,0 orr r0,r0,#01 mcr p15,0,r0,c1,c0,0 swi 0x12345 nop nop b .myswi ldr r0,=0x56781234;如果全速执行,暂停之后,r0的内容是0x56781234,则证明发生了swi,并且正确处理了它。 b . ltorgmycopystart AREA pagetab, ALIGN=14, DATA; Create the pagetable using repetitive assembly. Creates just a table; of "section" entries. True "page tables" would need to be created in a; similar fashion. EXPORT pagetablepagetable GBLA countercounter SETA 0 ; area 1 - 0->16MB, cacheable WHILE counter < 0x100+1 L1Entry SECTION, (0x100:SHL:20), 0, \ U_BIT+C_BIT+B_BIT, ALL_ACCESScounter SETA counter + 1 WEND ENDIFmycopyend END; end of file pagetab.s
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -