26,38 → 26,29 |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
|
#include <arch/mm/as.h> |
#include <arch/mm/vm.h> |
#include <arch/mm/tlb.h> |
#include <mm/tlb.h> |
#include <mm/as.h> |
#include <mm/vm.h> |
#include <arch/cp0.h> |
#include <arch.h> |
|
/** Install address space. |
/** Install ASID of the current VM |
* |
* Install ASID and if necessary, purge TLB. |
* Install ASID of the current VM. |
* |
* @param as Address space structure. |
* @param vm VM structure. |
*/ |
void as_install_arch(as_t *as) |
void vm_install_arch(vm_t *vm) |
{ |
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(&as->lock); |
hi.asid = as->asid; |
spinlock_lock(&vm->lock); |
hi.asid = vm->asid; |
cp0_entry_hi_write(hi.value); |
spinlock_unlock(&as->lock); |
spinlock_unlock(&vm->lock); |
interrupts_restore(ipl); |
} |