Mercurial > lcfOS
view kernel/arch/qemu_vexpress/start.asm @ 410:6aa9743ed362 tip
Reflect change in c3 public modifier
author | Windel Bouwman |
---|---|
date | Mon, 23 Feb 2015 21:06:04 +0100 |
parents | ad6be5454067 |
children |
line wrap: on
line source
; This file contains the low level assembly code required for interrupt ; handling and virtual memory. section reset ; The reset vector: interrupt_vector_table: ivt_reset: B start ; 0x0 reset ivt_undef: B undef_handler ; 0x4 undefined instruction ivt_svc: B undef_handler ; 0x08 Supervisor call ivt_prefetch: B undef_handler ; 0x0C prefetch abort ivt_data: B undef_handler ; 0x10 data abort ivt_hyptrap: B undef_handler ; 0x14 not used ivt_irq: B undef_handler ; 0x18 IRQ ivt_fiq: B undef_handler ; 0x18 FIQ start: ; Setup the memory manager and the stack before entering kernel ; Output an 'A' to indicate aliveness: ldr r0, txtA ldr r1, DRreg str r0, [r1, 0] ; Setup TTBR1 (translation table base register) ldr r0, =kernel_table0 ; Load address of table mcr p15, 0, r0, c2, c0, 0 ; TTBR0 mcr p15, 0, r0, c2, c0, 1 ; TTBR1 ; Prepare the TTBCR (translation table base control register) mov r0, 0x1 ; TBD: why set this to 1? mcr p15, 0, r0, c2, c0, 2 ; Set domain 0 to manager: mov r0, 3 mcr p15, 0, r0, c3, c0, 0 ldr r0, txtB ldr r1, DRreg str r0, [r1, 0] ; Enable the VMSA (Virtual memory system architecture): mrc p15, 0, r0, c1, c0, 0 mov r1, 0x1 orr r0, r0, r1 mcr p15, 0, r0, c1, c0, 0 ldr r0, txtA ldr r1, DRregmapped str r0, [r1, 0] ; Setup stack: ldr r0, =stack_top mov sp, r0 BL kernel_start ; Branch to main (this is actually in the interrupt vector) local_loop: B local_loop ; Interrupt handlers: undef_handler: B undef_handler ; Assembly language helpers: ; Called to identify the proc: arch_pfr0: mrc p15, 0, r0, c0, c1, 0 mov pc, lr arch_pfr1: mrc p15, 0, r0, c0, c1, 1 mov pc, lr arch_mmfr0: mrc p15, 0, r0, c0, c1, 4 mov pc, lr arch_mpuir: mrc p15, 0, r0, c0, c0, 4 mov pc, lr arch_get_image_address: ldr r0, =ramdisk_start mov pc, lr ; data: txtA: dcd 65 txtB: dcd 66 DRreg: dcd 0x10009000 DRregmapped: dcd 0x109000 ; Memory map tables: ; Possibly, we are loaded into highmem at address 0x6000 0000, ; or it may as well be 0x0000 0000 as an alias. ; In any case, we must put an alias at 0x6000 0000 virtual. section mem_tables kernel_table0: dcd 0 dcd 0x10000402 ; Map to peripheral space 1 MB repeat 0x5FE dcd 0 endrepeat dcd 0x60000402 ; Identity map this! repeat 0x9FF dcd 0 endrepeat ; Create a label to indicate the ramdisk: section ramdisk ramdisk_start: ; Create stack space: section stack stack_bot: ds 0x1000 stack_top: