MIPS: don't save gp register when switching threads

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20863 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Maurus Cuelenaere 2009-05-06 19:51:34 +00:00
parent 84ea3f2530
commit 580b1a5c4b
2 changed files with 18 additions and 21 deletions

View file

@ -109,10 +109,10 @@ struct regs
#elif defined(CPU_MIPS)
struct regs
{
uint32_t r[10]; /* 0-36 - Registers s0-s7, gp, fp */
uint32_t sp; /* 40 - Stack pointer */
uint32_t ra; /* 44 - Return address */
uint32_t start; /* 48 - Thread start address, or NULL when started */
uint32_t r[9]; /* 0-32 - Registers s0-s7, fp */
uint32_t sp; /* 36 - Stack pointer */
uint32_t ra; /* 40 - Return address */
uint32_t start; /* 44 - Thread start address, or NULL when started */
};
#endif /* CONFIG_CPU */
#else

View file

@ -943,12 +943,11 @@ static void __attribute__((used)) _start_thread(void)
".set noreorder \n"
".set noat \n"
"lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */
"lw $29, 40($9) \n" /* Set initial sp(=$29) */
"lw $29, 36($9) \n" /* Set initial sp(=$29) */
"jalr $8 \n" /* Start the thread */
"sw $0, 48($9) \n" /* Clear start address */
"sw $0, 44($9) \n" /* Clear start address */
".set at \n"
".set reorder \n"
::: "t0"
);
thread_exit();
}
@ -977,10 +976,9 @@ static inline void store_context(void* addr)
"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 */
"sw $30, 32(%0) \n" /* fp */
"sw $29, 36(%0) \n" /* sp */
"sw $31, 40(%0) \n" /* ra */
".set at \n"
".set reorder \n"
: : "r" (addr)
@ -996,7 +994,7 @@ static inline void load_context(const void* addr)
asm volatile (
".set noat \n"
".set noreorder \n"
"lw $8, 48(%0) \n" /* Get start address ($8 = t0) */
"lw $8, 44(%0) \n" /* Get start address ($8 = t0) */
"beqz $8, running \n" /* NULL -> already running */
"nop \n"
"jr $8 \n"
@ -1010,10 +1008,9 @@ static inline void load_context(const void* addr)
"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 */
"lw $30, 32(%0) \n" /* fp */
"lw $29, 36(%0) \n" /* sp */
"lw $31, 40(%0) \n" /* ra */
".set at \n"
".set reorder \n"
: : "r" (addr) : "t0", "t1"
@ -1034,9 +1031,9 @@ static inline void core_sleep(void)
"move $9, $8 \n" /* move t1, t0 */
"la $10, 0x8000000 \n" /* la t2, 0x8000000 */
"or $8, $8, $10 \n" /* Enable reduced power mode */
"mtc0 $8, $12 \n"
"mtc0 $8, $12 \n" /* mtc t0, $12 */
"wait \n"
"mtc0 $9, $12 \n"
"mtc0 $9, $12 \n" /* mtc t1, $12 */
".set mips0 \n"
::: "t0", "t1", "t2"
);