Rev 1888 | Rev 2040 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1888 | Rev 2030 | ||
|---|---|---|---|
| Line 45... | Line 45... | ||
| 45 | #include <mm/page.h> |
45 | #include <mm/page.h> |
| 46 | #include <mm/as.h> |
46 | #include <mm/as.h> |
| 47 | #include <time/delay.h> |
47 | #include <time/delay.h> |
| 48 | #include <arch/asm.h> |
48 | #include <arch/asm.h> |
| 49 | #include <arch/faddr.h> |
49 | #include <arch/faddr.h> |
| - | 50 | #include <arch/cycle.h> |
|
| 50 | #include <atomic.h> |
51 | #include <atomic.h> |
| 51 | #include <synch/spinlock.h> |
52 | #include <synch/spinlock.h> |
| 52 | #include <config.h> |
53 | #include <config.h> |
| 53 | #include <context.h> |
54 | #include <context.h> |
| 54 | #include <func.h> |
55 | #include <func.h> |
| Line 306... | Line 307... | ||
| 306 | if (atomic_get(&haltstate)) |
307 | if (atomic_get(&haltstate)) |
| 307 | halt(); |
308 | halt(); |
| 308 | 309 | ||
| 309 | if (THREAD) { |
310 | if (THREAD) { |
| 310 | spinlock_lock(&THREAD->lock); |
311 | spinlock_lock(&THREAD->lock); |
| - | 312 | ||
| - | 313 | /* Update thread accounting */ |
|
| - | 314 | THREAD->cycles += get_cycle() - THREAD->last_cycle; |
|
| - | 315 | ||
| 311 | #ifndef CONFIG_FPU_LAZY |
316 | #ifndef CONFIG_FPU_LAZY |
| 312 | fpu_context_save(THREAD->saved_fpu_context); |
317 | fpu_context_save(THREAD->saved_fpu_context); |
| 313 | #endif |
318 | #endif |
| 314 | if (!context_save(&THREAD->saved_context)) { |
319 | if (!context_save(&THREAD->saved_context)) { |
| 315 | /* |
320 | /* |
| 316 | * This is the place where threads leave scheduler(); |
321 | * This is the place where threads leave scheduler(); |
| 317 | */ |
322 | */ |
| - | 323 | ||
| - | 324 | /* Save current CPU cycle */ |
|
| - | 325 | THREAD->last_cycle = get_cycle(); |
|
| - | 326 | ||
| 318 | spinlock_unlock(&THREAD->lock); |
327 | spinlock_unlock(&THREAD->lock); |
| 319 | interrupts_restore(THREAD->saved_context.ipl); |
328 | interrupts_restore(THREAD->saved_context.ipl); |
| 320 | 329 | ||
| 321 | return; |
330 | return; |
| 322 | } |
331 | } |