.data
.align 12
level0_base:
.space 4096
level1_base:
.space 4096
level2_base:
.space 4096
level3_base:
.space 4096
.space 4096 * 8
level_end:
.text
.align 3
enable_mmu:
MOV X20, X30
/* zero all level table */
ADRP X0, level0_base
ADRP X1, level3_base
# ADD X1, X1, #4096
ADRP X1, level_end
1:STP XZR, XZR, [X0], #16
/*
MOV X18, X0
MOV X19, X1
MOV X0, #'C'
BL __putc
MOV X0, X18
MOV X1, X19
*/
CMP X1, X0
BHI 1b
/*
ADRP X16, level0_base
ADRP X17, level3_base
ADD X17, X17, #4096
2:LDR X0, [X16], #8
LDR X1, =info_debug_str
__puthex X0, X1
CMP X17, X16
BHI 2b
*/
ADRP X13, level0_base
/* ID map */
/* PL011 UART 4KB */
LDR X0, =CONFIG_VENDOR_PL011_CONSOLE_BASE
create_table_entry X13, X0, 39, 512, X5, X6
create_table_entry_device X13, X0, 30, 512, X5, X6
create_table_entry X13, X0, 21, 512, X5, X6
MOV X1, #0x303
MOV X5, X0
ADD X6, X0, #4096-1
create_block_map X13, X1, X0, X5, X6
/* ALL Image : 16MB, +2MB */
ADRP X13, level0_base
LDR X0, =0x4000000
create_table_entry X13, X0, 39, 512, X5, X6
create_table_entry X13, X0, 30, 512, X5, X6
create_table_entry X13, X0, 21, 512, X5, X6
MOV X1, #0x307
MOV X5, X0
MOV X2, #0x200000
SUB X2, X2, #1
ADD X6, X0, X2
create_block_map X13, X1, X0, X5, X6
ADRP X16, level0_base
# ADRP X17, level3_base
# ADD X17, X17, #4096
# ADRP X17, level_end
MOV X0, #4096
ADD X1, X16,X0, LSL #3
ADD X1, X1, X0, LSL #1
ADD X17, X1, X0 /* MOV X17, X1 */
3:LDR X0, [X16], #8
LDR X1, =info_debug_str
__puthex X0, X1
CMP X17, X16
BHI 3b
/* Set Base Address of the MMU */
ADRP X0, level0_base
MSR TTBR0_EL1, X0
LDR X1, =ttbr0_debug_str
__puthex X0, X1
阅读(2669) | 评论(0) | 转发(0) |