| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: locore.S,v 1.31 2013/02/27 17:52:44 matt Exp $ */ | | 1 | /* $NetBSD: locore.S,v 1.32 2013/06/17 04:41:30 matt Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (C) 1994-1997 Mark Brinicombe | | 4 | * Copyright (C) 1994-1997 Mark Brinicombe |
5 | * Copyright (C) 1994 Brini | | 5 | * Copyright (C) 1994 Brini |
6 | * All rights reserved. | | 6 | * All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -31,58 +31,64 @@ | | | @@ -31,58 +31,64 @@ |
31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include "assym.h" | | 34 | #include "assym.h" |
35 | #include <sys/syscall.h> | | 35 | #include <sys/syscall.h> |
36 | #include <sys/errno.h> | | 36 | #include <sys/errno.h> |
37 | #include <machine/asm.h> | | 37 | #include <machine/asm.h> |
38 | #include <machine/cpu.h> | | 38 | #include <machine/cpu.h> |
39 | #include <machine/frame.h> | | 39 | #include <machine/frame.h> |
40 | | | 40 | |
41 | /* What size should this really be ? It is only used by init_arm() */ | | 41 | /* What size should this really be ? It is only used by init_arm() */ |
42 | #define INIT_ARM_STACK_SIZE 2048 | | 42 | #define INIT_ARM_STACK_SIZE 2048 |
43 | | | 43 | |
44 | RCSID("$NetBSD: locore.S,v 1.31 2013/02/27 17:52:44 matt Exp $") | | 44 | RCSID("$NetBSD: locore.S,v 1.32 2013/06/17 04:41:30 matt Exp $") |
45 | | | 45 | |
46 | /* | | 46 | /* |
47 | * This is for kvm_mkdb, and should be the address of the beginning | | 47 | * This is for kvm_mkdb, and should be the address of the beginning |
48 | * of the kernel text segment (not necessarily the same as kernbase). | | 48 | * of the kernel text segment (not necessarily the same as kernbase). |
49 | */ | | 49 | */ |
50 | | | 50 | |
51 | .text | | 51 | .text |
52 | .align 0 | | 52 | .align 0 |
53 | | | 53 | |
54 | ENTRY_NP(kernel_text) | | 54 | ENTRY_NP(kernel_text) |
55 | | | 55 | |
56 | ASENTRY_NP(start) | | 56 | ASENTRY_NP(start) |
57 | mrs r1, cpsr /* fetch CPSR value */ | | 57 | mrs r1, cpsr /* fetch CPSR value */ |
58 | msr spsr_sx, r1 /* set SPSR[23:8] to known value */ | | 58 | msr spsr_sx, r1 /* set SPSR[23:8] to known value */ |
59 | | | 59 | |
60 | adr r1, .Lstart | | 60 | adr r1, .Lstart |
61 | ldmia r1, {r1, r2, r8, sp} /* Set initial stack and */ | | 61 | ldmia r1, {r1, r2, r8, sp} /* Set initial stack and */ |
62 | sub r2, r2, r1 /* get zero init data and cpu_info_store */ | | | |
63 | | | 62 | |
64 | #if defined(TPIDRPRW_IS_CURCPU) || defined(TPIDRPRW_IS_CURLWP) | | 63 | #if defined(TPIDRPRW_IS_CURCPU) || defined(TPIDRPRW_IS_CURLWP) |
65 | mcr p15, 0, r8, c13, c0, 4 | | 64 | mcr p15, 0, r8, c13, c0, 4 |
66 | #endif | | 65 | #endif |
67 | #if defined(TPIDRPRW_IS_CURLWP) | | 66 | #if defined(TPIDRPRW_IS_CURLWP) |
68 | ldr r8, [r8, #L_CPU] /* r8 needs curcpu in it */ | | 67 | ldr r8, [r8, #L_CPU] /* r8 needs curcpu in it */ |
69 | #endif | | 68 | #endif |
70 | | | 69 | |
71 | mov r3, #0 | | 70 | mov r4, #0 |
| | | 71 | #ifdef _ARM_ARCH_DWORD_OK |
| | | 72 | mov r5, #0 |
| | | 73 | #endif |
72 | .L1: | | 74 | .L1: |
73 | str r3, [r1], #0x0004 /* Zero the bss */ | | 75 | #ifdef _ARM_ARCH_DWORD_OK |
74 | subs r2, r2, #4 | | 76 | strd r4, [r1], #0x0008 /* Zero the bss */ |
75 | bgt .L1 | | 77 | #else |
| | | 78 | str r4, [r1], #0x0004 /* Zero the bss */ |
| | | 79 | #endif |
| | | 80 | cmp r1, r2 |
| | | 81 | blt .L1 |
76 | | | 82 | |
77 | mrc p15, 0, r3, c0, c0, 0 /* get our cpuid and save it early */ | | 83 | mrc p15, 0, r3, c0, c0, 0 /* get our cpuid and save it early */ |
78 | str r3, [r8, #CI_ARM_CPUID] | | 84 | str r3, [r8, #CI_ARM_CPUID] |
79 | | | 85 | |
80 | mov fp, #0x00000000 /* trace back starts here */ | | 86 | mov fp, #0x00000000 /* trace back starts here */ |
81 | bl _C_LABEL(initarm) /* Off we go */ | | 87 | bl _C_LABEL(initarm) /* Off we go */ |
82 | | | 88 | |
83 | /* init arm will return the new stack pointer. */ | | 89 | /* init arm will return the new stack pointer. */ |
84 | mov sp, r0 | | 90 | mov sp, r0 |
85 | | | 91 | |
86 | mov fp, #0x00000000 /* trace back starts here */ | | 92 | mov fp, #0x00000000 /* trace back starts here */ |
87 | mov ip, sp | | 93 | mov ip, sp |
88 | stmfd sp!, {fp, ip, lr, pc} | | 94 | stmfd sp!, {fp, ip, lr, pc} |