]> git.sur5r.net Git - freertos/commitdiff
Update yield code in RX600/GCC port.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 17 Apr 2013 08:23:02 +0000 (08:23 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Wed, 17 Apr 2013 08:23:02 +0000 (08:23 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1866 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/portable/GCC/RX600/portmacro.h

index 5dde7013ddba911617f43853c2037df615763f31..05deac02862ad2cd40cc8884d3070737e20f76eb 100644 (file)
@@ -115,10 +115,20 @@ portSTACK_TYPE and portBASE_TYPE. */
 #define portTICK_RATE_MS                       ( ( portTickType ) 1000 / configTICK_RATE_HZ )          \r
 #define portNOP()                                      __asm volatile( "NOP" )\r
 \r
-/* The location of the software interrupt register.  Software interrupts use\r
-vector 27. */\r
-#define portITU_SWINTR                 ( ( unsigned char * ) 0x000872E0 )\r
-#define portYIELD()                            *portITU_SWINTR = 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()\r
+/* Yield equivalent to "*portITU_SWINTR = 0x01; ( void ) *portITU_SWINTR;"\r
+where portITU_SWINTR is the location of the software interrupt register\r
+(0x000872E0).  Don't rely on the assembler to select a register, so instead \r
+save and restore clobbered registers manually. */\r
+#define portYIELD()                                                    \\r
+       __asm volatile                                                  \\r
+       (                                                                               \\r
+               "PUSH.L R10                                     \n"             \\r
+               "MOV.L  #0x872E0, R10           \n"             \\r
+               "MOV.B  #0x1, [R10]                     \n"             \\r
+               "MOV.L  [R10], R10                      \n"             \\r
+               "POP    R10                                     \n"             \\r
+       )\r
+\r
 #define portYIELD_FROM_ISR( x )        if( x != pdFALSE ) portYIELD()\r
 \r
 /*\r