Fix MIPS threading code to compile with older compiler
Official rockbox mips gcc is old and doesn't support symbolic register names in inline assembly Change-Id: If67230d06e28ccf31b0f8f8e1b622275fed3f6ff
This commit is contained in:
parent
9be14c014f
commit
71dc1a789a
1 changed files with 34 additions and 34 deletions
|
@ -31,13 +31,13 @@ static void USED_ATTR start_thread(void *addr)
|
|||
asm volatile (
|
||||
".set noreorder \n"
|
||||
".set noat \n"
|
||||
"lw $t9, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */
|
||||
"lw $sp, 40(%0) \n" /* Set initial sp(=$29) */
|
||||
"jalr $t9 \n" /* Start the thread */
|
||||
"sw $zero, 48(%0) \n" /* Clear start address */
|
||||
"lw $25, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */
|
||||
"lw $25, 40(%0) \n" /* Set initial sp(=$29) */
|
||||
"jalr $25 \n" /* Start the thread */
|
||||
"sw $0, 48(%0) \n" /* Clear start address */
|
||||
".set at \n"
|
||||
".set reorder \n"
|
||||
: : "r" (addr) : "t9"
|
||||
: : "r" (addr) : "$25"
|
||||
);
|
||||
thread_exit();
|
||||
}
|
||||
|
@ -59,18 +59,18 @@ static inline void store_context(void* addr)
|
|||
asm volatile (
|
||||
".set noreorder \n"
|
||||
".set noat \n"
|
||||
"sw $s0, 0(%0) \n" /* s0 */
|
||||
"sw $s1, 4(%0) \n" /* s1 */
|
||||
"sw $s2, 8(%0) \n" /* s2 */
|
||||
"sw $s3, 12(%0) \n" /* s3 */
|
||||
"sw $s4, 16(%0) \n" /* s4 */
|
||||
"sw $s5, 20(%0) \n" /* s5 */
|
||||
"sw $s6, 24(%0) \n" /* s6 */
|
||||
"sw $s7, 28(%0) \n" /* s7 */
|
||||
"sw $gp, 32(%0) \n" /* gp */
|
||||
"sw $fp, 36(%0) \n" /* fp */
|
||||
"sw $sp, 40(%0) \n" /* sp */
|
||||
"sw $ra, 44(%0) \n" /* ra */
|
||||
"sw $16, 0(%0) \n" /* s0 */
|
||||
"sw $17, 4(%0) \n" /* s1 */
|
||||
"sw $18, 8(%0) \n" /* s2 */
|
||||
"sw $19, 12(%0) \n" /* s3 */
|
||||
"sw $20, 16(%0) \n" /* s4 */
|
||||
"sw $21, 20(%0) \n" /* s5 */
|
||||
"sw $22, 24(%0) \n" /* s6 */
|
||||
"sw $23, 28(%0) \n" /* s7 */
|
||||
"sw $28, 32(%0) \n" /* gp */
|
||||
"sw $30, 36(%0) \n" /* fp */
|
||||
"sw $29, 40(%0) \n" /* sp */
|
||||
"sw $31, 44(%0) \n" /* ra */
|
||||
".set at \n"
|
||||
".set reorder \n"
|
||||
: : "r" (addr)
|
||||
|
@ -86,27 +86,27 @@ static inline void load_context(const void* addr)
|
|||
asm volatile (
|
||||
".set noat \n"
|
||||
".set noreorder \n"
|
||||
"lw $t9, 48(%0) \n" /* Get start address ($8 = t0) */
|
||||
"beqz $t9, running \n" /* NULL -> already running */
|
||||
"lw $25, 48(%0) \n" /* Get start address (t9 = $25) */
|
||||
"beqz $25, running \n" /* NULL -> already running */
|
||||
"nop \n"
|
||||
"jr $t9 \n"
|
||||
"move $a0, %0 \n" /* a0 = context branch delay slot anyway */
|
||||
"jr $25 \n"
|
||||
"move $4, %0 \n" /* a0 = context branch delay slot anyway */
|
||||
"running: \n"
|
||||
"lw $s0, 0(%0) \n" /* s0 */
|
||||
"lw $s1, 4(%0) \n" /* s1 */
|
||||
"lw $s2, 8(%0) \n" /* s2 */
|
||||
"lw $s3, 12(%0) \n" /* s3 */
|
||||
"lw $s4, 16(%0) \n" /* s4 */
|
||||
"lw $s5, 20(%0) \n" /* s5 */
|
||||
"lw $s6, 24(%0) \n" /* s6 */
|
||||
"lw $s7, 28(%0) \n" /* s7 */
|
||||
"lw $gp, 32(%0) \n" /* gp */
|
||||
"lw $fp, 36(%0) \n" /* fp */
|
||||
"lw $sp, 40(%0) \n" /* sp */
|
||||
"lw $ra, 44(%0) \n" /* ra */
|
||||
"lw $16, 0(%0) \n" /* s0 */
|
||||
"lw $17, 4(%0) \n" /* s1 */
|
||||
"lw $18, 8(%0) \n" /* s2 */
|
||||
"lw $19, 12(%0) \n" /* s3 */
|
||||
"lw $20, 16(%0) \n" /* s4 */
|
||||
"lw $21, 20(%0) \n" /* s5 */
|
||||
"lw $22, 24(%0) \n" /* s6 */
|
||||
"lw $23, 28(%0) \n" /* s7 */
|
||||
"lw $28, 32(%0) \n" /* gp */
|
||||
"lw $30, 36(%0) \n" /* fp */
|
||||
"lw $29, 40(%0) \n" /* sp */
|
||||
"lw $31, 44(%0) \n" /* ra */
|
||||
".set at \n"
|
||||
".set reorder \n"
|
||||
: : "r" (addr) : "t9"
|
||||
: : "r" (addr) : "$25"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue