X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Farm7%2Fstart.s;h=d1a55dafa96eafa4470d7cdee575b247127f567d;hb=ada42e7583b4fa07b30d5c1a3e813c9754ec5e0f;hp=1597ba1963c1dfe768a352a491b3ce62f01232d9;hpb=3764c294f21229bdf700f436fa4884f5e76e0d3a;p=tpg%2Facess2.git diff --git a/Kernel/arch/arm7/start.s b/Kernel/arch/arm7/start.s index 1597ba19..d1a55daf 100644 --- a/Kernel/arch/arm7/start.s +++ b/Kernel/arch/arm7/start.s @@ -1,7 +1,9 @@ +KERNEL_BASE = 0x80000000 + interrupt_vector_table: b . @ Reset b . - b . @ SWI instruction + b SyscallHandler @ SWI instruction b . b . b . @@ -12,7 +14,68 @@ interrupt_vector_table: .globl _start _start: + ldr r0, _ptr_kerneltable0 + mcr p15, 0, r0, c2, c0, 1 @ Set TTBR1 to r0 + mov r0, #1 + mcr p15, 0, r0, c2, c0, 2 @ Set TTCR to 1 (50/50 split) + + mrc p15, 0, r0, c1, c0, 0 + orr r0, r0, #1 + mcr p15, 0, r0, c1, c0, 0 + ldr sp, =stack+0x10000 @ Set up stack - bl main + bl kmain 1: b 1b @ Infinite loop +_ptr_kerneltable0: + .long kernel_table0-0x80000000 + +SyscallHandler: + +.section .padata +.globl kernel_table0 +kernel_table0: + .rept 0x800 + .long 0 + .endr + .long 0x00000002 @ Identity map the first 4 MiB + .long 0x00100002 @ + .long 0x00200002 @ + .long 0x00300002 @ + .rept 0xF00 - 0x800 - 4 + .long 0 + .endr + .long hwmap_table_0 + 0x000 - KERNEL_BASE + 1 + .long hwmap_table_0 + 0x400 - KERNEL_BASE + 1 + .long hwmap_table_0 + 0x800 - KERNEL_BASE + 1 + .long hwmap_table_0 + 0xC00 - KERNEL_BASE + 1 + .rept 0xFF8 - 0xF00 - 4 + .long 0 + .endr + .long kernel_table1_map + 0x000 - KERNEL_BASE + 1 + .long kernel_table1_map + 0x400 - KERNEL_BASE + 1 + .long kernel_table1_map + 0x800 - KERNEL_BASE + 1 + .long kernel_table1_map + 0xC00 - KERNEL_BASE + 1 + .long kernel_table0 - KERNEL_BASE + 2 @ Sure it maps too much, but fuck that + .rept 0x1000 - 0xFF8 - 5 + .long 0 + .endr + +.globl kernel_table1_map +kernel_table1_map: + .rept 0xF00/4 + .long 0 + .endr + .long hwmap_table_0 - KERNEL_BASE + (1 << 4) + 3 + .rept 0xFF8/4 - 0xF00/4 - 1 + .long 0 + .endr + .long kernel_table1_map - KERNEL_BASE + (1 << 4) + 3 + .long 0 +.globl hwmap_table_0 +hwmap_table_0: + .long 0x16000000 + (1 << 4) + 3 @ Serial Port + .rept 1024 - 1 + .long 0 + .endr +