📄 lilmon.s
字号:
@@ $Id: lilmon.s,v 1.1.1.1 2002/11/29 09:24:07 alvin Exp $ @@ @@ @@ This is the "little" monitor. It has boot code @@ and default code for the other vectors. @@ .org 0x0_start: .global _start @@ @@ Exception Vectors @@ b $1 @ reset b handleUndef b handleSWI b handlePrefetch b handleData b $1 @ shouldn't get here! b handleIRQ @@ @@ FIQ handler is in-line here @@ handleFIQ: subs pc, r14, #4 .align 5 @@ @@ $1 is the reset handler @@ .equ CR_VALUE, 0x100F$1: @@ Initialize things... @@ MMU Initialization mvn r0, #0 mcr p15, 0, r0, c3, c0, 0 @ no domain stuff please ldr r0, =pageTable mcr p15, 0, r0, c2, c0, 0 @ set page table base @@ fixme -- enable interrupts mrs r3,cpsr bic r3,r3,#0xC0 msr cpsr,r3 @@ enable caches, MMU, etc. ldr r0, =CR_VALUE mcr p15, 0, r0, c1, c0, 0 @ set control reg. @@ Wait for all changes to quiesce mrc p15, 0, r0, c2, c0, 0 mov r0, r0 sub pc, pc, #4 ldr r14, goAddr @ goAddr has addr to run mov pc, r14 @ go to user codenoWhere: b noWhere @@ Startup code will jump to the address that is stored in @@ location goAddr in memory. Usually, this will be patched @@ so that it points to the user's code. If not patched, we just @@ branch to noWhere. goAddr: .global goAddr .word 0x8000 @@ @@ Other handlers @@ .align 5 handleUndef: movs pc, r14 .align 5handleSWI: cmp r0, #0x16 @@ sys_heapinfo sys call bne continue_swi ldr r0, [r1] mov r1, r0 ldr r0, =0x40000000 str r0, [r1], #4 ldr r0, =0x4000FFFC str r0, [r1], #4 ldr r0, =0x50000000 str r0, [r1], #4 ldr r0, =0x5000FFFC str r0, [r1], #4 sub r1, r1, #0x10 @@ restore R1 b end_of_swicontinue_swi: .word 0xE7DEAD1Aend_of_swi: movs pc, r14 .align 5handlePrefetch: subs pc, r14, #4 .align 5handleData: subs pc, r14, #4 .align 5handleIRQ: subs pc, r14, #4.LTORG_user_stack: .fill 1024,4, 0x0_user_stack_limit:_heap_base: .fill 1024,4, 0x0_heap_limit: @@ Room for page table. This is filled in with @@ section descriptors. .align 14pageTable: .set desc, 0x100E .rept (4096) .long desc .set desc, desc + 0x100000 .endr endLilMon:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -