Subversion Repositories HelenOS-historic

Rev

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

Rev 912 Rev 916
Line 29... Line 29...
29
#include <proc/scheduler.h>
29
#include <proc/scheduler.h>
30
#include <proc/thread.h>
30
#include <proc/thread.h>
31
#include <arch.h>
31
#include <arch.h>
32
#include <arch/register.h>
32
#include <arch/register.h>
33
#include <arch/context.h>
33
#include <arch/context.h>
-
 
34
#include <arch/stack.h>
34
#include <arch/mm/tlb.h>
35
#include <arch/mm/tlb.h>
35
#include <config.h>
36
#include <config.h>
36
#include <align.h>
37
#include <align.h>
37
 
38
 
38
/** Record kernel stack address in bank 0 r23 and make sure it is mapped in DTR. */
39
/** Prepare kernel stack pointers in bank 0 r22 and r23 and make sure the stack is mapped in DTR. */
39
void before_thread_runs_arch(void)
40
void before_thread_runs_arch(void)
40
{
41
{
41
    __address base;
42
    __address base;
42
   
43
   
43
    base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH);
44
    base = ALIGN_DOWN(config.base, 1<<KERNEL_PAGE_WIDTH);
Line 49... Line 50...
49
         */
50
         */
50
         dtlb_kernel_mapping_insert((__address) THREAD->kstack, KA2PA(THREAD->kstack), true, DTR_KSTACK);
51
         dtlb_kernel_mapping_insert((__address) THREAD->kstack, KA2PA(THREAD->kstack), true, DTR_KSTACK);
51
    }
52
    }
52
   
53
   
53
    /*
54
    /*
-
 
55
     * Record address of kernel backing store to bank 0 r22.
54
     * Record address of kernel stack to bank 0 r23
56
     * Record address of kernel stack to bank 0 r23.
55
     * where it will be found after switch from userspace.
57
     * These values will be found there after switch from userspace.
56
     */
58
     */
57
    __asm__ volatile (
59
    __asm__ volatile (
58
        "bsw.0\n"
60
        "bsw.0\n"
-
 
61
        "mov r22 = %0\n"
59
        "mov r23 = %0\n"
62
        "mov r23 = %1\n"
60
        "bsw.1\n"
63
        "bsw.1\n"
-
 
64
        :
-
 
65
        : "r" (((__address) THREAD->kstack) + ALIGN_UP(sizeof(the_t), REGISTER_STACK_ALIGNMENT)),
61
         : : "r" (&THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA]));
66
          "r" (&THREAD->kstack[THREAD_STACK_SIZE - SP_DELTA]));
62
}
67
}
63
 
68
 
64
void after_thread_ran_arch(void)
69
void after_thread_ran_arch(void)
65
{
70
{
66
}
71
}