Subversion Repositories HelenOS-historic

Rev

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

Rev 1059 Rev 1066
Line 39... Line 39...
39
#include <arch/mm/page.h>
39
#include <arch/mm/page.h>
40
#include <mm/as.h>
40
#include <mm/as.h>
41
#include <config.h>
41
#include <config.h>
42
#include <userspace.h>
42
#include <userspace.h>
43
#include <console/console.h>
43
#include <console/console.h>
-
 
44
#include <proc/thread.h>
44
 
45
 
45
void arch_pre_mm_init(void)
46
void arch_pre_mm_init(void)
46
{
47
{
47
    /* Set Interruption Vector Address (i.e. location of interruption vector table). */
48
    /* Set Interruption Vector Address (i.e. location of interruption vector table). */
48
    iva_write((__address) &ivt);
49
    iva_write((__address) &ivt);
Line 70... Line 71...
70
void arch_post_smp_init(void)
71
void arch_post_smp_init(void)
71
{
72
{
72
}
73
}
73
 
74
 
74
/** Enter userspace and never return. */
75
/** Enter userspace and never return. */
75
void userspace(__address entry)
76
void userspace(uspace_arg_t *uarg)
76
{
77
{
77
    psr_t psr;
78
    psr_t psr;
78
    rsc_t rsc;
79
    rsc_t rsc;
79
 
80
 
80
    psr.value = psr_read();
81
    psr.value = psr_read();
Line 88... Line 89...
88
    rsc.loadrs = 0;
89
    rsc.loadrs = 0;
89
    rsc.be = false;
90
    rsc.be = false;
90
    rsc.pl = PL_USER;
91
    rsc.pl = PL_USER;
91
    rsc.mode = 3;               /* eager mode */
92
    rsc.mode = 3;               /* eager mode */
92
 
93
 
93
    switch_to_userspace(entry, USTACK_ADDRESS+PAGE_SIZE-ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT), USTACK_ADDRESS, psr.value, rsc.value);
94
    switch_to_userspace(uarg->uspace_entry, uarg->uspace_stack+PAGE_SIZE-ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT), uarg->uspace_stack, psr.value, rsc.value);
94
 
95
 
95
    while (1) {
96
    while (1) {
96
        ;
97
        ;
97
    }
98
    }
98
}
99
}