Subversion Repositories HelenOS

Rev

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

Rev 718 Rev 727
Line 31... Line 31...
31
 * Roughly speaking, this is a higher-level client of
31
 * Roughly speaking, this is a higher-level client of
32
 * Virtual Address Translation (VAT) subsystem.
32
 * Virtual Address Translation (VAT) subsystem.
33
 */
33
 */
34
 
34
 
35
#include <mm/as.h>
35
#include <mm/as.h>
-
 
36
#include <mm/asid.h>
36
#include <mm/page.h>
37
#include <mm/page.h>
37
#include <mm/frame.h>
38
#include <mm/frame.h>
38
#include <mm/tlb.h>
39
#include <mm/tlb.h>
39
#include <mm/heap.h>
40
#include <mm/heap.h>
40
#include <arch/mm/page.h>
41
#include <arch/mm/page.h>
41
#include <genarch/mm/page_pt.h>
42
#include <genarch/mm/page_pt.h>
-
 
43
#include <mm/asid.h>
42
#include <arch/mm/asid.h>
44
#include <arch/mm/asid.h>
43
#include <arch/mm/as.h>
45
#include <arch/mm/as.h>
44
#include <arch/types.h>
46
#include <arch/types.h>
45
#include <typedefs.h>
47
#include <typedefs.h>
46
#include <synch/spinlock.h>
48
#include <synch/spinlock.h>
Line 68... Line 70...
68
/** Create address space. */
70
/** Create address space. */
69
/*
71
/*
70
 * FIXME: this interface must be meaningful for all possible VAT
72
 * FIXME: this interface must be meaningful for all possible VAT
71
 *    (Virtual Address Translation) mechanisms.
73
 *    (Virtual Address Translation) mechanisms.
72
 */
74
 */
73
as_t *as_create(pte_t *ptl0)
75
as_t *as_create(pte_t *ptl0, int flags)
74
{
76
{
75
    as_t *as;
77
    as_t *as;
76
 
78
 
77
    as = (as_t *) malloc(sizeof(as_t));
79
    as = (as_t *) malloc(sizeof(as_t));
78
    if (as) {
80
    if (as) {
-
 
81
        list_initialize(&as->as_with_asid_link);
79
        spinlock_initialize(&as->lock, "as_lock");
82
        spinlock_initialize(&as->lock, "as_lock");
80
        list_initialize(&as->as_area_head);
83
        list_initialize(&as->as_area_head);
81
 
84
 
-
 
85
        if (flags & AS_KERNEL)
82
        as->asid = asid_get();
86
            as->asid = ASID_KERNEL;
-
 
87
        else
-
 
88
            as->asid = ASID_INVALID;
83
 
89
 
84
        as->ptl0 = ptl0;
90
        as->ptl0 = ptl0;
85
        if (!as->ptl0) {
91
        if (!as->ptl0) {
86
            pte_t *src_ptl0, *dst_ptl0;
92
            pte_t *src_ptl0, *dst_ptl0;
87
       
93
       
Line 287... Line 293...
287
 */
293
 */
288
void as_install(as_t *as)
294
void as_install(as_t *as)
289
{
295
{
290
    ipl_t ipl;
296
    ipl_t ipl;
291
   
297
   
-
 
298
    asid_install(as);
-
 
299
   
292
    ipl = interrupts_disable();
300
    ipl = interrupts_disable();
293
    spinlock_lock(&as->lock);
301
    spinlock_lock(&as->lock);
294
    ASSERT(as->ptl0);
302
    ASSERT(as->ptl0);
295
    SET_PTL0_ADDRESS(as->ptl0);
303
    SET_PTL0_ADDRESS(as->ptl0);
296
    spinlock_unlock(&as->lock);
304
    spinlock_unlock(&as->lock);
297
    interrupts_restore(ipl);
305
    interrupts_restore(ipl);
298
 
306
 
299
    /*
307
    /*
300
     * Perform architecture-specific steps.
308
     * Perform architecture-specific steps.
301
     * (e.g. invalidate TLB, install ASID etc.)
309
     * (e.g. write ASID to hardware register etc.)
302
     */
310
     */
303
    as_install_arch(as);
311
    as_install_arch(as);
304
   
312
   
305
    AS = as;
313
    AS = as;
306
}
314
}