Subversion Repositories HelenOS-historic

Rev

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

Rev 1742 Rev 1780
Line 69... Line 69...
69
 
69
 
70
 
70
 
71
/* Why the linker moves the variable 64K away in assembler
71
/* Why the linker moves the variable 64K away in assembler
72
 * when not in .text section ????????
72
 * when not in .text section ????????
73
 */
73
 */
74
__address supervisor_sp __attribute__ ((section (".text")));
74
uintptr_t supervisor_sp __attribute__ ((section (".text")));
75
/* Stack pointer saved when entering user mode */
75
/* Stack pointer saved when entering user mode */
76
/* TODO: How do we do it on SMP system???? */
76
/* TODO: How do we do it on SMP system???? */
77
bootinfo_t bootinfo __attribute__ ((section (".text")));
77
bootinfo_t bootinfo __attribute__ ((section (".text")));
78
 
78
 
79
void arch_pre_main(void)
79
void arch_pre_main(void)
80
{
80
{
81
    /* Setup usermode */
81
    /* Setup usermode */
82
    init.cnt = bootinfo.cnt;
82
    init.cnt = bootinfo.cnt;
83
   
83
   
84
    __u32 i;
84
    uint32_t i;
85
   
85
   
86
    for (i = 0; i < bootinfo.cnt; i++) {
86
    for (i = 0; i < bootinfo.cnt; i++) {
87
        init.tasks[i].addr = bootinfo.tasks[i].addr;
87
        init.tasks[i].addr = bootinfo.tasks[i].addr;
88
        init.tasks[i].size = bootinfo.tasks[i].size;
88
        init.tasks[i].size = bootinfo.tasks[i].size;
89
    }
89
    }
Line 144... Line 144...
144
{
144
{
145
    /* EXL=1, UM=1, IE=1 */
145
    /* EXL=1, UM=1, IE=1 */
146
    cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit |
146
    cp0_status_write(cp0_status_read() | (cp0_status_exl_exception_bit |
147
                          cp0_status_um_bit |
147
                          cp0_status_um_bit |
148
                          cp0_status_ie_enabled_bit));
148
                          cp0_status_ie_enabled_bit));
149
    cp0_epc_write((__address) kernel_uarg->uspace_entry);
149
    cp0_epc_write((uintptr_t) kernel_uarg->uspace_entry);
150
    userspace_asm(((__address) kernel_uarg->uspace_stack+PAGE_SIZE),
150
    userspace_asm(((uintptr_t) kernel_uarg->uspace_stack+PAGE_SIZE),
151
              (__address) kernel_uarg->uspace_uarg,
151
              (uintptr_t) kernel_uarg->uspace_uarg,
152
              (__address) kernel_uarg->uspace_entry);
152
              (uintptr_t) kernel_uarg->uspace_entry);
153
    while (1)
153
    while (1)
154
        ;
154
        ;
155
}
155
}
156
 
156
 
157
/** Perform mips32 specific tasks needed before the new task is run. */
157
/** Perform mips32 specific tasks needed before the new task is run. */
Line 160... Line 160...
160
}
160
}
161
 
161
 
162
/** Perform mips32 specific tasks needed before the new thread is scheduled. */
162
/** Perform mips32 specific tasks needed before the new thread is scheduled. */
163
void before_thread_runs_arch(void)
163
void before_thread_runs_arch(void)
164
{
164
{
165
    supervisor_sp = (__address) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA];
165
    supervisor_sp = (uintptr_t) &THREAD->kstack[THREAD_STACK_SIZE-SP_DELTA];
166
}
166
}
167
 
167
 
168
void after_thread_ran_arch(void)
168
void after_thread_ran_arch(void)
169
{
169
{
170
}
170
}
Line 172... Line 172...
172
/** Set thread-local-storage pointer
172
/** Set thread-local-storage pointer
173
 *
173
 *
174
 * We have it currently in K1, it is
174
 * We have it currently in K1, it is
175
 * possible to have it separately in the future.
175
 * possible to have it separately in the future.
176
 */
176
 */
177
__native sys_tls_set(__native addr)
177
unative_t sys_tls_set(unative_t addr)
178
{
178
{
179
    return 0;
179
    return 0;
180
}
180
}
181
 
181
 
182
 
182