X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Farmv7%2Fstart.S;h=3c0779fb8ce4afc73bbf5c8f7619850451617cb3;hb=1389dd6a77cfe0f01ae941f6f696bd5eda22e959;hp=2d3f81a5d1e299a0f7ec91144b4ff42f0330e1da;hpb=419b7b18a70e5f65698c5eda4f62f546f02d32e4;p=tpg%2Facess2.git diff --git a/Kernel/arch/armv7/start.S b/Kernel/arch/armv7/start.S index 2d3f81a5..3c0779fb 100644 --- a/Kernel/arch/armv7/start.S +++ b/Kernel/arch/armv7/start.S @@ -7,14 +7,14 @@ @ .section .init interrupt_vector_table: -ivt_reset: b _start @ Reset -ivt_undef: b . @ #UD -ivt_svc: b SVC_Handler @ SVC (used to be called SWI) -ivt_prefetch: b PrefetchAbort @ Prefetch abort -ivt_data: b DataAbort @ Data abort -ivt_unused: b . @ Not Used -ivt_irq: b IRQHandler @ IRQ -ivt_fiq: b . @ FIQ (Fast interrupt) +ivt_reset: b _start @ 0x00 Reset +ivt_undef: b . @ 0x04 #UD +ivt_svc: b SVC_Handler @ 0x08 SVC (used to be called SWI) +ivt_prefetch: b PrefetchAbort @ 0x0C Prefetch abort +ivt_data: b DataAbort @ 0x10 Data abort +ivt_unused: b . @ 0x14 Not Used +ivt_irq: b IRQHandler @ 0x18 IRQ +ivt_fiq: b . @ 0x1C FIQ (Fast interrupt) .globl _start _start: @@ -34,6 +34,10 @@ _start: orr r0, r0, #1 << 23 mcr p15, 0, r0, c1, c0, 0 + @ Enable access faults on domains 0 & 1 + mov r0, #0x55 @ 01010101b + mcr p15, 0, r0, c3, c0, 0 + @ @ Check for security extensions @ @@ -85,10 +89,15 @@ SVC_Handler: ldr r4, =SyscallHandler blx r4 + ldr r0, =csSyscallPrintRetAddr + ldr r1, [sp,#9*4+5*4] + ldr r4, =Log + blx r4 + pop {r2} @ errno pop {r0,r1} @ Ret/RetHi add sp, #2*4 @ Saved r2/r3 - + pop {r4-r12} rfeia sp! @ Pop state (actually RFEFD) .arm_specifics: @@ -116,10 +125,10 @@ IRQHandler: PUSH_GPRS -@ ldr r0, =csIRQ_Tag -@ ldr r1, =csIRQ_Fmt -@ ldr r4, =Log_Debug -@ blx r4 + ldr r0, =csIRQ_Tag + ldr r1, =csIRQ_Fmt + ldr r4, =Log_Debug + blx r4 @ Call the registered handler ldr r0, gpIRQHandler @@ -134,22 +143,19 @@ IRQHandler: .globl DataAbort DataAbort: sub lr, #8 @ Adjust LR to the correct value -@ srsdb sp!, #19 @ Switch to supervisor mode (DDI0406B D1.6.5) (actually SRSFD) + srsdb sp!, #23 @ Switch to supervisor mode (DDI0406B D1.6.5) (actually SRSFD) @ cpsid ifa, #19 -@ PUSH_GPRS + PUSH_GPRS - mrc p15, 0, r4, c5, c0, 0 @ Read DFSR (Data Fault Address Register) to stack - push {r4} - mrc p15, 0, r3, c6, c0, 0 @ Read DFAR (Data Fault Address Register) into R3 - mov r2, lr - ldr r1, =csDataAbort_Fmt - ldr r0, =csAbort_Tag - ldr r4, =Log_Error + mov r3, #0 @ not a prefetch abort + mrc p15, 0, r2, c5, c0, 0 @ Read DFSR (Data Fault Status Register) to R2 + mrc p15, 0, r1, c6, c0, 0 @ Read DFAR (Data Fault Address Register) into R1 + mov r0, lr @ PC + ldr r4, =MM_PageFault blx r4 - b . -@ POP_GPRS -@ rfeia sp! @ Pop state (actually RFEFD) + POP_GPRS + rfeia sp! @ Pop state (actually RFEFD) .globl PrefetchAbort PrefetchAbort: @@ -176,12 +182,14 @@ csDataAbort_Fmt: .asciz "Data Abort - %p accessed %p, DFSR=%x Unk:%x Unk:%x" csPrefetchAbort_Fmt: .asciz "Prefetch Abort at %p, IFSR=%x" +csSyscallPrintRetAddr: + .asciz "Syscall ret to %p" .section .padata .globl kernel_table0 kernel_table0: - .long 0x00000002 @ Identity map the first 1 MiB + .long 0x00000402 @ Identity map the first 1 MiB .rept 0x7FC - 1 .long 0 .endr @@ -190,30 +198,30 @@ kernel_table0: .long user_table1_map + 0x800 - KERNEL_BASE + 1 @ KStacks .long user_table1_map + 0xC00 - KERNEL_BASE + 1 @ 0x80000000 - User/Kernel split - .long 0x00000002 @ Map first 4 MiB to 2GiB - .long 0x00100002 @ - .long 0x00200002 @ - .long 0x00300002 @ + .long 0x00000402 @ Map first 4 MiB to 2GiB (KRW only) + .long 0x00100402 @ + .long 0x00200402 @ + .long 0x00300402 @ .rept 0xF00 - 0x800 - 4 .long 0 .endr #if PCI_PADDR - .long PCI_PADDR + 0*(1 << 20) + 2 @ Map PCI config space - .long PCI_PADDR + 1*(1 << 20) + 2 - .long PCI_PADDR + 2*(1 << 20) + 2 - .long PCI_PADDR + 3*(1 << 20) + 2 - .long PCI_PADDR + 4*(1 << 20) + 2 - .long PCI_PADDR + 5*(1 << 20) + 2 - .long PCI_PADDR + 6*(1 << 20) + 2 - .long PCI_PADDR + 7*(1 << 20) + 2 - .long PCI_PADDR + 8*(1 << 20) + 2 - .long PCI_PADDR + 9*(1 << 20) + 2 - .long PCI_PADDR + 10*(1 << 20) + 2 - .long PCI_PADDR + 11*(1 << 20) + 2 - .long PCI_PADDR + 12*(1 << 20) + 2 - .long PCI_PADDR + 13*(1 << 20) + 2 - .long PCI_PADDR + 14*(1 << 20) + 2 - .long PCI_PADDR + 15*(1 << 20) + 2 + .long PCI_PADDR + 0*(1 << 20) + 0x402 @ Map PCI config space + .long PCI_PADDR + 1*(1 << 20) + 0x402 + .long PCI_PADDR + 2*(1 << 20) + 0x402 + .long PCI_PADDR + 3*(1 << 20) + 0x402 + .long PCI_PADDR + 4*(1 << 20) + 0x402 + .long PCI_PADDR + 5*(1 << 20) + 0x402 + .long PCI_PADDR + 6*(1 << 20) + 0x402 + .long PCI_PADDR + 7*(1 << 20) + 0x402 + .long PCI_PADDR + 8*(1 << 20) + 0x402 + .long PCI_PADDR + 9*(1 << 20) + 0x402 + .long PCI_PADDR + 10*(1 << 20) + 0x402 + .long PCI_PADDR + 11*(1 << 20) + 0x402 + .long PCI_PADDR + 12*(1 << 20) + 0x402 + .long PCI_PADDR + 13*(1 << 20) + 0x402 + .long PCI_PADDR + 14*(1 << 20) + 0x402 + .long PCI_PADDR + 15*(1 << 20) + 0x402 #else .rept 16 .long 0 @@ -239,23 +247,23 @@ kernel_table0: @ PID0 user table .globl user_table1_map @ User table1 data table (only the first half is needed) -@ - Abused to provide kernel stacks in upper half +@ - Abused to provide kernel stacks in the unused half of the table user_table1_map: @ Size = 4KiB (only 2KiB used) .rept 0x800/4-1 .long 0 .endr - .long user_table1_map - KERNEL_BASE + 0x10 + 3 @ ...1FF000 = 0x7FDFF000 + .long user_table1_map - KERNEL_BASE + 0x13 @ ...1FF000 = 0x7FDFF000 @ Kernel stack zone - .long kernel_table0 + 0x0000 - KERNEL_BASE + 0x10 + 3 @ ...200000 = 0x7FE00000 - .long kernel_table0 + 0x1000 - KERNEL_BASE + 0x10 + 3 @ ...201000 = 0x7FE01000 + .long kernel_table0 + 0x0000 - KERNEL_BASE + 0x13 @ ...200000 = 0x7FE00000 + .long kernel_table0 + 0x1000 - KERNEL_BASE + 0x13 @ ...201000 = 0x7FE01000 .rept (0x800/4)-(MM_KSTACK_SIZE/0x1000)-2 .long 0 .endr #if MM_KSTACK_SIZE != 0x2000 #error Kernel stack size not changed in start.S #endif - .long stack + 0x0000 - KERNEL_BASE + 0x10 + 3 @ Kernel Stack - .long stack + 0x1000 - KERNEL_BASE + 0x10 + 3 @ + .long stack + 0x0000 - KERNEL_BASE + 0x13 @ Kernel Stack + .long stack + 0x1000 - KERNEL_BASE + 0x13 @ .globl kernel_table1_map kernel_table1_map: @ Size = 4KiB @@ -266,13 +274,13 @@ kernel_table1_map: @ Size = 4KiB .rept 0xFF8/4 - (0xF00+16)/4 - 1 .long 0 .endr - .long kernel_table1_map - KERNEL_BASE + (1 << 4) + 3 + .long kernel_table1_map - KERNEL_BASE + 0x13 .long kernel_exception_map - KERNEL_BASE + 0x13 @ Hardware mappings .globl hwmap_table_0 hwmap_table_0: - .long UART0_PADDR + (1 << 4) + 3 @ UART0 + .long UART0_PADDR + 0x13 @ UART0 .rept 1024 - 1 .long 0 .endr @@ -286,7 +294,7 @@ kernel_exception_map: .rept 256-16 .long 0 .endr - .long 0x213 @ Map first page for exceptions (Kernel RO) + .long 0x212 @ Map first page for exceptions (Kernel RO, Execute) .rept 15 .long 0 .endr