-#define portDISABLE_INTERRUPTS() \\r
-{ \\r
-unsigned portLONG ulStatus; \\r
- \\r
- /* Mask interrupts at and below the kernel interrupt priority. */ \\r
- ulStatus = _CP0_GET_STATUS(); \\r
- ulStatus |= ( configMAX_SYSCALL_INTERRUPT_PRIORITY << portIPL_SHIFT ); \\r
- _CP0_SET_STATUS( ulStatus ); \\r
+/* This clears the IPL bits, then sets them to \r
+configMAX_SYSCALL_INTERRUPT_PRIORITY. This function should not be called\r
+from an interrupt, so therefore will not be called with an IPL setting\r
+above configMAX_SYSCALL_INTERRUPT_PRIORITY. Therefore, when used correctly, the \r
+instructions in this macro can only result in the IPL being raised, and \r
+therefore never lowered. */\r
+#define portDISABLE_INTERRUPTS() \\r
+{ \\r
+unsigned long ulStatus; \\r
+ \\r
+ /* Mask interrupts at and below the kernel interrupt priority. */ \\r
+ ulStatus = _CP0_GET_STATUS(); \\r
+ ulStatus &= ~portALL_IPL_BITS; \\r
+ _CP0_SET_STATUS( ( ulStatus | ( configMAX_SYSCALL_INTERRUPT_PRIORITY << portIPL_SHIFT ) ) ); \\r