diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-12 10:53:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-12 10:53:06 -0400 |
commit | 75c0b3b466388f2fad60fda57b6ca2c4fabbcaf7 (patch) | |
tree | 11de004529d01abded73a9392715baebab2e2a6d /arch | |
parent | 3568bd9720b4a775f28a718fcbb462ce2f386988 (diff) | |
parent | a904f5f9eb7a55baacb2f4c1423cac8a8eb78a3a (diff) |
Merge branch 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'fixes' of master.kernel.org:/home/rmk/linux-2.6-arm:
ARM: 6870/1: The mandatory barrier rmb() must be a dsb() in for device accesses
ARM: 6892/1: handle ptrace requests to change PC during interrupted system calls
ARM: 6890/1: memmap: only free allocated memmap entries when using SPARSEMEM
ARM: zImage: the page table memory must be considered before relocation
ARM: zImage: make sure not to relocate on top of the relocation code
ARM: zImage: Fix bad SP address after relocating kernel
ARM: zImage: make sure the stack is 64-bit aligned
ARM: RiscPC: acornfb: fix section mismatches
ARM: RiscPC: etherh: fix section mismatches
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boot/compressed/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/boot/compressed/head.S | 35 | ||||
-rw-r--r-- | arch/arm/boot/compressed/vmlinux.lds.in | 1 | ||||
-rw-r--r-- | arch/arm/include/asm/system.h | 2 | ||||
-rw-r--r-- | arch/arm/kernel/signal.c | 90 | ||||
-rw-r--r-- | arch/arm/mach-realview/include/mach/barriers.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/barriers.h | 2 | ||||
-rw-r--r-- | arch/arm/mm/init.c | 16 |
8 files changed, 97 insertions, 53 deletions
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile index 8ebbb511c783..0c6852d93506 100644 --- a/arch/arm/boot/compressed/Makefile +++ b/arch/arm/boot/compressed/Makefile | |||
@@ -74,7 +74,7 @@ ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT) | |||
74 | ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS) | 74 | ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS) |
75 | else | 75 | else |
76 | ZTEXTADDR := 0 | 76 | ZTEXTADDR := 0 |
77 | ZBSSADDR := ALIGN(4) | 77 | ZBSSADDR := ALIGN(8) |
78 | endif | 78 | endif |
79 | 79 | ||
80 | SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ | 80 | SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/BSS_START/$(ZBSSADDR)/ |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index adf583cd0c35..49f5b2eaaa87 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -179,15 +179,14 @@ not_angel: | |||
179 | bl cache_on | 179 | bl cache_on |
180 | 180 | ||
181 | restart: adr r0, LC0 | 181 | restart: adr r0, LC0 |
182 | ldmia r0, {r1, r2, r3, r5, r6, r9, r11, r12} | 182 | ldmia r0, {r1, r2, r3, r6, r9, r11, r12} |
183 | ldr sp, [r0, #32] | 183 | ldr sp, [r0, #28] |
184 | 184 | ||
185 | /* | 185 | /* |
186 | * We might be running at a different address. We need | 186 | * We might be running at a different address. We need |
187 | * to fix up various pointers. | 187 | * to fix up various pointers. |
188 | */ | 188 | */ |
189 | sub r0, r0, r1 @ calculate the delta offset | 189 | sub r0, r0, r1 @ calculate the delta offset |
190 | add r5, r5, r0 @ _start | ||
191 | add r6, r6, r0 @ _edata | 190 | add r6, r6, r0 @ _edata |
192 | 191 | ||
193 | #ifndef CONFIG_ZBOOT_ROM | 192 | #ifndef CONFIG_ZBOOT_ROM |
@@ -206,31 +205,40 @@ restart: adr r0, LC0 | |||
206 | /* | 205 | /* |
207 | * Check to see if we will overwrite ourselves. | 206 | * Check to see if we will overwrite ourselves. |
208 | * r4 = final kernel address | 207 | * r4 = final kernel address |
209 | * r5 = start of this image | ||
210 | * r9 = size of decompressed image | 208 | * r9 = size of decompressed image |
211 | * r10 = end of this image, including bss/stack/malloc space if non XIP | 209 | * r10 = end of this image, including bss/stack/malloc space if non XIP |
212 | * We basically want: | 210 | * We basically want: |
213 | * r4 >= r10 -> OK | 211 | * r4 - 16k page directory >= r10 -> OK |
214 | * r4 + image length <= r5 -> OK | 212 | * r4 + image length <= current position (pc) -> OK |
215 | */ | 213 | */ |
214 | add r10, r10, #16384 | ||
216 | cmp r4, r10 | 215 | cmp r4, r10 |
217 | bhs wont_overwrite | 216 | bhs wont_overwrite |
218 | add r10, r4, r9 | 217 | add r10, r4, r9 |
219 | cmp r10, r5 | 218 | ARM( cmp r10, pc ) |
219 | THUMB( mov lr, pc ) | ||
220 | THUMB( cmp r10, lr ) | ||
220 | bls wont_overwrite | 221 | bls wont_overwrite |
221 | 222 | ||
222 | /* | 223 | /* |
223 | * Relocate ourselves past the end of the decompressed kernel. | 224 | * Relocate ourselves past the end of the decompressed kernel. |
224 | * r5 = start of this image | ||
225 | * r6 = _edata | 225 | * r6 = _edata |
226 | * r10 = end of the decompressed kernel | 226 | * r10 = end of the decompressed kernel |
227 | * Because we always copy ahead, we need to do it from the end and go | 227 | * Because we always copy ahead, we need to do it from the end and go |
228 | * backward in case the source and destination overlap. | 228 | * backward in case the source and destination overlap. |
229 | */ | 229 | */ |
230 | /* Round up to next 256-byte boundary. */ | 230 | /* |
231 | add r10, r10, #256 | 231 | * Bump to the next 256-byte boundary with the size of |
232 | * the relocation code added. This avoids overwriting | ||
233 | * ourself when the offset is small. | ||
234 | */ | ||
235 | add r10, r10, #((reloc_code_end - restart + 256) & ~255) | ||
232 | bic r10, r10, #255 | 236 | bic r10, r10, #255 |
233 | 237 | ||
238 | /* Get start of code we want to copy and align it down. */ | ||
239 | adr r5, restart | ||
240 | bic r5, r5, #31 | ||
241 | |||
234 | sub r9, r6, r5 @ size to copy | 242 | sub r9, r6, r5 @ size to copy |
235 | add r9, r9, #31 @ rounded up to a multiple | 243 | add r9, r9, #31 @ rounded up to a multiple |
236 | bic r9, r9, #31 @ ... of 32 bytes | 244 | bic r9, r9, #31 @ ... of 32 bytes |
@@ -245,6 +253,11 @@ restart: adr r0, LC0 | |||
245 | /* Preserve offset to relocated code. */ | 253 | /* Preserve offset to relocated code. */ |
246 | sub r6, r9, r6 | 254 | sub r6, r9, r6 |
247 | 255 | ||
256 | #ifndef CONFIG_ZBOOT_ROM | ||
257 | /* cache_clean_flush may use the stack, so relocate it */ | ||
258 | add sp, sp, r6 | ||
259 | #endif | ||
260 | |||
248 | bl cache_clean_flush | 261 | bl cache_clean_flush |
249 | 262 | ||
250 | adr r0, BSYM(restart) | 263 | adr r0, BSYM(restart) |
@@ -333,7 +346,6 @@ not_relocated: mov r0, #0 | |||
333 | LC0: .word LC0 @ r1 | 346 | LC0: .word LC0 @ r1 |
334 | .word __bss_start @ r2 | 347 | .word __bss_start @ r2 |
335 | .word _end @ r3 | 348 | .word _end @ r3 |
336 | .word _start @ r5 | ||
337 | .word _edata @ r6 | 349 | .word _edata @ r6 |
338 | .word _image_size @ r9 | 350 | .word _image_size @ r9 |
339 | .word _got_start @ r11 | 351 | .word _got_start @ r11 |
@@ -1062,6 +1074,7 @@ memdump: mov r12, r0 | |||
1062 | #endif | 1074 | #endif |
1063 | 1075 | ||
1064 | .ltorg | 1076 | .ltorg |
1077 | reloc_code_end: | ||
1065 | 1078 | ||
1066 | .align | 1079 | .align |
1067 | .section ".stack", "aw", %nobits | 1080 | .section ".stack", "aw", %nobits |
diff --git a/arch/arm/boot/compressed/vmlinux.lds.in b/arch/arm/boot/compressed/vmlinux.lds.in index 5309909d7282..ea80abe78844 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.in +++ b/arch/arm/boot/compressed/vmlinux.lds.in | |||
@@ -54,6 +54,7 @@ SECTIONS | |||
54 | .bss : { *(.bss) } | 54 | .bss : { *(.bss) } |
55 | _end = .; | 55 | _end = .; |
56 | 56 | ||
57 | . = ALIGN(8); /* the stack must be 64-bit aligned */ | ||
57 | .stack : { *(.stack) } | 58 | .stack : { *(.stack) } |
58 | 59 | ||
59 | .stab 0 : { *(.stab) } | 60 | .stab 0 : { *(.stab) } |
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 885be097769d..832888d0c20c 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h | |||
@@ -159,7 +159,7 @@ extern unsigned int user_debug; | |||
159 | #include <mach/barriers.h> | 159 | #include <mach/barriers.h> |
160 | #elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP) | 160 | #elif defined(CONFIG_ARM_DMA_MEM_BUFFERABLE) || defined(CONFIG_SMP) |
161 | #define mb() do { dsb(); outer_sync(); } while (0) | 161 | #define mb() do { dsb(); outer_sync(); } while (0) |
162 | #define rmb() dmb() | 162 | #define rmb() dsb() |
163 | #define wmb() mb() | 163 | #define wmb() mb() |
164 | #else | 164 | #else |
165 | #include <asm/memory.h> | 165 | #include <asm/memory.h> |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index cb8398317644..0340224cf73c 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -597,19 +597,13 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info, | |||
597 | return err; | 597 | return err; |
598 | } | 598 | } |
599 | 599 | ||
600 | static inline void setup_syscall_restart(struct pt_regs *regs) | ||
601 | { | ||
602 | regs->ARM_r0 = regs->ARM_ORIG_r0; | ||
603 | regs->ARM_pc -= thumb_mode(regs) ? 2 : 4; | ||
604 | } | ||
605 | |||
606 | /* | 600 | /* |
607 | * OK, we're invoking a handler | 601 | * OK, we're invoking a handler |
608 | */ | 602 | */ |
609 | static int | 603 | static int |
610 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 604 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
611 | siginfo_t *info, sigset_t *oldset, | 605 | siginfo_t *info, sigset_t *oldset, |
612 | struct pt_regs * regs, int syscall) | 606 | struct pt_regs * regs) |
613 | { | 607 | { |
614 | struct thread_info *thread = current_thread_info(); | 608 | struct thread_info *thread = current_thread_info(); |
615 | struct task_struct *tsk = current; | 609 | struct task_struct *tsk = current; |
@@ -617,26 +611,6 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
617 | int ret; | 611 | int ret; |
618 | 612 | ||
619 | /* | 613 | /* |
620 | * If we were from a system call, check for system call restarting... | ||
621 | */ | ||
622 | if (syscall) { | ||
623 | switch (regs->ARM_r0) { | ||
624 | case -ERESTART_RESTARTBLOCK: | ||
625 | case -ERESTARTNOHAND: | ||
626 | regs->ARM_r0 = -EINTR; | ||
627 | break; | ||
628 | case -ERESTARTSYS: | ||
629 | if (!(ka->sa.sa_flags & SA_RESTART)) { | ||
630 | regs->ARM_r0 = -EINTR; | ||
631 | break; | ||
632 | } | ||
633 | /* fallthrough */ | ||
634 | case -ERESTARTNOINTR: | ||
635 | setup_syscall_restart(regs); | ||
636 | } | ||
637 | } | ||
638 | |||
639 | /* | ||
640 | * translate the signal | 614 | * translate the signal |
641 | */ | 615 | */ |
642 | if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap) | 616 | if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap) |
@@ -685,6 +659,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
685 | */ | 659 | */ |
686 | static void do_signal(struct pt_regs *regs, int syscall) | 660 | static void do_signal(struct pt_regs *regs, int syscall) |
687 | { | 661 | { |
662 | unsigned int retval = 0, continue_addr = 0, restart_addr = 0; | ||
688 | struct k_sigaction ka; | 663 | struct k_sigaction ka; |
689 | siginfo_t info; | 664 | siginfo_t info; |
690 | int signr; | 665 | int signr; |
@@ -698,18 +673,61 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
698 | if (!user_mode(regs)) | 673 | if (!user_mode(regs)) |
699 | return; | 674 | return; |
700 | 675 | ||
676 | /* | ||
677 | * If we were from a system call, check for system call restarting... | ||
678 | */ | ||
679 | if (syscall) { | ||
680 | continue_addr = regs->ARM_pc; | ||
681 | restart_addr = continue_addr - (thumb_mode(regs) ? 2 : 4); | ||
682 | retval = regs->ARM_r0; | ||
683 | |||
684 | /* | ||
685 | * Prepare for system call restart. We do this here so that a | ||
686 | * debugger will see the already changed PSW. | ||
687 | */ | ||
688 | switch (retval) { | ||
689 | case -ERESTARTNOHAND: | ||
690 | case -ERESTARTSYS: | ||
691 | case -ERESTARTNOINTR: | ||
692 | regs->ARM_r0 = regs->ARM_ORIG_r0; | ||
693 | regs->ARM_pc = restart_addr; | ||
694 | break; | ||
695 | case -ERESTART_RESTARTBLOCK: | ||
696 | regs->ARM_r0 = -EINTR; | ||
697 | break; | ||
698 | } | ||
699 | } | ||
700 | |||
701 | if (try_to_freeze()) | 701 | if (try_to_freeze()) |
702 | goto no_signal; | 702 | goto no_signal; |
703 | 703 | ||
704 | /* | ||
705 | * Get the signal to deliver. When running under ptrace, at this | ||
706 | * point the debugger may change all our registers ... | ||
707 | */ | ||
704 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 708 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
705 | if (signr > 0) { | 709 | if (signr > 0) { |
706 | sigset_t *oldset; | 710 | sigset_t *oldset; |
707 | 711 | ||
712 | /* | ||
713 | * Depending on the signal settings we may need to revert the | ||
714 | * decision to restart the system call. But skip this if a | ||
715 | * debugger has chosen to restart at a different PC. | ||
716 | */ | ||
717 | if (regs->ARM_pc == restart_addr) { | ||
718 | if (retval == -ERESTARTNOHAND | ||
719 | || (retval == -ERESTARTSYS | ||
720 | && !(ka.sa.sa_flags & SA_RESTART))) { | ||
721 | regs->ARM_r0 = -EINTR; | ||
722 | regs->ARM_pc = continue_addr; | ||
723 | } | ||
724 | } | ||
725 | |||
708 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 726 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
709 | oldset = ¤t->saved_sigmask; | 727 | oldset = ¤t->saved_sigmask; |
710 | else | 728 | else |
711 | oldset = ¤t->blocked; | 729 | oldset = ¤t->blocked; |
712 | if (handle_signal(signr, &ka, &info, oldset, regs, syscall) == 0) { | 730 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { |
713 | /* | 731 | /* |
714 | * A signal was successfully delivered; the saved | 732 | * A signal was successfully delivered; the saved |
715 | * sigmask will have been stored in the signal frame, | 733 | * sigmask will have been stored in the signal frame, |
@@ -723,11 +741,14 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
723 | } | 741 | } |
724 | 742 | ||
725 | no_signal: | 743 | no_signal: |
726 | /* | ||
727 | * No signal to deliver to the process - restart the syscall. | ||
728 | */ | ||
729 | if (syscall) { | 744 | if (syscall) { |
730 | if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) { | 745 | /* |
746 | * Handle restarting a different system call. As above, | ||
747 | * if a debugger has chosen to restart at a different PC, | ||
748 | * ignore the restart. | ||
749 | */ | ||
750 | if (retval == -ERESTART_RESTARTBLOCK | ||
751 | && regs->ARM_pc == continue_addr) { | ||
731 | if (thumb_mode(regs)) { | 752 | if (thumb_mode(regs)) { |
732 | regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE; | 753 | regs->ARM_r7 = __NR_restart_syscall - __NR_SYSCALL_BASE; |
733 | regs->ARM_pc -= 2; | 754 | regs->ARM_pc -= 2; |
@@ -750,11 +771,6 @@ static void do_signal(struct pt_regs *regs, int syscall) | |||
750 | #endif | 771 | #endif |
751 | } | 772 | } |
752 | } | 773 | } |
753 | if (regs->ARM_r0 == -ERESTARTNOHAND || | ||
754 | regs->ARM_r0 == -ERESTARTSYS || | ||
755 | regs->ARM_r0 == -ERESTARTNOINTR) { | ||
756 | setup_syscall_restart(regs); | ||
757 | } | ||
758 | 774 | ||
759 | /* If there's no signal to deliver, we just put the saved sigmask | 775 | /* If there's no signal to deliver, we just put the saved sigmask |
760 | * back. | 776 | * back. |
diff --git a/arch/arm/mach-realview/include/mach/barriers.h b/arch/arm/mach-realview/include/mach/barriers.h index 0c5d749d7b5f..9a732195aa1c 100644 --- a/arch/arm/mach-realview/include/mach/barriers.h +++ b/arch/arm/mach-realview/include/mach/barriers.h | |||
@@ -4,5 +4,5 @@ | |||
4 | * operation to deadlock the system. | 4 | * operation to deadlock the system. |
5 | */ | 5 | */ |
6 | #define mb() dsb() | 6 | #define mb() dsb() |
7 | #define rmb() dmb() | 7 | #define rmb() dsb() |
8 | #define wmb() mb() | 8 | #define wmb() mb() |
diff --git a/arch/arm/mach-tegra/include/mach/barriers.h b/arch/arm/mach-tegra/include/mach/barriers.h index cc115174899b..425b42e91ef6 100644 --- a/arch/arm/mach-tegra/include/mach/barriers.h +++ b/arch/arm/mach-tegra/include/mach/barriers.h | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include <asm/outercache.h> | 24 | #include <asm/outercache.h> |
25 | 25 | ||
26 | #define rmb() dmb() | 26 | #define rmb() dsb() |
27 | #define wmb() do { dsb(); outer_sync(); } while (0) | 27 | #define wmb() do { dsb(); outer_sync(); } while (0) |
28 | #define mb() wmb() | 28 | #define mb() wmb() |
29 | 29 | ||
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index e5f6fc428348..e591513bb53e 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -392,7 +392,7 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn) | |||
392 | * Convert start_pfn/end_pfn to a struct page pointer. | 392 | * Convert start_pfn/end_pfn to a struct page pointer. |
393 | */ | 393 | */ |
394 | start_pg = pfn_to_page(start_pfn - 1) + 1; | 394 | start_pg = pfn_to_page(start_pfn - 1) + 1; |
395 | end_pg = pfn_to_page(end_pfn); | 395 | end_pg = pfn_to_page(end_pfn - 1) + 1; |
396 | 396 | ||
397 | /* | 397 | /* |
398 | * Convert to physical addresses, and | 398 | * Convert to physical addresses, and |
@@ -426,6 +426,14 @@ static void __init free_unused_memmap(struct meminfo *mi) | |||
426 | 426 | ||
427 | bank_start = bank_pfn_start(bank); | 427 | bank_start = bank_pfn_start(bank); |
428 | 428 | ||
429 | #ifdef CONFIG_SPARSEMEM | ||
430 | /* | ||
431 | * Take care not to free memmap entries that don't exist | ||
432 | * due to SPARSEMEM sections which aren't present. | ||
433 | */ | ||
434 | bank_start = min(bank_start, | ||
435 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); | ||
436 | #endif | ||
429 | /* | 437 | /* |
430 | * If we had a previous bank, and there is a space | 438 | * If we had a previous bank, and there is a space |
431 | * between the current bank and the previous, free it. | 439 | * between the current bank and the previous, free it. |
@@ -440,6 +448,12 @@ static void __init free_unused_memmap(struct meminfo *mi) | |||
440 | */ | 448 | */ |
441 | prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES); | 449 | prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES); |
442 | } | 450 | } |
451 | |||
452 | #ifdef CONFIG_SPARSEMEM | ||
453 | if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION)) | ||
454 | free_memmap(prev_bank_end, | ||
455 | ALIGN(prev_bank_end, PAGES_PER_SECTION)); | ||
456 | #endif | ||
443 | } | 457 | } |
444 | 458 | ||
445 | static void __init free_highpages(void) | 459 | static void __init free_highpages(void) |