2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* r2300_switch.S: R2300 specific task switching code.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1994, 1995, 1996, 1999 by Ralf Baechle
|
|
|
|
* Copyright (C) 1994, 1995, 1996 by Andreas Busse
|
|
|
|
*
|
|
|
|
* Multi-cpu abstraction and macros for easier reading:
|
2011-04-04 21:15:29 +00:00
|
|
|
* Copyright (C) 1996 David S. Miller (davem@davemloft.net)
|
2005-04-16 22:20:36 +00:00
|
|
|
*
|
|
|
|
* Further modifications to make this work:
|
|
|
|
* Copyright (c) 1998-2000 Harald Koerfgen
|
|
|
|
*/
|
|
|
|
#include <asm/asm.h>
|
|
|
|
#include <asm/cachectl.h>
|
2016-11-07 11:14:10 +00:00
|
|
|
#include <asm/export.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/fpregdef.h>
|
|
|
|
#include <asm/mipsregs.h>
|
2005-09-09 20:32:31 +00:00
|
|
|
#include <asm/asm-offsets.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
#include <asm/regdef.h>
|
|
|
|
#include <asm/stackframe.h>
|
|
|
|
#include <asm/thread_info.h>
|
|
|
|
|
|
|
|
#include <asm/asmmacro.h>
|
|
|
|
|
|
|
|
.set mips1
|
|
|
|
.align 5
|
|
|
|
|
|
|
|
/*
|
|
|
|
* task_struct *resume(task_struct *prev, task_struct *next,
|
2015-09-21 17:07:42 +00:00
|
|
|
* struct thread_info *next_ti)
|
2005-04-16 22:20:36 +00:00
|
|
|
*/
|
|
|
|
LEAF(resume)
|
2007-04-13 17:37:26 +00:00
|
|
|
mfc0 t1, CP0_STATUS
|
|
|
|
sw t1, THREAD_STATUS(a0)
|
2005-04-16 22:20:36 +00:00
|
|
|
cpu_save_nonscratch a0
|
|
|
|
sw ra, THREAD_REG31(a0)
|
|
|
|
|
2013-06-17 19:36:07 +00:00
|
|
|
#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
|
2013-10-07 11:14:26 +00:00
|
|
|
PTR_LA t8, __stack_chk_guard
|
2013-06-17 19:36:07 +00:00
|
|
|
LONG_L t9, TASK_STACK_CANARY(a1)
|
|
|
|
LONG_S t9, 0(t8)
|
|
|
|
#endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
* The order of restoring the registers takes care of the race
|
|
|
|
* updating $28, $29 and kernelsp without disabling ints.
|
|
|
|
*/
|
|
|
|
move $28, a2
|
|
|
|
cpu_restore_nonscratch a1
|
|
|
|
|
|
|
|
addiu t1, $28, _THREAD_SIZE - 32
|
|
|
|
sw t1, kernelsp
|
|
|
|
|
|
|
|
mfc0 t1, CP0_STATUS /* Do we really need this? */
|
|
|
|
li a3, 0xff01
|
|
|
|
and t1, a3
|
|
|
|
lw a2, THREAD_STATUS(a1)
|
|
|
|
nor a3, $0, a3
|
|
|
|
and a2, a3
|
|
|
|
or a2, t1
|
|
|
|
mtc0 a2, CP0_STATUS
|
|
|
|
move v0, a0
|
|
|
|
jr ra
|
|
|
|
END(resume)
|