diff options
Diffstat (limited to 'arch/sparc64')
-rw-r--r-- | arch/sparc64/defconfig | 40 | ||||
-rw-r--r-- | arch/sparc64/kernel/etrap.S | 7 | ||||
-rw-r--r-- | arch/sparc64/kernel/init_task.c | 1 | ||||
-rw-r--r-- | arch/sparc64/kernel/ptrace.c | 16 | ||||
-rw-r--r-- | arch/sparc64/kernel/rtrap.S | 7 | ||||
-rw-r--r-- | arch/sparc64/kernel/signal.c | 81 | ||||
-rw-r--r-- | arch/sparc64/kernel/signal32.c | 39 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc.c | 36 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc32.c | 33 | ||||
-rw-r--r-- | arch/sparc64/mm/init.c | 18 |
10 files changed, 124 insertions, 154 deletions
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig index aff93c9d13f4..76eb832527f2 100644 --- a/arch/sparc64/defconfig +++ b/arch/sparc64/defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.25 | 3 | # Linux kernel version: 2.6.26-rc2 |
4 | # Sat Apr 26 03:11:06 2008 | 4 | # Fri May 16 13:36:07 2008 |
5 | # | 5 | # |
6 | CONFIG_SPARC=y | 6 | CONFIG_SPARC=y |
7 | CONFIG_SPARC64=y | 7 | CONFIG_SPARC64=y |
@@ -74,6 +74,7 @@ CONFIG_SYSCTL=y | |||
74 | # CONFIG_EMBEDDED is not set | 74 | # CONFIG_EMBEDDED is not set |
75 | CONFIG_UID16=y | 75 | CONFIG_UID16=y |
76 | CONFIG_SYSCTL_SYSCALL=y | 76 | CONFIG_SYSCTL_SYSCALL=y |
77 | CONFIG_SYSCTL_SYSCALL_CHECK=y | ||
77 | CONFIG_KALLSYMS=y | 78 | CONFIG_KALLSYMS=y |
78 | # CONFIG_KALLSYMS_ALL is not set | 79 | # CONFIG_KALLSYMS_ALL is not set |
79 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 80 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
@@ -103,12 +104,14 @@ CONFIG_KPROBES=y | |||
103 | CONFIG_KRETPROBES=y | 104 | CONFIG_KRETPROBES=y |
104 | CONFIG_HAVE_KPROBES=y | 105 | CONFIG_HAVE_KPROBES=y |
105 | CONFIG_HAVE_KRETPROBES=y | 106 | CONFIG_HAVE_KRETPROBES=y |
107 | # CONFIG_HAVE_DMA_ATTRS is not set | ||
106 | CONFIG_PROC_PAGE_MONITOR=y | 108 | CONFIG_PROC_PAGE_MONITOR=y |
107 | CONFIG_SLABINFO=y | 109 | CONFIG_SLABINFO=y |
108 | CONFIG_RT_MUTEXES=y | 110 | CONFIG_RT_MUTEXES=y |
109 | # CONFIG_TINY_SHMEM is not set | 111 | # CONFIG_TINY_SHMEM is not set |
110 | CONFIG_BASE_SMALL=0 | 112 | CONFIG_BASE_SMALL=0 |
111 | CONFIG_MODULES=y | 113 | CONFIG_MODULES=y |
114 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
112 | CONFIG_MODULE_UNLOAD=y | 115 | CONFIG_MODULE_UNLOAD=y |
113 | CONFIG_MODULE_FORCE_UNLOAD=y | 116 | CONFIG_MODULE_FORCE_UNLOAD=y |
114 | CONFIG_MODVERSIONS=y | 117 | CONFIG_MODVERSIONS=y |
@@ -170,6 +173,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y | |||
170 | CONFIG_SPARSEMEM_EXTREME=y | 173 | CONFIG_SPARSEMEM_EXTREME=y |
171 | CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y | 174 | CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y |
172 | CONFIG_SPARSEMEM_VMEMMAP=y | 175 | CONFIG_SPARSEMEM_VMEMMAP=y |
176 | CONFIG_PAGEFLAGS_EXTENDED=y | ||
173 | CONFIG_SPLIT_PTLOCK_CPUS=4 | 177 | CONFIG_SPLIT_PTLOCK_CPUS=4 |
174 | CONFIG_MIGRATION=y | 178 | CONFIG_MIGRATION=y |
175 | CONFIG_RESOURCES_64BIT=y | 179 | CONFIG_RESOURCES_64BIT=y |
@@ -402,7 +406,6 @@ CONFIG_IDEPCI_PCIBUS_ORDER=y | |||
402 | CONFIG_BLK_DEV_IDEDMA_PCI=y | 406 | CONFIG_BLK_DEV_IDEDMA_PCI=y |
403 | # CONFIG_BLK_DEV_AEC62XX is not set | 407 | # CONFIG_BLK_DEV_AEC62XX is not set |
404 | CONFIG_BLK_DEV_ALI15X3=y | 408 | CONFIG_BLK_DEV_ALI15X3=y |
405 | # CONFIG_WDC_ALI15X3 is not set | ||
406 | # CONFIG_BLK_DEV_AMD74XX is not set | 409 | # CONFIG_BLK_DEV_AMD74XX is not set |
407 | # CONFIG_BLK_DEV_CMD64X is not set | 410 | # CONFIG_BLK_DEV_CMD64X is not set |
408 | # CONFIG_BLK_DEV_TRIFLEX is not set | 411 | # CONFIG_BLK_DEV_TRIFLEX is not set |
@@ -609,6 +612,7 @@ CONFIG_NIU=m | |||
609 | # CONFIG_MLX4_CORE is not set | 612 | # CONFIG_MLX4_CORE is not set |
610 | # CONFIG_TEHUTI is not set | 613 | # CONFIG_TEHUTI is not set |
611 | # CONFIG_BNX2X is not set | 614 | # CONFIG_BNX2X is not set |
615 | # CONFIG_SFC is not set | ||
612 | # CONFIG_TR is not set | 616 | # CONFIG_TR is not set |
613 | 617 | ||
614 | # | 618 | # |
@@ -717,6 +721,7 @@ CONFIG_VT=y | |||
717 | CONFIG_VT_CONSOLE=y | 721 | CONFIG_VT_CONSOLE=y |
718 | CONFIG_HW_CONSOLE=y | 722 | CONFIG_HW_CONSOLE=y |
719 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | 723 | # CONFIG_VT_HW_CONSOLE_BINDING is not set |
724 | # CONFIG_DEVKMEM is not set | ||
720 | # CONFIG_SERIAL_NONSTANDARD is not set | 725 | # CONFIG_SERIAL_NONSTANDARD is not set |
721 | # CONFIG_NOZOMI is not set | 726 | # CONFIG_NOZOMI is not set |
722 | 727 | ||
@@ -793,12 +798,7 @@ CONFIG_I2C_ALGOBIT=y | |||
793 | # CONFIG_I2C_DEBUG_ALGO is not set | 798 | # CONFIG_I2C_DEBUG_ALGO is not set |
794 | # CONFIG_I2C_DEBUG_BUS is not set | 799 | # CONFIG_I2C_DEBUG_BUS is not set |
795 | # CONFIG_I2C_DEBUG_CHIP is not set | 800 | # CONFIG_I2C_DEBUG_CHIP is not set |
796 | |||
797 | # | ||
798 | # SPI support | ||
799 | # | ||
800 | # CONFIG_SPI is not set | 801 | # CONFIG_SPI is not set |
801 | # CONFIG_SPI_MASTER is not set | ||
802 | # CONFIG_W1 is not set | 802 | # CONFIG_W1 is not set |
803 | # CONFIG_POWER_SUPPLY is not set | 803 | # CONFIG_POWER_SUPPLY is not set |
804 | CONFIG_HWMON=y | 804 | CONFIG_HWMON=y |
@@ -873,8 +873,17 @@ CONFIG_SSB_POSSIBLE=y | |||
873 | # | 873 | # |
874 | # Multimedia devices | 874 | # Multimedia devices |
875 | # | 875 | # |
876 | |||
877 | # | ||
878 | # Multimedia core support | ||
879 | # | ||
876 | # CONFIG_VIDEO_DEV is not set | 880 | # CONFIG_VIDEO_DEV is not set |
877 | # CONFIG_DVB_CORE is not set | 881 | # CONFIG_DVB_CORE is not set |
882 | # CONFIG_VIDEO_MEDIA is not set | ||
883 | |||
884 | # | ||
885 | # Multimedia drivers | ||
886 | # | ||
878 | # CONFIG_DAB is not set | 887 | # CONFIG_DAB is not set |
879 | 888 | ||
880 | # | 889 | # |
@@ -893,8 +902,8 @@ CONFIG_FB_CFB_IMAGEBLIT=y | |||
893 | # CONFIG_FB_SYS_FILLRECT is not set | 902 | # CONFIG_FB_SYS_FILLRECT is not set |
894 | # CONFIG_FB_SYS_COPYAREA is not set | 903 | # CONFIG_FB_SYS_COPYAREA is not set |
895 | # CONFIG_FB_SYS_IMAGEBLIT is not set | 904 | # CONFIG_FB_SYS_IMAGEBLIT is not set |
905 | # CONFIG_FB_FOREIGN_ENDIAN is not set | ||
896 | # CONFIG_FB_SYS_FOPS is not set | 906 | # CONFIG_FB_SYS_FOPS is not set |
897 | CONFIG_FB_DEFERRED_IO=y | ||
898 | # CONFIG_FB_SVGALIB is not set | 907 | # CONFIG_FB_SVGALIB is not set |
899 | # CONFIG_FB_MACMODES is not set | 908 | # CONFIG_FB_MACMODES is not set |
900 | # CONFIG_FB_BACKLIGHT is not set | 909 | # CONFIG_FB_BACKLIGHT is not set |
@@ -1100,6 +1109,10 @@ CONFIG_SND_SUN_CS4231=m | |||
1100 | # | 1109 | # |
1101 | 1110 | ||
1102 | # | 1111 | # |
1112 | # SoC Audio for the Texas Instruments OMAP | ||
1113 | # | ||
1114 | |||
1115 | # | ||
1103 | # Open Sound System | 1116 | # Open Sound System |
1104 | # | 1117 | # |
1105 | # CONFIG_SOUND_PRIME is not set | 1118 | # CONFIG_SOUND_PRIME is not set |
@@ -1135,10 +1148,12 @@ CONFIG_USB_DEVICEFS=y | |||
1135 | # | 1148 | # |
1136 | # USB Host Controller Drivers | 1149 | # USB Host Controller Drivers |
1137 | # | 1150 | # |
1151 | # CONFIG_USB_C67X00_HCD is not set | ||
1138 | CONFIG_USB_EHCI_HCD=m | 1152 | CONFIG_USB_EHCI_HCD=m |
1139 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set | 1153 | # CONFIG_USB_EHCI_ROOT_HUB_TT is not set |
1140 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set | 1154 | # CONFIG_USB_EHCI_TT_NEWSCHED is not set |
1141 | # CONFIG_USB_ISP116X_HCD is not set | 1155 | # CONFIG_USB_ISP116X_HCD is not set |
1156 | # CONFIG_USB_ISP1760_HCD is not set | ||
1142 | CONFIG_USB_OHCI_HCD=y | 1157 | CONFIG_USB_OHCI_HCD=y |
1143 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set | 1158 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set |
1144 | # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set | 1159 | # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set |
@@ -1173,6 +1188,7 @@ CONFIG_USB_STORAGE=m | |||
1173 | # CONFIG_USB_STORAGE_ALAUDA is not set | 1188 | # CONFIG_USB_STORAGE_ALAUDA is not set |
1174 | # CONFIG_USB_STORAGE_ONETOUCH is not set | 1189 | # CONFIG_USB_STORAGE_ONETOUCH is not set |
1175 | # CONFIG_USB_STORAGE_KARMA is not set | 1190 | # CONFIG_USB_STORAGE_KARMA is not set |
1191 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set | ||
1176 | # CONFIG_USB_LIBUSUAL is not set | 1192 | # CONFIG_USB_LIBUSUAL is not set |
1177 | 1193 | ||
1178 | # | 1194 | # |
@@ -1214,6 +1230,7 @@ CONFIG_USB_STORAGE=m | |||
1214 | # CONFIG_MMC is not set | 1230 | # CONFIG_MMC is not set |
1215 | # CONFIG_MEMSTICK is not set | 1231 | # CONFIG_MEMSTICK is not set |
1216 | # CONFIG_NEW_LEDS is not set | 1232 | # CONFIG_NEW_LEDS is not set |
1233 | # CONFIG_ACCESSIBILITY is not set | ||
1217 | # CONFIG_INFINIBAND is not set | 1234 | # CONFIG_INFINIBAND is not set |
1218 | # CONFIG_RTC_CLASS is not set | 1235 | # CONFIG_RTC_CLASS is not set |
1219 | # CONFIG_UIO is not set | 1236 | # CONFIG_UIO is not set |
@@ -1367,6 +1384,7 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y | |||
1367 | CONFIG_PRINTK_TIME=y | 1384 | CONFIG_PRINTK_TIME=y |
1368 | # CONFIG_ENABLE_WARN_DEPRECATED is not set | 1385 | # CONFIG_ENABLE_WARN_DEPRECATED is not set |
1369 | CONFIG_ENABLE_MUST_CHECK=y | 1386 | CONFIG_ENABLE_MUST_CHECK=y |
1387 | CONFIG_FRAME_WARN=2048 | ||
1370 | CONFIG_MAGIC_SYSRQ=y | 1388 | CONFIG_MAGIC_SYSRQ=y |
1371 | # CONFIG_UNUSED_SYMBOLS is not set | 1389 | # CONFIG_UNUSED_SYMBOLS is not set |
1372 | CONFIG_DEBUG_FS=y | 1390 | CONFIG_DEBUG_FS=y |
@@ -1377,6 +1395,7 @@ CONFIG_DETECT_SOFTLOCKUP=y | |||
1377 | # CONFIG_SCHED_DEBUG is not set | 1395 | # CONFIG_SCHED_DEBUG is not set |
1378 | CONFIG_SCHEDSTATS=y | 1396 | CONFIG_SCHEDSTATS=y |
1379 | # CONFIG_TIMER_STATS is not set | 1397 | # CONFIG_TIMER_STATS is not set |
1398 | # CONFIG_DEBUG_OBJECTS is not set | ||
1380 | # CONFIG_SLUB_DEBUG_ON is not set | 1399 | # CONFIG_SLUB_DEBUG_ON is not set |
1381 | # CONFIG_SLUB_STATS is not set | 1400 | # CONFIG_SLUB_STATS is not set |
1382 | # CONFIG_DEBUG_RT_MUTEXES is not set | 1401 | # CONFIG_DEBUG_RT_MUTEXES is not set |
@@ -1402,6 +1421,8 @@ CONFIG_DEBUG_BUGVERBOSE=y | |||
1402 | # CONFIG_LKDTM is not set | 1421 | # CONFIG_LKDTM is not set |
1403 | # CONFIG_FAULT_INJECTION is not set | 1422 | # CONFIG_FAULT_INJECTION is not set |
1404 | # CONFIG_SAMPLES is not set | 1423 | # CONFIG_SAMPLES is not set |
1424 | CONFIG_HAVE_ARCH_KGDB=y | ||
1425 | # CONFIG_KGDB is not set | ||
1405 | # CONFIG_DEBUG_STACK_USAGE is not set | 1426 | # CONFIG_DEBUG_STACK_USAGE is not set |
1406 | # CONFIG_DEBUG_DCFLUSH is not set | 1427 | # CONFIG_DEBUG_DCFLUSH is not set |
1407 | # CONFIG_STACK_DEBUG is not set | 1428 | # CONFIG_STACK_DEBUG is not set |
@@ -1503,6 +1524,7 @@ CONFIG_CRYPTO_HW=y | |||
1503 | # Library routines | 1524 | # Library routines |
1504 | # | 1525 | # |
1505 | CONFIG_BITREVERSE=y | 1526 | CONFIG_BITREVERSE=y |
1527 | # CONFIG_GENERIC_FIND_FIRST_BIT is not set | ||
1506 | CONFIG_CRC_CCITT=m | 1528 | CONFIG_CRC_CCITT=m |
1507 | CONFIG_CRC16=m | 1529 | CONFIG_CRC16=m |
1508 | # CONFIG_CRC_ITU_T is not set | 1530 | # CONFIG_CRC_ITU_T is not set |
diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S index b49d3b60bc0c..f25e1da3fd03 100644 --- a/arch/sparc64/kernel/etrap.S +++ b/arch/sparc64/kernel/etrap.S | |||
@@ -27,11 +27,12 @@ | |||
27 | 27 | ||
28 | .text | 28 | .text |
29 | .align 64 | 29 | .align 64 |
30 | .globl etrap, etrap_irq, etraptl1 | 30 | .globl etrap_syscall, etrap, etrap_irq, etraptl1 |
31 | etrap: rdpr %pil, %g2 | 31 | etrap: rdpr %pil, %g2 |
32 | etrap_irq: | 32 | etrap_irq: clr %g3 |
33 | TRAP_LOAD_THREAD_REG(%g6, %g1) | 33 | etrap_syscall: TRAP_LOAD_THREAD_REG(%g6, %g1) |
34 | rdpr %tstate, %g1 | 34 | rdpr %tstate, %g1 |
35 | or %g1, %g3, %g1 | ||
35 | sllx %g2, 20, %g3 | 36 | sllx %g2, 20, %g3 |
36 | andcc %g1, TSTATE_PRIV, %g0 | 37 | andcc %g1, TSTATE_PRIV, %g0 |
37 | or %g1, %g3, %g1 | 38 | or %g1, %g3, %g1 |
diff --git a/arch/sparc64/kernel/init_task.c b/arch/sparc64/kernel/init_task.c index 90007cf88bac..d2b312381c19 100644 --- a/arch/sparc64/kernel/init_task.c +++ b/arch/sparc64/kernel/init_task.c | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <asm/processor.h> | 10 | #include <asm/processor.h> |
11 | 11 | ||
12 | static struct fs_struct init_fs = INIT_FS; | 12 | static struct fs_struct init_fs = INIT_FS; |
13 | static struct files_struct init_files = INIT_FILES; | ||
14 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); | 13 | static struct signal_struct init_signals = INIT_SIGNALS(init_signals); |
15 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); | 14 | static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); |
16 | struct mm_struct init_mm = INIT_MM(init_mm); | 15 | struct mm_struct init_mm = INIT_MM(init_mm); |
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index e9fc0aa2da38..f6c9fc92921d 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c | |||
@@ -287,11 +287,11 @@ static int genregs64_set(struct task_struct *target, | |||
287 | 32 * sizeof(u64), | 287 | 32 * sizeof(u64), |
288 | 33 * sizeof(u64)); | 288 | 33 * sizeof(u64)); |
289 | if (!ret) { | 289 | if (!ret) { |
290 | /* Only the condition codes can be modified | 290 | /* Only the condition codes and the "in syscall" |
291 | * in the %tstate register. | 291 | * state can be modified in the %tstate register. |
292 | */ | 292 | */ |
293 | tstate &= (TSTATE_ICC | TSTATE_XCC); | 293 | tstate &= (TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL); |
294 | regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC); | 294 | regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL); |
295 | regs->tstate |= tstate; | 295 | regs->tstate |= tstate; |
296 | } | 296 | } |
297 | } | 297 | } |
@@ -657,8 +657,10 @@ static int genregs32_set(struct task_struct *target, | |||
657 | switch (pos) { | 657 | switch (pos) { |
658 | case 32: /* PSR */ | 658 | case 32: /* PSR */ |
659 | tstate = regs->tstate; | 659 | tstate = regs->tstate; |
660 | tstate &= ~(TSTATE_ICC | TSTATE_XCC); | 660 | tstate &= ~(TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL); |
661 | tstate |= psr_to_tstate_icc(reg); | 661 | tstate |= psr_to_tstate_icc(reg); |
662 | if (reg & PSR_SYSCALL) | ||
663 | tstate |= TSTATE_SYSCALL; | ||
662 | regs->tstate = tstate; | 664 | regs->tstate = tstate; |
663 | break; | 665 | break; |
664 | case 33: /* PC */ | 666 | case 33: /* PC */ |
@@ -944,6 +946,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
944 | break; | 946 | break; |
945 | 947 | ||
946 | default: | 948 | default: |
949 | if (request == PTRACE_SPARC_DETACH) | ||
950 | request = PTRACE_DETACH; | ||
947 | ret = compat_ptrace_request(child, request, addr, data); | 951 | ret = compat_ptrace_request(child, request, addr, data); |
948 | break; | 952 | break; |
949 | } | 953 | } |
@@ -1036,6 +1040,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
1036 | break; | 1040 | break; |
1037 | 1041 | ||
1038 | default: | 1042 | default: |
1043 | if (request == PTRACE_SPARC_DETACH) | ||
1044 | request = PTRACE_DETACH; | ||
1039 | ret = ptrace_request(child, request, addr, data); | 1045 | ret = ptrace_request(child, request, addr, data); |
1040 | break; | 1046 | break; |
1041 | } | 1047 | } |
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S index ecf6753b204a..16689b2930db 100644 --- a/arch/sparc64/kernel/rtrap.S +++ b/arch/sparc64/kernel/rtrap.S | |||
@@ -46,7 +46,7 @@ __handle_user_windows: | |||
46 | wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate | 46 | wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate |
47 | ldx [%g6 + TI_FLAGS], %l0 | 47 | ldx [%g6 + TI_FLAGS], %l0 |
48 | 48 | ||
49 | 1: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 | 49 | 1: andcc %l0, _TIF_SIGPENDING, %g0 |
50 | be,pt %xcc, __handle_user_windows_continue | 50 | be,pt %xcc, __handle_user_windows_continue |
51 | nop | 51 | nop |
52 | mov %l5, %o1 | 52 | mov %l5, %o1 |
@@ -86,7 +86,7 @@ __handle_perfctrs: | |||
86 | wrpr %g0, RTRAP_PSTATE, %pstate | 86 | wrpr %g0, RTRAP_PSTATE, %pstate |
87 | wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate | 87 | wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate |
88 | ldx [%g6 + TI_FLAGS], %l0 | 88 | ldx [%g6 + TI_FLAGS], %l0 |
89 | 1: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 | 89 | 1: andcc %l0, _TIF_SIGPENDING, %g0 |
90 | 90 | ||
91 | be,pt %xcc, __handle_perfctrs_continue | 91 | be,pt %xcc, __handle_perfctrs_continue |
92 | sethi %hi(TSTATE_PEF), %o0 | 92 | sethi %hi(TSTATE_PEF), %o0 |
@@ -195,7 +195,7 @@ __handle_preemption_continue: | |||
195 | andcc %l1, %o0, %g0 | 195 | andcc %l1, %o0, %g0 |
196 | andcc %l0, _TIF_NEED_RESCHED, %g0 | 196 | andcc %l0, _TIF_NEED_RESCHED, %g0 |
197 | bne,pn %xcc, __handle_preemption | 197 | bne,pn %xcc, __handle_preemption |
198 | andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0 | 198 | andcc %l0, _TIF_SIGPENDING, %g0 |
199 | bne,pn %xcc, __handle_signal | 199 | bne,pn %xcc, __handle_signal |
200 | __handle_signal_continue: | 200 | __handle_signal_continue: |
201 | ldub [%g6 + TI_WSAVED], %o2 | 201 | ldub [%g6 + TI_WSAVED], %o2 |
@@ -257,6 +257,7 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1 | |||
257 | wr %o3, %g0, %y | 257 | wr %o3, %g0, %y |
258 | wrpr %l4, 0x0, %pil | 258 | wrpr %l4, 0x0, %pil |
259 | wrpr %g0, 0x1, %tl | 259 | wrpr %g0, 0x1, %tl |
260 | andn %l1, TSTATE_SYSCALL, %l1 | ||
260 | wrpr %l1, %g0, %tstate | 261 | wrpr %l1, %g0, %tstate |
261 | wrpr %l2, %g0, %tpc | 262 | wrpr %l2, %g0, %tpc |
262 | wrpr %o2, %g0, %tnpc | 263 | wrpr %o2, %g0, %tnpc |
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c index 07c0443ea3f5..6e4dc67d16af 100644 --- a/arch/sparc64/kernel/signal.c +++ b/arch/sparc64/kernel/signal.c | |||
@@ -247,7 +247,9 @@ static long _sigpause_common(old_sigset_t set) | |||
247 | 247 | ||
248 | current->state = TASK_INTERRUPTIBLE; | 248 | current->state = TASK_INTERRUPTIBLE; |
249 | schedule(); | 249 | schedule(); |
250 | set_thread_flag(TIF_RESTORE_SIGMASK); | 250 | |
251 | set_restore_sigmask(); | ||
252 | |||
251 | return -ERESTARTNOHAND; | 253 | return -ERESTARTNOHAND; |
252 | } | 254 | } |
253 | 255 | ||
@@ -333,7 +335,7 @@ void do_rt_sigreturn(struct pt_regs *regs) | |||
333 | regs->tnpc = tnpc; | 335 | regs->tnpc = tnpc; |
334 | 336 | ||
335 | /* Prevent syscall restart. */ | 337 | /* Prevent syscall restart. */ |
336 | pt_regs_clear_trap_type(regs); | 338 | pt_regs_clear_syscall(regs); |
337 | 339 | ||
338 | sigdelsetmask(&set, ~_BLOCKABLE); | 340 | sigdelsetmask(&set, ~_BLOCKABLE); |
339 | spin_lock_irq(¤t->sighand->siglock); | 341 | spin_lock_irq(¤t->sighand->siglock); |
@@ -499,7 +501,7 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
499 | } | 501 | } |
500 | 502 | ||
501 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 503 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
502 | struct sigaction *sa) | 504 | struct sigaction *sa) |
503 | { | 505 | { |
504 | switch (regs->u_regs[UREG_I0]) { | 506 | switch (regs->u_regs[UREG_I0]) { |
505 | case ERESTART_RESTARTBLOCK: | 507 | case ERESTART_RESTARTBLOCK: |
@@ -525,21 +527,19 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | |||
525 | */ | 527 | */ |
526 | static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | 528 | static void do_signal(struct pt_regs *regs, unsigned long orig_i0) |
527 | { | 529 | { |
528 | struct signal_deliver_cookie cookie; | ||
529 | struct k_sigaction ka; | 530 | struct k_sigaction ka; |
531 | int restart_syscall; | ||
530 | sigset_t *oldset; | 532 | sigset_t *oldset; |
531 | siginfo_t info; | 533 | siginfo_t info; |
532 | int signr; | 534 | int signr; |
533 | 535 | ||
534 | if (pt_regs_is_syscall(regs) && | 536 | if (pt_regs_is_syscall(regs) && |
535 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { | 537 | (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { |
536 | pt_regs_clear_trap_type(regs); | 538 | restart_syscall = 1; |
537 | cookie.restart_syscall = 1; | ||
538 | } else | 539 | } else |
539 | cookie.restart_syscall = 0; | 540 | restart_syscall = 0; |
540 | cookie.orig_i0 = orig_i0; | ||
541 | 541 | ||
542 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 542 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) |
543 | oldset = ¤t->saved_sigmask; | 543 | oldset = ¤t->saved_sigmask; |
544 | else | 544 | else |
545 | oldset = ¤t->blocked; | 545 | oldset = ¤t->blocked; |
@@ -547,77 +547,62 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
547 | #ifdef CONFIG_COMPAT | 547 | #ifdef CONFIG_COMPAT |
548 | if (test_thread_flag(TIF_32BIT)) { | 548 | if (test_thread_flag(TIF_32BIT)) { |
549 | extern void do_signal32(sigset_t *, struct pt_regs *, | 549 | extern void do_signal32(sigset_t *, struct pt_regs *, |
550 | struct signal_deliver_cookie *); | 550 | int restart_syscall, |
551 | do_signal32(oldset, regs, &cookie); | 551 | unsigned long orig_i0); |
552 | do_signal32(oldset, regs, restart_syscall, orig_i0); | ||
552 | return; | 553 | return; |
553 | } | 554 | } |
554 | #endif | 555 | #endif |
555 | 556 | ||
556 | signr = get_signal_to_deliver(&info, &ka, regs, &cookie); | 557 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
558 | |||
559 | /* If the debugger messes with the program counter, it clears | ||
560 | * the software "in syscall" bit, directing us to not perform | ||
561 | * a syscall restart. | ||
562 | */ | ||
563 | if (restart_syscall && !pt_regs_is_syscall(regs)) | ||
564 | restart_syscall = 0; | ||
565 | |||
557 | if (signr > 0) { | 566 | if (signr > 0) { |
558 | if (cookie.restart_syscall) | 567 | if (restart_syscall) |
559 | syscall_restart(cookie.orig_i0, regs, &ka.sa); | 568 | syscall_restart(orig_i0, regs, &ka.sa); |
560 | handle_signal(signr, &ka, &info, oldset, regs); | 569 | handle_signal(signr, &ka, &info, oldset, regs); |
561 | 570 | ||
562 | /* a signal was successfully delivered; the saved | 571 | /* A signal was successfully delivered; the saved |
563 | * sigmask will have been stored in the signal frame, | 572 | * sigmask will have been stored in the signal frame, |
564 | * and will be restored by sigreturn, so we can simply | 573 | * and will be restored by sigreturn, so we can simply |
565 | * clear the TIF_RESTORE_SIGMASK flag. | 574 | * clear the TS_RESTORE_SIGMASK flag. |
566 | */ | 575 | */ |
567 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 576 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
568 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
569 | return; | 577 | return; |
570 | } | 578 | } |
571 | if (cookie.restart_syscall && | 579 | if (restart_syscall && |
572 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || | 580 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
573 | regs->u_regs[UREG_I0] == ERESTARTSYS || | 581 | regs->u_regs[UREG_I0] == ERESTARTSYS || |
574 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { | 582 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
575 | /* replay the system call when we are done */ | 583 | /* replay the system call when we are done */ |
576 | regs->u_regs[UREG_I0] = cookie.orig_i0; | 584 | regs->u_regs[UREG_I0] = orig_i0; |
577 | regs->tpc -= 4; | 585 | regs->tpc -= 4; |
578 | regs->tnpc -= 4; | 586 | regs->tnpc -= 4; |
579 | } | 587 | } |
580 | if (cookie.restart_syscall && | 588 | if (restart_syscall && |
581 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { | 589 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
582 | regs->u_regs[UREG_G1] = __NR_restart_syscall; | 590 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
583 | regs->tpc -= 4; | 591 | regs->tpc -= 4; |
584 | regs->tnpc -= 4; | 592 | regs->tnpc -= 4; |
585 | } | 593 | } |
586 | 594 | ||
587 | /* if there's no signal to deliver, we just put the saved sigmask | 595 | /* If there's no signal to deliver, we just put the saved sigmask |
588 | * back | 596 | * back |
589 | */ | 597 | */ |
590 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 598 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { |
591 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 599 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
592 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | 600 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
593 | } | 601 | } |
594 | } | 602 | } |
595 | 603 | ||
596 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) | 604 | void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, unsigned long thread_info_flags) |
597 | { | 605 | { |
598 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) | 606 | if (thread_info_flags & _TIF_SIGPENDING) |
599 | do_signal(regs, orig_i0); | 607 | do_signal(regs, orig_i0); |
600 | } | 608 | } |
601 | |||
602 | void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) | ||
603 | { | ||
604 | struct signal_deliver_cookie *cp = cookie; | ||
605 | |||
606 | if (cp->restart_syscall && | ||
607 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || | ||
608 | regs->u_regs[UREG_I0] == ERESTARTSYS || | ||
609 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { | ||
610 | /* replay the system call when we are done */ | ||
611 | regs->u_regs[UREG_I0] = cp->orig_i0; | ||
612 | regs->tpc -= 4; | ||
613 | regs->tnpc -= 4; | ||
614 | cp->restart_syscall = 0; | ||
615 | } | ||
616 | if (cp->restart_syscall && | ||
617 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { | ||
618 | regs->u_regs[UREG_G1] = __NR_restart_syscall; | ||
619 | regs->tpc -= 4; | ||
620 | regs->tnpc -= 4; | ||
621 | cp->restart_syscall = 0; | ||
622 | } | ||
623 | } | ||
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c index 0f6b7b156efd..97cdd1bf4a10 100644 --- a/arch/sparc64/kernel/signal32.c +++ b/arch/sparc64/kernel/signal32.c | |||
@@ -269,7 +269,7 @@ void do_sigreturn32(struct pt_regs *regs) | |||
269 | regs->tstate |= psr_to_tstate_icc(psr); | 269 | regs->tstate |= psr_to_tstate_icc(psr); |
270 | 270 | ||
271 | /* Prevent syscall restart. */ | 271 | /* Prevent syscall restart. */ |
272 | pt_regs_clear_trap_type(regs); | 272 | pt_regs_clear_syscall(regs); |
273 | 273 | ||
274 | err |= __get_user(fpu_save, &sf->fpu_save); | 274 | err |= __get_user(fpu_save, &sf->fpu_save); |
275 | if (fpu_save) | 275 | if (fpu_save) |
@@ -355,7 +355,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) | |||
355 | regs->tstate |= psr_to_tstate_icc(psr); | 355 | regs->tstate |= psr_to_tstate_icc(psr); |
356 | 356 | ||
357 | /* Prevent syscall restart. */ | 357 | /* Prevent syscall restart. */ |
358 | pt_regs_clear_trap_type(regs); | 358 | pt_regs_clear_syscall(regs); |
359 | 359 | ||
360 | err |= __get_user(fpu_save, &sf->fpu_save); | 360 | err |= __get_user(fpu_save, &sf->fpu_save); |
361 | if (fpu_save) | 361 | if (fpu_save) |
@@ -768,48 +768,55 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs | |||
768 | * mistake. | 768 | * mistake. |
769 | */ | 769 | */ |
770 | void do_signal32(sigset_t *oldset, struct pt_regs * regs, | 770 | void do_signal32(sigset_t *oldset, struct pt_regs * regs, |
771 | struct signal_deliver_cookie *cookie) | 771 | int restart_syscall, unsigned long orig_i0) |
772 | { | 772 | { |
773 | struct k_sigaction ka; | 773 | struct k_sigaction ka; |
774 | siginfo_t info; | 774 | siginfo_t info; |
775 | int signr; | 775 | int signr; |
776 | 776 | ||
777 | signr = get_signal_to_deliver(&info, &ka, regs, cookie); | 777 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
778 | |||
779 | /* If the debugger messes with the program counter, it clears | ||
780 | * the "in syscall" bit, directing us to not perform a syscall | ||
781 | * restart. | ||
782 | */ | ||
783 | if (restart_syscall && !pt_regs_is_syscall(regs)) | ||
784 | restart_syscall = 0; | ||
785 | |||
778 | if (signr > 0) { | 786 | if (signr > 0) { |
779 | if (cookie->restart_syscall) | 787 | if (restart_syscall) |
780 | syscall_restart32(cookie->orig_i0, regs, &ka.sa); | 788 | syscall_restart32(orig_i0, regs, &ka.sa); |
781 | handle_signal32(signr, &ka, &info, oldset, regs); | 789 | handle_signal32(signr, &ka, &info, oldset, regs); |
782 | 790 | ||
783 | /* a signal was successfully delivered; the saved | 791 | /* A signal was successfully delivered; the saved |
784 | * sigmask will have been stored in the signal frame, | 792 | * sigmask will have been stored in the signal frame, |
785 | * and will be restored by sigreturn, so we can simply | 793 | * and will be restored by sigreturn, so we can simply |
786 | * clear the TIF_RESTORE_SIGMASK flag. | 794 | * clear the TS_RESTORE_SIGMASK flag. |
787 | */ | 795 | */ |
788 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 796 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
789 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
790 | return; | 797 | return; |
791 | } | 798 | } |
792 | if (cookie->restart_syscall && | 799 | if (restart_syscall && |
793 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || | 800 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
794 | regs->u_regs[UREG_I0] == ERESTARTSYS || | 801 | regs->u_regs[UREG_I0] == ERESTARTSYS || |
795 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { | 802 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
796 | /* replay the system call when we are done */ | 803 | /* replay the system call when we are done */ |
797 | regs->u_regs[UREG_I0] = cookie->orig_i0; | 804 | regs->u_regs[UREG_I0] = orig_i0; |
798 | regs->tpc -= 4; | 805 | regs->tpc -= 4; |
799 | regs->tnpc -= 4; | 806 | regs->tnpc -= 4; |
800 | } | 807 | } |
801 | if (cookie->restart_syscall && | 808 | if (restart_syscall && |
802 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { | 809 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
803 | regs->u_regs[UREG_G1] = __NR_restart_syscall; | 810 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
804 | regs->tpc -= 4; | 811 | regs->tpc -= 4; |
805 | regs->tnpc -= 4; | 812 | regs->tnpc -= 4; |
806 | } | 813 | } |
807 | 814 | ||
808 | /* if there's no signal to deliver, we just put the saved sigmask | 815 | /* If there's no signal to deliver, we just put the saved sigmask |
809 | * back | 816 | * back |
810 | */ | 817 | */ |
811 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { | 818 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { |
812 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 819 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
813 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | 820 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
814 | } | 821 | } |
815 | } | 822 | } |
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c index 0dbc941f130e..ac1bff58c1ac 100644 --- a/arch/sparc64/kernel/sys_sparc.c +++ b/arch/sparc64/kernel/sys_sparc.c | |||
@@ -542,8 +542,7 @@ asmlinkage long sparc64_personality(unsigned long personality) | |||
542 | return ret; | 542 | return ret; |
543 | } | 543 | } |
544 | 544 | ||
545 | int sparc64_mmap_check(unsigned long addr, unsigned long len, | 545 | int sparc64_mmap_check(unsigned long addr, unsigned long len) |
546 | unsigned long flags) | ||
547 | { | 546 | { |
548 | if (test_thread_flag(TIF_32BIT)) { | 547 | if (test_thread_flag(TIF_32BIT)) { |
549 | if (len >= STACK_TOP32) | 548 | if (len >= STACK_TOP32) |
@@ -609,46 +608,19 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr, | |||
609 | unsigned long old_len, unsigned long new_len, | 608 | unsigned long old_len, unsigned long new_len, |
610 | unsigned long flags, unsigned long new_addr) | 609 | unsigned long flags, unsigned long new_addr) |
611 | { | 610 | { |
612 | struct vm_area_struct *vma; | ||
613 | unsigned long ret = -EINVAL; | 611 | unsigned long ret = -EINVAL; |
614 | 612 | ||
615 | if (test_thread_flag(TIF_32BIT)) | 613 | if (test_thread_flag(TIF_32BIT)) |
616 | goto out; | 614 | goto out; |
617 | if (unlikely(new_len >= VA_EXCLUDE_START)) | 615 | if (unlikely(new_len >= VA_EXCLUDE_START)) |
618 | goto out; | 616 | goto out; |
619 | if (unlikely(invalid_64bit_range(addr, old_len))) | 617 | if (unlikely(sparc64_mmap_check(addr, old_len))) |
618 | goto out; | ||
619 | if (unlikely(sparc64_mmap_check(new_addr, new_len))) | ||
620 | goto out; | 620 | goto out; |
621 | 621 | ||
622 | down_write(¤t->mm->mmap_sem); | 622 | down_write(¤t->mm->mmap_sem); |
623 | if (flags & MREMAP_FIXED) { | ||
624 | if (invalid_64bit_range(new_addr, new_len)) | ||
625 | goto out_sem; | ||
626 | } else if (invalid_64bit_range(addr, new_len)) { | ||
627 | unsigned long map_flags = 0; | ||
628 | struct file *file = NULL; | ||
629 | |||
630 | ret = -ENOMEM; | ||
631 | if (!(flags & MREMAP_MAYMOVE)) | ||
632 | goto out_sem; | ||
633 | |||
634 | vma = find_vma(current->mm, addr); | ||
635 | if (vma) { | ||
636 | if (vma->vm_flags & VM_SHARED) | ||
637 | map_flags |= MAP_SHARED; | ||
638 | file = vma->vm_file; | ||
639 | } | ||
640 | |||
641 | /* MREMAP_FIXED checked above. */ | ||
642 | new_addr = get_unmapped_area(file, addr, new_len, | ||
643 | vma ? vma->vm_pgoff : 0, | ||
644 | map_flags); | ||
645 | ret = new_addr; | ||
646 | if (new_addr & ~PAGE_MASK) | ||
647 | goto out_sem; | ||
648 | flags |= MREMAP_FIXED; | ||
649 | } | ||
650 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | 623 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
651 | out_sem: | ||
652 | up_write(¤t->mm->mmap_sem); | 624 | up_write(¤t->mm->mmap_sem); |
653 | out: | 625 | out: |
654 | return ret; | 626 | return ret; |
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 1aa4288125f2..ba5bd626b39e 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c | |||
@@ -867,44 +867,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, | |||
867 | unsigned long old_len, unsigned long new_len, | 867 | unsigned long old_len, unsigned long new_len, |
868 | unsigned long flags, u32 __new_addr) | 868 | unsigned long flags, u32 __new_addr) |
869 | { | 869 | { |
870 | struct vm_area_struct *vma; | ||
871 | unsigned long ret = -EINVAL; | 870 | unsigned long ret = -EINVAL; |
872 | unsigned long new_addr = __new_addr; | 871 | unsigned long new_addr = __new_addr; |
873 | 872 | ||
874 | if (old_len > STACK_TOP32 || new_len > STACK_TOP32) | 873 | if (unlikely(sparc64_mmap_check(addr, old_len))) |
875 | goto out; | 874 | goto out; |
876 | if (addr > STACK_TOP32 - old_len) | 875 | if (unlikely(sparc64_mmap_check(new_addr, new_len))) |
877 | goto out; | 876 | goto out; |
878 | down_write(¤t->mm->mmap_sem); | 877 | down_write(¤t->mm->mmap_sem); |
879 | if (flags & MREMAP_FIXED) { | ||
880 | if (new_addr > STACK_TOP32 - new_len) | ||
881 | goto out_sem; | ||
882 | } else if (addr > STACK_TOP32 - new_len) { | ||
883 | unsigned long map_flags = 0; | ||
884 | struct file *file = NULL; | ||
885 | |||
886 | ret = -ENOMEM; | ||
887 | if (!(flags & MREMAP_MAYMOVE)) | ||
888 | goto out_sem; | ||
889 | |||
890 | vma = find_vma(current->mm, addr); | ||
891 | if (vma) { | ||
892 | if (vma->vm_flags & VM_SHARED) | ||
893 | map_flags |= MAP_SHARED; | ||
894 | file = vma->vm_file; | ||
895 | } | ||
896 | |||
897 | /* MREMAP_FIXED checked above. */ | ||
898 | new_addr = get_unmapped_area(file, addr, new_len, | ||
899 | vma ? vma->vm_pgoff : 0, | ||
900 | map_flags); | ||
901 | ret = new_addr; | ||
902 | if (new_addr & ~PAGE_MASK) | ||
903 | goto out_sem; | ||
904 | flags |= MREMAP_FIXED; | ||
905 | } | ||
906 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); | 878 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
907 | out_sem: | ||
908 | up_write(¤t->mm->mmap_sem); | 879 | up_write(¤t->mm->mmap_sem); |
909 | out: | 880 | out: |
910 | return ret; | 881 | return ret; |
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index ec3e2c72302a..3c7b9471eafb 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c | |||
@@ -610,8 +610,6 @@ static void __init remap_kernel(void) | |||
610 | 610 | ||
611 | static void __init inherit_prom_mappings(void) | 611 | static void __init inherit_prom_mappings(void) |
612 | { | 612 | { |
613 | read_obp_translations(); | ||
614 | |||
615 | /* Now fixup OBP's idea about where we really are mapped. */ | 613 | /* Now fixup OBP's idea about where we really are mapped. */ |
616 | printk("Remapping the kernel... "); | 614 | printk("Remapping the kernel... "); |
617 | remap_kernel(); | 615 | remap_kernel(); |
@@ -770,7 +768,7 @@ static void __init find_ramdisk(unsigned long phys_base) | |||
770 | initrd_start = ramdisk_image; | 768 | initrd_start = ramdisk_image; |
771 | initrd_end = ramdisk_image + sparc_ramdisk_size; | 769 | initrd_end = ramdisk_image + sparc_ramdisk_size; |
772 | 770 | ||
773 | lmb_reserve(initrd_start, initrd_end); | 771 | lmb_reserve(initrd_start, sparc_ramdisk_size); |
774 | 772 | ||
775 | initrd_start += PAGE_OFFSET; | 773 | initrd_start += PAGE_OFFSET; |
776 | initrd_end += PAGE_OFFSET; | 774 | initrd_end += PAGE_OFFSET; |
@@ -1747,7 +1745,17 @@ void __init paging_init(void) | |||
1747 | 1745 | ||
1748 | lmb_init(); | 1746 | lmb_init(); |
1749 | 1747 | ||
1750 | /* Find available physical memory... */ | 1748 | /* Find available physical memory... |
1749 | * | ||
1750 | * Read it twice in order to work around a bug in openfirmware. | ||
1751 | * The call to grab this table itself can cause openfirmware to | ||
1752 | * allocate memory, which in turn can take away some space from | ||
1753 | * the list of available memory. Reading it twice makes sure | ||
1754 | * we really do get the final value. | ||
1755 | */ | ||
1756 | read_obp_translations(); | ||
1757 | read_obp_memory("reg", &pall[0], &pall_ents); | ||
1758 | read_obp_memory("available", &pavail[0], &pavail_ents); | ||
1751 | read_obp_memory("available", &pavail[0], &pavail_ents); | 1759 | read_obp_memory("available", &pavail[0], &pavail_ents); |
1752 | 1760 | ||
1753 | phys_base = 0xffffffffffffffffUL; | 1761 | phys_base = 0xffffffffffffffffUL; |
@@ -1788,8 +1796,6 @@ void __init paging_init(void) | |||
1788 | 1796 | ||
1789 | inherit_prom_mappings(); | 1797 | inherit_prom_mappings(); |
1790 | 1798 | ||
1791 | read_obp_memory("reg", &pall[0], &pall_ents); | ||
1792 | |||
1793 | init_kpte_bitmap(); | 1799 | init_kpte_bitmap(); |
1794 | 1800 | ||
1795 | /* Ok, we can use our TLB miss and window trap handlers safely. */ | 1801 | /* Ok, we can use our TLB miss and window trap handlers safely. */ |