Created
March 26, 2017 18:43
-
-
Save pamaury/48e17fbd5ee7c1078d1eea80e5d98c2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/firmware/asm/mips/thread-mips32.c b/firmware/asm/mips/thread-mips32.c | |
index e754df7e29..664375d4e5 100644 | |
--- a/firmware/asm/mips/thread-mips32.c | |
+++ b/firmware/asm/mips/thread-mips32.c | |
@@ -26,20 +26,20 @@ | |
*--------------------------------------------------------------------------- | |
*/ | |
-void start_thread(void); /* Provide C access to ASM label */ | |
-static void USED_ATTR _start_thread(void) | |
+static void USED_ATTR start_thread(void* addr) | |
{ | |
/* t1 = context */ | |
asm volatile ( | |
"start_thread: \n" | |
".set noreorder \n" | |
".set noat \n" | |
- "lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */ | |
- "lw $29, 36($9) \n" /* Set initial sp(=$29) */ | |
+ "lw $8, 4(%0) \n" /* Fetch thread function pointer ($8 = t0) */ | |
+ "lw $29, 36(%0) \n" /* Set initial sp(=$29) */ | |
"jalr $8 \n" /* Start the thread */ | |
- "sw $0, 44($9) \n" /* Clear start address */ | |
+ "sw $0, 44(%0) \n" /* Clear start address */ | |
".set at \n" | |
".set reorder \n" | |
+ : : "r" (addr) : "t0", "t1" | |
); | |
thread_exit(); | |
} | |
@@ -90,7 +90,7 @@ static inline void load_context(const void* addr) | |
"beqz $8, running \n" /* NULL -> already running */ | |
"nop \n" | |
"jr $8 \n" | |
- "move $9, %0 \n" /* t1 = context */ | |
+ "move $4, %0 \n" /* a0 = context */ | |
"running: \n" | |
"lw $16, 0(%0) \n" /* s0 */ | |
"lw $17, 4(%0) \n" /* s1 */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment