Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 595 → Rev 703

/kernel/trunk/arch/mips32/src/mm/as.c/vm.c
26,29 → 26,38
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <arch/mm/vm.h>
#include <arch/mm/as.h>
#include <arch/mm/tlb.h>
#include <mm/vm.h>
#include <mm/tlb.h>
#include <mm/as.h>
#include <arch/cp0.h>
#include <arch.h>
 
/** Install ASID of the current VM
/** Install address space.
*
* Install ASID of the current VM.
* Install ASID and if necessary, purge TLB.
*
* @param vm VM structure.
* @param as Address space structure.
*/
void vm_install_arch(vm_t *vm)
void as_install_arch(as_t *as)
{
entry_hi_t hi;
ipl_t ipl;
 
/*
* If necessary, purge TLB.
*/
tlb_invalidate_asid(as->asid); /* TODO: do it only if necessary */
 
/*
* Install ASID.
*/
hi.value = cp0_entry_hi_read();
 
ipl = interrupts_disable();
spinlock_lock(&vm->lock);
hi.asid = vm->asid;
spinlock_lock(&as->lock);
hi.asid = as->asid;
cp0_entry_hi_write(hi.value);
spinlock_unlock(&vm->lock);
spinlock_unlock(&as->lock);
interrupts_restore(ipl);
}