Subversion Repositories HelenOS

Rev

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

Rev 125 Rev 313
Line 27... Line 27...
27
 */
27
 */
28
 
28
 
29
#include <arch.h>
29
#include <arch.h>
30
#include <arch/cp0.h>
30
#include <arch/cp0.h>
31
#include <arch/exception.h>
31
#include <arch/exception.h>
-
 
32
#include <arch/asm/regname.h>
-
 
33
#include <arch/asm.h>
-
 
34
#include <mm/vm.h>
-
 
35
#include <userspace.h>
32
 
36
 
33
void arch_pre_mm_init(void)
37
void arch_pre_mm_init(void)
34
{
38
{
35
    /*
39
    /*
36
     * Switch to BEV normal level so that exception vectors point to the kernel.
40
     * Switch to BEV normal level so that exception vectors point to the kernel.
Line 55... Line 59...
55
}
59
}
56
 
60
 
57
void arch_late_init(void)
61
void arch_late_init(void)
58
{
62
{
59
}
63
}
-
 
64
 
-
 
65
void userspace(void)
-
 
66
{
-
 
67
    /* EXL=1, UM=1, IE=1 */
-
 
68
    cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit |
-
 
69
                          cp0_status_um_bit |
-
 
70
                          cp0_status_ie_enabled_bit));
-
 
71
   
-
 
72
    cp0_epc_write(UTEXT_ADDRESS);
-
 
73
    userspace_asm(USTACK_ADDRESS+PAGE_SIZE);
-
 
74
    while (1)
-
 
75
        ;
-
 
76
}
-
 
77
 
-
 
78
/* Stack pointer saved when entering user mode */
-
 
79
/* TODO: How do we do it on SMP system???? */
-
 
80
__address supervisor_sp;
-
 
81
 
-
 
82
void before_thread_runs_arch(void)
-
 
83
{
-
 
84
    supervisor_sp = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA];
-
 
85
}
-
 
86
 
-
 
87