Subversion Repositories HelenOS

Rev

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

Rev 2091 Rev 2107
Line 134... Line 134...
134
 * @param t Microseconds to wait.
134
 * @param t Microseconds to wait.
135
 */
135
 */
136
void asm_delay_loop(const uint32_t usec)
136
void asm_delay_loop(const uint32_t usec)
137
{
137
{
138
    uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t)
138
    uint64_t stop = tick_read() + (uint64_t) usec * (uint64_t)
139
        CPU->arch.clock_frequency / 1000000;
139
        CPU->arch.clock_frequency / 1000000;
140
 
140
 
141
    while (tick_read() < stop)
141
    while (tick_read() < stop)
142
        ;
142
        ;
143
}
143
}
144
 
144
 
145
/** Switch to userspace. */
145
/** Switch to userspace. */
146
void userspace(uspace_arg_t *kernel_uarg)
146
void userspace(uspace_arg_t *kernel_uarg)
147
{
147
{
148
    switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
148
    switch_to_userspace((uintptr_t) kernel_uarg->uspace_entry,
149
        ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE
149
        ((uintptr_t) kernel_uarg->uspace_stack) + STACK_SIZE
150
        - (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS),
150
        - (ALIGN_UP(STACK_ITEM_SIZE, STACK_ALIGNMENT) + STACK_BIAS),
151
        (uintptr_t) kernel_uarg->uspace_uarg);
151
        (uintptr_t) kernel_uarg->uspace_uarg);
152
 
152
 
153
    for (;;)
153
    for (;;)
154
        ;
154
        ;
155
    /* not reached */
155
    /* not reached */
156
}
156
}