Subversion Repositories HelenOS

Rev

Rev 3022 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 45... Line 45...
45
/** Perform ia64 specific tasks needed before the new task is run. */
45
/** Perform ia64 specific tasks needed before the new task is run. */
46
void before_task_runs_arch(void)
46
void before_task_runs_arch(void)
47
{
47
{
48
}
48
}
49
 
49
 
50
/** Prepare kernel stack pointers in bank 0 r22 and r23 and make sure the stack is mapped in DTR. */
50
/** Prepare kernel stack pointers in bank 0 r22 and r23 and make sure the stack
-
 
51
 * is mapped in DTR.
-
 
52
 */
51
void before_thread_runs_arch(void)
53
void before_thread_runs_arch(void)
52
{
54
{
53
    uintptr_t base;
55
    uintptr_t base;
54
   
56
   
55
    base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH);
57
    base = ALIGN_DOWN(config.base, 1 << KERNEL_PAGE_WIDTH);
56
 
58
 
-
 
59
    if ((uintptr_t) THREAD->kstack < base ||
57
    if ((uintptr_t) THREAD->kstack < base || (uintptr_t) THREAD->kstack > base + (1<<(KERNEL_PAGE_WIDTH))) {
60
        (uintptr_t) THREAD->kstack > base + (1 << (KERNEL_PAGE_WIDTH))) {
58
        /*
61
        /*
59
         * Kernel stack of this thread is not mapped by DTR[TR_KERNEL].
62
         * Kernel stack of this thread is not mapped by DTR[TR_KERNEL].
60
         * Use DTR[TR_KSTACK1] and DTR[TR_KSTACK2] to map it.
63
         * Use DTR[TR_KSTACK1] and DTR[TR_KSTACK2] to map it.
61
         */
64
         */
62
         
65
         
63
        /* purge DTR[TR_STACK1] and DTR[TR_STACK2] */
66
        /* purge DTR[TR_STACK1] and DTR[TR_STACK2] */
64
        dtr_purge((uintptr_t) THREAD->kstack, PAGE_WIDTH+1);
67
        dtr_purge((uintptr_t) THREAD->kstack, PAGE_WIDTH+1);
65
       
68
       
66
        /* insert DTR[TR_STACK1] and DTR[TR_STACK2] */
69
        /* insert DTR[TR_STACK1] and DTR[TR_STACK2] */
-
 
70
        dtlb_kernel_mapping_insert((uintptr_t) THREAD->kstack,
-
 
71
            KA2PA(THREAD->kstack), true, DTR_KSTACK1);
67
        dtlb_kernel_mapping_insert((uintptr_t) THREAD->kstack, KA2PA(THREAD->kstack), true, DTR_KSTACK1);
72
        dtlb_kernel_mapping_insert((uintptr_t) THREAD->kstack +
68
        dtlb_kernel_mapping_insert((uintptr_t) THREAD->kstack + PAGE_SIZE, KA2PA(THREAD->kstack) + FRAME_SIZE, true, DTR_KSTACK2);
73
            PAGE_SIZE, KA2PA(THREAD->kstack) + FRAME_SIZE, true,
-
 
74
            DTR_KSTACK2);
69
    }
75
    }
70
   
76
   
71
    /*
77
    /*
72
     * Record address of kernel backing store to bank 0 r22.
78
     * Record address of kernel backing store to bank 0 r22.
73
     * Record address of kernel stack to bank 0 r23.
79
     * Record address of kernel stack to bank 0 r23.