aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-03-30 16:29:06 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-04-02 12:14:03 -0400
commite1d5c0195075abaa45cd04ca397dbeaa0d18c490 (patch)
tree6ed1ccb2ab7cfda0dae569f3adbc667e7642dbe3 /arch/tile
parentb1760c847ff9d04fba7cdbef005a0ad805311c6d (diff)
arch/tile: avoid accidentally unmasking NMI-type interrupt accidentally
The return path as we reload registers and core state requires that r30 hold a boolean indicating whether we are returning from an NMI, but in a couple of cases we weren't setting this properly, with the result that we could accidentally unmask the NMI interrupt(s), which could cause confusion. Now we set r30 in every place where we jump into the interrupt return path. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile')
-rw-r--r--arch/tile/kernel/intvec_32.S24
-rw-r--r--arch/tile/kernel/intvec_64.S19
2 files changed, 36 insertions, 7 deletions
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index aecc8ed5f39..5d56a1ef5ba 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -799,6 +799,10 @@ handle_interrupt:
799 * This routine takes a boolean in r30 indicating if this is an NMI. 799 * This routine takes a boolean in r30 indicating if this is an NMI.
800 * If so, we also expect a boolean in r31 indicating whether to 800 * If so, we also expect a boolean in r31 indicating whether to
801 * re-enable the oprofile interrupts. 801 * re-enable the oprofile interrupts.
802 *
803 * Note that .Lresume_userspace is jumped to directly in several
804 * places, and we need to make sure r30 is set correctly in those
805 * callers as well.
802 */ 806 */
803STD_ENTRY(interrupt_return) 807STD_ENTRY(interrupt_return)
804 /* If we're resuming to kernel space, don't check thread flags. */ 808 /* If we're resuming to kernel space, don't check thread flags. */
@@ -1237,7 +1241,10 @@ handle_syscall:
1237 bzt r30, 1f 1241 bzt r30, 1f
1238 jal do_syscall_trace 1242 jal do_syscall_trace
1239 FEEDBACK_REENTER(handle_syscall) 1243 FEEDBACK_REENTER(handle_syscall)
12401: j .Lresume_userspace /* jump into middle of interrupt_return */ 12441: {
1245 movei r30, 0 /* not an NMI */
1246 j .Lresume_userspace /* jump into middle of interrupt_return */
1247 }
1241 1248
1242.Linvalid_syscall: 1249.Linvalid_syscall:
1243 /* Report an invalid syscall back to the user program */ 1250 /* Report an invalid syscall back to the user program */
@@ -1246,7 +1253,10 @@ handle_syscall:
1246 movei r28, -ENOSYS 1253 movei r28, -ENOSYS
1247 } 1254 }
1248 sw r29, r28 1255 sw r29, r28
1249 j .Lresume_userspace /* jump into middle of interrupt_return */ 1256 {
1257 movei r30, 0 /* not an NMI */
1258 j .Lresume_userspace /* jump into middle of interrupt_return */
1259 }
1250 STD_ENDPROC(handle_syscall) 1260 STD_ENDPROC(handle_syscall)
1251 1261
1252 /* Return the address for oprofile to suppress in backtraces. */ 1262 /* Return the address for oprofile to suppress in backtraces. */
@@ -1262,7 +1272,10 @@ STD_ENTRY(ret_from_fork)
1262 jal sim_notify_fork 1272 jal sim_notify_fork
1263 jal schedule_tail 1273 jal schedule_tail
1264 FEEDBACK_REENTER(ret_from_fork) 1274 FEEDBACK_REENTER(ret_from_fork)
1265 j .Lresume_userspace /* jump into middle of interrupt_return */ 1275 {
1276 movei r30, 0 /* not an NMI */
1277 j .Lresume_userspace /* jump into middle of interrupt_return */
1278 }
1266 STD_ENDPROC(ret_from_fork) 1279 STD_ENDPROC(ret_from_fork)
1267 1280
1268 /* 1281 /*
@@ -1376,7 +1389,10 @@ handle_ill:
1376 1389
1377 jal send_sigtrap /* issue a SIGTRAP */ 1390 jal send_sigtrap /* issue a SIGTRAP */
1378 FEEDBACK_REENTER(handle_ill) 1391 FEEDBACK_REENTER(handle_ill)
1379 j .Lresume_userspace /* jump into middle of interrupt_return */ 1392 {
1393 movei r30, 0 /* not an NMI */
1394 j .Lresume_userspace /* jump into middle of interrupt_return */
1395 }
1380 1396
1381.Ldispatch_normal_ill: 1397.Ldispatch_normal_ill:
1382 { 1398 {
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index fdff17c70cc..49d9d662168 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -606,6 +606,10 @@ handle_interrupt:
606 * This routine takes a boolean in r30 indicating if this is an NMI. 606 * This routine takes a boolean in r30 indicating if this is an NMI.
607 * If so, we also expect a boolean in r31 indicating whether to 607 * If so, we also expect a boolean in r31 indicating whether to
608 * re-enable the oprofile interrupts. 608 * re-enable the oprofile interrupts.
609 *
610 * Note that .Lresume_userspace is jumped to directly in several
611 * places, and we need to make sure r30 is set correctly in those
612 * callers as well.
609 */ 613 */
610STD_ENTRY(interrupt_return) 614STD_ENTRY(interrupt_return)
611 /* If we're resuming to kernel space, don't check thread flags. */ 615 /* If we're resuming to kernel space, don't check thread flags. */
@@ -1058,7 +1062,10 @@ handle_syscall:
1058 } 1062 }
1059 FEEDBACK_REENTER(handle_syscall) 1063 FEEDBACK_REENTER(handle_syscall)
1060 1064
10612: j .Lresume_userspace /* jump into middle of interrupt_return */ 10652: {
1066 movei r30, 0 /* not an NMI */
1067 j .Lresume_userspace /* jump into middle of interrupt_return */
1068 }
1062 1069
1063.Lcompat_syscall: 1070.Lcompat_syscall:
1064 /* 1071 /*
@@ -1092,7 +1099,10 @@ handle_syscall:
1092 movei r28, -ENOSYS 1099 movei r28, -ENOSYS
1093 } 1100 }
1094 st r29, r28 1101 st r29, r28
1095 j .Lresume_userspace /* jump into middle of interrupt_return */ 1102 {
1103 movei r30, 0 /* not an NMI */
1104 j .Lresume_userspace /* jump into middle of interrupt_return */
1105 }
1096 STD_ENDPROC(handle_syscall) 1106 STD_ENDPROC(handle_syscall)
1097 1107
1098 /* Return the address for oprofile to suppress in backtraces. */ 1108 /* Return the address for oprofile to suppress in backtraces. */
@@ -1108,7 +1118,10 @@ STD_ENTRY(ret_from_fork)
1108 jal sim_notify_fork 1118 jal sim_notify_fork
1109 jal schedule_tail 1119 jal schedule_tail
1110 FEEDBACK_REENTER(ret_from_fork) 1120 FEEDBACK_REENTER(ret_from_fork)
1111 j .Lresume_userspace 1121 {
1122 movei r30, 0 /* not an NMI */
1123 j .Lresume_userspace /* jump into middle of interrupt_return */
1124 }
1112 STD_ENDPROC(ret_from_fork) 1125 STD_ENDPROC(ret_from_fork)
1113 1126
1114/* Various stub interrupt handlers and syscall handlers */ 1127/* Various stub interrupt handlers and syscall handlers */