Subversion Repositories HelenOS

Rev

Rev 2144 | Rev 2272 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2144 Rev 2170
Line 40... Line 40...
40
#include <config.h>
40
#include <config.h>
41
 
41
 
42
#ifdef CONFIG_TSB
42
#ifdef CONFIG_TSB
43
#include <arch/mm/tsb.h>
43
#include <arch/mm/tsb.h>
44
#include <arch/memstr.h>
44
#include <arch/memstr.h>
45
#include <synch/mutex.h>
-
 
46
#include <arch/asm.h>
45
#include <arch/asm.h>
47
#include <mm/frame.h>
46
#include <mm/frame.h>
48
#include <bitops.h>
47
#include <bitops.h>
49
#include <macros.h>
48
#include <macros.h>
50
#endif /* CONFIG_TSB */
49
#endif /* CONFIG_TSB */
Line 98... Line 97...
98
}
97
}
99
 
98
 
100
int as_create_arch(as_t *as, int flags)
99
int as_create_arch(as_t *as, int flags)
101
{
100
{
102
#ifdef CONFIG_TSB
101
#ifdef CONFIG_TSB
103
    ipl_t ipl;
-
 
104
 
-
 
105
    ipl = interrupts_disable();
-
 
106
    mutex_lock_active(&as->lock);   /* completely unnecessary, but polite */
-
 
107
    tsb_invalidate(as, 0, (count_t) -1);
102
    tsb_invalidate(as, 0, (count_t) -1);
108
    mutex_unlock(&as->lock);
-
 
109
    interrupts_restore(ipl);
-
 
110
#endif
103
#endif
111
    return 0;
104
    return 0;
112
}
105
}
113
 
106
 
114
/** Perform sparc64-specific tasks when an address space becomes active on the
107
/** Perform sparc64-specific tasks when an address space becomes active on the
Line 121... Line 114...
121
void as_install_arch(as_t *as)
114
void as_install_arch(as_t *as)
122
{
115
{
123
    tlb_context_reg_t ctx;
116
    tlb_context_reg_t ctx;
124
   
117
   
125
    /*
118
    /*
126
     * Note that we don't lock the address space.
119
     * Note that we don't and may not lock the address space. That's ok
127
     * That's correct - we can afford it here
-
 
128
     * because we only read members that are
120
     * since we only read members that are currently read-only.
-
 
121
     *
129
     * currently read-only.
122
     * Moreover, the as->asid is protected by asidlock, which is being held.
130
     */
123
     */
131
   
124
   
132
    /*
125
    /*
133
     * Write ASID to secondary context register.
126
     * Write ASID to secondary context register. The primary context
134
     * The primary context register has to be set
-
 
135
     * from TL>0 so it will be filled from the
127
     * register has to be set from TL>0 so it will be filled from the
136
     * secondary context register from the TL=1
128
     * secondary context register from the TL=1 code just before switch to
137
     * code just before switch to userspace.
129
     * userspace.
138
     */
130
     */
139
    ctx.v = 0;
131
    ctx.v = 0;
140
    ctx.context = as->asid;
132
    ctx.context = as->asid;
141
    mmu_secondary_context_write(ctx.v);
133
    mmu_secondary_context_write(ctx.v);
142
 
134
 
Line 182... Line 174...
182
 */
174
 */
183
void as_deinstall_arch(as_t *as)
175
void as_deinstall_arch(as_t *as)
184
{
176
{
185
 
177
 
186
    /*
178
    /*
187
     * Note that we don't lock the address space.
179
     * Note that we don't and may not lock the address space. That's ok
188
     * That's correct - we can afford it here
-
 
189
     * because we only read members that are
180
     * since we only read members that are currently read-only.
-
 
181
     *
190
     * currently read-only.
182
     * Moreover, the as->asid is protected by asidlock, which is being held.
191
     */
183
     */
192
 
184
 
193
#ifdef CONFIG_TSB
185
#ifdef CONFIG_TSB
194
    uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
186
    uintptr_t base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
195
 
187