Subversion Repositories HelenOS-historic

Rev

Rev 595 | Rev 727 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 595 Rev 703
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
#include <arch/mm/vm.h>
29
#include <arch/mm/as.h>
30
#include <arch/mm/tlb.h>
30
#include <arch/mm/tlb.h>
-
 
31
#include <mm/tlb.h>
31
#include <mm/vm.h>
32
#include <mm/as.h>
32
#include <arch/cp0.h>
33
#include <arch/cp0.h>
33
#include <arch.h>
34
#include <arch.h>
34
 
35
 
35
/** Install ASID of the current VM
36
/** Install address space.
36
 *
37
 *
37
 * Install ASID of the current VM.
38
 * Install ASID and if necessary, purge TLB.
38
 *
39
 *
39
 * @param vm VM structure.
40
 * @param as Address space structure.
40
 */
41
 */
41
void vm_install_arch(vm_t *vm)
42
void as_install_arch(as_t *as)
42
{
43
{
43
    entry_hi_t hi;
44
    entry_hi_t hi;
44
    ipl_t ipl;
45
    ipl_t ipl;
45
   
46
 
-
 
47
    /*
-
 
48
     * If necessary, purge TLB.
-
 
49
     */
-
 
50
    tlb_invalidate_asid(as->asid);  /* TODO: do it only if necessary */
-
 
51
 
-
 
52
    /*
-
 
53
     * Install ASID.
-
 
54
     */
46
    hi.value = cp0_entry_hi_read();
55
    hi.value = cp0_entry_hi_read();
47
 
56
 
48
    ipl = interrupts_disable();
57
    ipl = interrupts_disable();
49
    spinlock_lock(&vm->lock);
58
    spinlock_lock(&as->lock);
50
    hi.asid = vm->asid;
59
    hi.asid = as->asid;
51
    cp0_entry_hi_write(hi.value);  
60
    cp0_entry_hi_write(hi.value);  
52
    spinlock_unlock(&vm->lock);
61
    spinlock_unlock(&as->lock);
53
    interrupts_restore(ipl);
62
    interrupts_restore(ipl);
54
}
63
}