Subversion Repositories HelenOS

Rev

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

Rev 3386 Rev 4153
Line 77... Line 77...
77
{
77
{
78
    void *faddr;
78
    void *faddr;
79
 
79
 
80
    faddr = frame_alloc(ONE_FRAME, FRAME_ATOMIC);
80
    faddr = frame_alloc(ONE_FRAME, FRAME_ATOMIC);
81
    if (!faddr)
81
    if (!faddr)
82
        panic("Cannot allocate page for clock");
82
        panic("Cannot allocate page for clock.");
83
   
83
   
84
    uptime = (uptime_t *) PA2KA(faddr);
84
    uptime = (uptime_t *) PA2KA(faddr);
85
   
85
   
86
    uptime->seconds1 = 0;
86
    uptime->seconds1 = 0;
87
    uptime->seconds2 = 0;
87
    uptime->seconds2 = 0;
88
    uptime->useconds = 0;
88
    uptime->useconds = 0;
89
 
89
 
90
    clock_parea.pbase = (uintptr_t) faddr;
90
    clock_parea.pbase = (uintptr_t) faddr;
91
    clock_parea.vbase = (uintptr_t) uptime;
-
 
92
    clock_parea.frames = 1;
91
    clock_parea.frames = 1;
93
    clock_parea.cacheable = true;
-
 
94
    ddi_parea_register(&clock_parea);
92
    ddi_parea_register(&clock_parea);
95
 
93
 
96
    /*
94
    /*
97
     * Prepare information for the userspace so that it can successfully
95
     * Prepare information for the userspace so that it can successfully
98
     * physmem_map() the clock_parea.
96
     * physmem_map() the clock_parea.
Line 187... Line 185...
187
                THREAD->ticks = 0;
185
                THREAD->ticks = 0;
188
        }
186
        }
189
        spinlock_unlock(&THREAD->lock);
187
        spinlock_unlock(&THREAD->lock);
190
       
188
       
191
        if (!ticks && !PREEMPTION_DISABLED) {
189
        if (!ticks && !PREEMPTION_DISABLED) {
-
 
190
#ifdef CONFIG_UDEBUG
-
 
191
            istate_t *istate;
-
 
192
#endif
192
            scheduler();
193
            scheduler();
-
 
194
#ifdef CONFIG_UDEBUG
-
 
195
            /*
-
 
196
             * Give udebug chance to stop the thread
-
 
197
             * before it begins executing userspace code.
-
 
198
             */
-
 
199
            istate = THREAD->udebug.uspace_state;
-
 
200
            if (istate && istate_from_uspace(istate))
-
 
201
                udebug_before_thread_runs();
-
 
202
#endif
193
        }
203
        }
194
    }
204
    }
195
 
205
 
196
}
206
}
197
 
207