diff options
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/kernel/asm-offsets.c | 1 | ||||
-rw-r--r-- | arch/arm/kernel/entry-armv.S | 3 | ||||
-rw-r--r-- | arch/arm/kernel/head.S | 57 | ||||
-rw-r--r-- | arch/arm/kernel/vmlinux.lds.S | 11 |
5 files changed, 30 insertions, 44 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index 3e1b0327e4d7..c11169b5ed9a 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the linux kernel. | 2 | # Makefile for the linux kernel. |
3 | # | 3 | # |
4 | 4 | ||
5 | AFLAGS_head.o := -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR) | 5 | AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR) |
6 | 6 | ||
7 | # Object file lists. | 7 | # Object file lists. |
8 | 8 | ||
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index c1ff4d1f1bfd..04d3082a7b94 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
@@ -94,7 +94,6 @@ int main(void) | |||
94 | DEFINE(VM_EXEC, VM_EXEC); | 94 | DEFINE(VM_EXEC, VM_EXEC); |
95 | BLANK(); | 95 | BLANK(); |
96 | DEFINE(PAGE_SZ, PAGE_SIZE); | 96 | DEFINE(PAGE_SZ, PAGE_SIZE); |
97 | DEFINE(VIRT_OFFSET, PAGE_OFFSET); | ||
98 | BLANK(); | 97 | BLANK(); |
99 | DEFINE(SYS_ERROR0, 0x9f0000); | 98 | DEFINE(SYS_ERROR0, 0x9f0000); |
100 | BLANK(); | 99 | BLANK(); |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index 93b5e8e5292e..be439cab92c6 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -15,6 +15,7 @@ | |||
15 | */ | 15 | */ |
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | 17 | ||
18 | #include <asm/memory.h> | ||
18 | #include <asm/glue.h> | 19 | #include <asm/glue.h> |
19 | #include <asm/vfpmacros.h> | 20 | #include <asm/vfpmacros.h> |
20 | #include <asm/hardware.h> /* should be moved into entry-macro.S */ | 21 | #include <asm/hardware.h> /* should be moved into entry-macro.S */ |
@@ -310,7 +311,7 @@ __pabt_svc: | |||
310 | 311 | ||
311 | #if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) | 312 | #if __LINUX_ARM_ARCH__ < 6 && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG) |
312 | @ make sure our user space atomic helper is aborted | 313 | @ make sure our user space atomic helper is aborted |
313 | cmp r2, #VIRT_OFFSET | 314 | cmp r2, #TASK_SIZE |
314 | bichs r3, r3, #PSR_Z_BIT | 315 | bichs r3, r3, #PSR_Z_BIT |
315 | #endif | 316 | #endif |
316 | 317 | ||
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 539626351348..8d8748407cbe 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/procinfo.h> | 21 | #include <asm/procinfo.h> |
22 | #include <asm/ptrace.h> | 22 | #include <asm/ptrace.h> |
23 | #include <asm/asm-offsets.h> | 23 | #include <asm/asm-offsets.h> |
24 | #include <asm/memory.h> | ||
24 | #include <asm/thread_info.h> | 25 | #include <asm/thread_info.h> |
25 | #include <asm/system.h> | 26 | #include <asm/system.h> |
26 | 27 | ||
@@ -33,52 +34,28 @@ | |||
33 | #define MACHINFO_PGOFFIO 12 | 34 | #define MACHINFO_PGOFFIO 12 |
34 | #define MACHINFO_NAME 16 | 35 | #define MACHINFO_NAME 16 |
35 | 36 | ||
36 | #ifndef CONFIG_XIP_KERNEL | ||
37 | /* | 37 | /* |
38 | * We place the page tables 16K below TEXTADDR. Therefore, we must make sure | 38 | * swapper_pg_dir is the virtual address of the initial page table. |
39 | * that TEXTADDR is correctly set. Currently, we expect the least significant | 39 | * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must |
40 | * 16 bits to be 0x8000, but we could probably relax this restriction to | 40 | * make sure that KERNEL_RAM_ADDR is correctly set. Currently, we expect |
41 | * TEXTADDR >= PAGE_OFFSET + 0x4000 | 41 | * the least significant 16 bits to be 0x8000, but we could probably |
42 | * | 42 | * relax this restriction to KERNEL_RAM_ADDR >= PAGE_OFFSET + 0x4000. |
43 | * Note that swapper_pg_dir is the virtual address of the page tables, and | ||
44 | * pgtbl gives us a position-independent reference to these tables. We can | ||
45 | * do this because stext == TEXTADDR | ||
46 | */ | 43 | */ |
47 | #if (TEXTADDR & 0xffff) != 0x8000 | 44 | #if (KERNEL_RAM_ADDR & 0xffff) != 0x8000 |
48 | #error TEXTADDR must start at 0xXXXX8000 | 45 | #error KERNEL_RAM_ADDR must start at 0xXXXX8000 |
49 | #endif | 46 | #endif |
50 | 47 | ||
51 | .globl swapper_pg_dir | 48 | .globl swapper_pg_dir |
52 | .equ swapper_pg_dir, TEXTADDR - 0x4000 | 49 | .equ swapper_pg_dir, KERNEL_RAM_ADDR - 0x4000 |
53 | 50 | ||
54 | .macro pgtbl, rd, phys | 51 | .macro pgtbl, rd |
55 | adr \rd, stext | 52 | ldr \rd, =(__virt_to_phys(KERNEL_RAM_ADDR - 0x4000)) |
56 | sub \rd, \rd, #0x4000 | ||
57 | .endm | 53 | .endm |
58 | #else | ||
59 | /* | ||
60 | * XIP Kernel: | ||
61 | * | ||
62 | * We place the page tables 16K below DATAADDR. Therefore, we must make sure | ||
63 | * that DATAADDR is correctly set. Currently, we expect the least significant | ||
64 | * 16 bits to be 0x8000, but we could probably relax this restriction to | ||
65 | * DATAADDR >= PAGE_OFFSET + 0x4000 | ||
66 | * | ||
67 | * Note that pgtbl is meant to return the physical address of swapper_pg_dir. | ||
68 | * We can't make it relative to the kernel position in this case since | ||
69 | * the kernel can physically be anywhere. | ||
70 | */ | ||
71 | #if (DATAADDR & 0xffff) != 0x8000 | ||
72 | #error DATAADDR must start at 0xXXXX8000 | ||
73 | #endif | ||
74 | |||
75 | .globl swapper_pg_dir | ||
76 | .equ swapper_pg_dir, DATAADDR - 0x4000 | ||
77 | 54 | ||
78 | .macro pgtbl, rd, phys | 55 | #ifdef CONFIG_XIP_KERNEL |
79 | ldr \rd, =((DATAADDR - 0x4000) - VIRT_OFFSET) | 56 | #define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) |
80 | add \rd, \rd, \phys | 57 | #else |
81 | .endm | 58 | #define TEXTADDR KERNEL_RAM_ADDR |
82 | #endif | 59 | #endif |
83 | 60 | ||
84 | /* | 61 | /* |
@@ -279,7 +256,7 @@ __turn_mmu_on: | |||
279 | .type __create_page_tables, %function | 256 | .type __create_page_tables, %function |
280 | __create_page_tables: | 257 | __create_page_tables: |
281 | ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram | 258 | ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram |
282 | pgtbl r4, r5 @ page table address | 259 | pgtbl r4 @ page table address |
283 | 260 | ||
284 | /* | 261 | /* |
285 | * Clear the 16K level 1 swapper page table | 262 | * Clear the 16K level 1 swapper page table |
@@ -324,7 +301,7 @@ __create_page_tables: | |||
324 | /* | 301 | /* |
325 | * Then map first 1MB of ram in case it contains our boot params. | 302 | * Then map first 1MB of ram in case it contains our boot params. |
326 | */ | 303 | */ |
327 | add r0, r4, #VIRT_OFFSET >> 18 | 304 | add r0, r4, #PAGE_OFFSET >> 18 |
328 | orr r6, r5, r7 | 305 | orr r6, r5, r7 |
329 | str r6, [r0] | 306 | str r6, [r0] |
330 | 307 | ||
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 0d5db5279c5c..80c8e4c8cefa 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -6,14 +6,23 @@ | |||
6 | #include <asm-generic/vmlinux.lds.h> | 6 | #include <asm-generic/vmlinux.lds.h> |
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
8 | #include <asm/thread_info.h> | 8 | #include <asm/thread_info.h> |
9 | #include <asm/memory.h> | ||
9 | 10 | ||
10 | OUTPUT_ARCH(arm) | 11 | OUTPUT_ARCH(arm) |
11 | ENTRY(stext) | 12 | ENTRY(stext) |
13 | |||
12 | #ifndef __ARMEB__ | 14 | #ifndef __ARMEB__ |
13 | jiffies = jiffies_64; | 15 | jiffies = jiffies_64; |
14 | #else | 16 | #else |
15 | jiffies = jiffies_64 + 4; | 17 | jiffies = jiffies_64 + 4; |
16 | #endif | 18 | #endif |
19 | |||
20 | #ifdef CONFIG_XIP_KERNEL | ||
21 | #define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) | ||
22 | #else | ||
23 | #define TEXTADDR KERNEL_RAM_ADDR | ||
24 | #endif | ||
25 | |||
17 | SECTIONS | 26 | SECTIONS |
18 | { | 27 | { |
19 | . = TEXTADDR; | 28 | . = TEXTADDR; |
@@ -95,7 +104,7 @@ SECTIONS | |||
95 | 104 | ||
96 | #ifdef CONFIG_XIP_KERNEL | 105 | #ifdef CONFIG_XIP_KERNEL |
97 | __data_loc = ALIGN(4); /* location in binary */ | 106 | __data_loc = ALIGN(4); /* location in binary */ |
98 | . = DATAADDR; | 107 | . = KERNEL_RAM_ADDR; |
99 | #else | 108 | #else |
100 | . = ALIGN(THREAD_SIZE); | 109 | . = ALIGN(THREAD_SIZE); |
101 | __data_loc = .; | 110 | __data_loc = .; |