Wince EBoot 建立一级页表的疑问????
lzbit 2011-09-02 10:42:52 Wince EBoot 建立一级页表的疑问, 第一个页表项为0x80000000虚拟地址对应的页表项, PTs为0x3001000。
转换原理 得到它的页表项位置为 (0x80000000>>18) + PTs = 0x2000+0x30010000 = 0x30012000
但下面的代码有点不理解,一开始就为什么要加0x2000呢
;==============这里为什么要加0x2000????===================
代码如下:
add r10, r10, #0x2000 ; (r10) = ptr to 1st PTE for "unmapped space"
g_oalAddressTable
DCD 0x80000000, 0x30000000, 64 ; 64 MB DRAM BANK 6
下面是部分代码:
; Compute physical address of the OEMAddressTable.
20 add r11, pc, #g_oalAddressTable - (. + 8)
ldr r10, =PTs ; (r10) = 1st level page table
; Setup 1st level page table (using section descriptor)
; Fill in first level page table entries to create "un-mapped" regions
; from the contents of the MemoryMap array.
;
; (r10) = 1st level page table
; (r11) = ptr to MemoryMap array
;==============这里为什么要加0x2000===================
add r10, r10, #0x2000 ; (r10) = ptr to 1st PTE for "unmapped space"
mov r0, #0x0E ; (r0) = PTE for 0: 1MB cachable bufferable
orr r0, r0, #0x400 ; set kernel r/w permission
25 mov r1, r11 ; (r1) = ptr to MemoryMap array
30 ldr r2, [r1], #4 ; (r2) = virtual address to map Bank at
ldr r3, [r1], #4 ; (r3) = physical address to map from
ldr r4, [r1], #4 ; (r4) = num MB to map
cmp r4, #0 ; End of table?
beq %f40
ldr r5, =0x1FF00000
and r2, r2, r5 ; VA needs 512MB, 1MB aligned.
ldr r5, =0xFFF00000
and r3, r3, r5 ; PA needs 4GB, 1MB aligned.
;==============这里虚拟地址已经右移了18===============
add r2, r10, r2, LSR #18
add r0, r0, r3 ; (r0) = PTE for next physical page