Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    re7c4115d r8ad7dd1  
    3636 */
    3737
    38 #include <assert.h>
    3938#include <proc/scheduler.h>
    4039#include <proc/thread.h>
     
    6261#include <arch/faddr.h>
    6362#include <atomic.h>
    64 #include <mem.h>
     63#include <memstr.h>
    6564#include <print.h>
    6665#include <mm/slab.h>
     66#include <debug.h>
    6767#include <main/uinit.h>
    6868#include <syscall/copy.h>
     
    228228#endif
    229229       
    230         return STACK_FRAMES;  /* number of frames freed */
     230        return 1;  /* One page freed */
    231231}
    232232
     
    268268static void before_thread_is_ready(thread_t *thread)
    269269{
    270         assert(irq_spinlock_locked(&thread->lock));
     270        ASSERT(irq_spinlock_locked(&thread->lock));
    271271        workq_before_thread_is_ready(thread);
    272272}
     
    283283        irq_spinlock_lock(&thread->lock, true);
    284284       
    285         assert(thread->state != Ready);
     285        ASSERT(thread->state != Ready);
    286286
    287287        before_thread_is_ready(thread);
     
    293293        if (thread->wired || thread->nomigrate || thread->fpu_context_engaged) {
    294294                /* Cannot ready to another CPU */
    295                 assert(thread->cpu != NULL);
     295                ASSERT(thread->cpu != NULL);
    296296                cpu = thread->cpu;
    297297        } else if (thread->stolen) {
     
    300300        } else if (thread->cpu) {
    301301                /* Prefer the CPU on which the thread ran last */
    302                 assert(thread->cpu != NULL);
     302                ASSERT(thread->cpu != NULL);
    303303                cpu = thread->cpu;
    304304        } else {
     
    431431void thread_destroy(thread_t *thread, bool irq_res)
    432432{
    433         assert(irq_spinlock_locked(&thread->lock));
    434         assert((thread->state == Exiting) || (thread->state == Lingering));
    435         assert(thread->task);
    436         assert(thread->cpu);
     433        ASSERT(irq_spinlock_locked(&thread->lock));
     434        ASSERT((thread->state == Exiting) || (thread->state == Lingering));
     435        ASSERT(thread->task);
     436        ASSERT(thread->cpu);
    437437       
    438438        irq_spinlock_lock(&thread->cpu->lock, false);
     
    561561void thread_interrupt(thread_t *thread)
    562562{
    563         assert(thread != NULL);
     563        ASSERT(thread != NULL);
    564564       
    565565        irq_spinlock_lock(&thread->lock, true);
     
    582582bool thread_interrupted(thread_t *thread)
    583583{
    584         assert(thread != NULL);
     584        ASSERT(thread != NULL);
    585585       
    586586        bool interrupted;
     
    596596void thread_migration_disable(void)
    597597{
    598         assert(THREAD);
     598        ASSERT(THREAD);
    599599       
    600600        THREAD->nomigrate++;
     
    604604void thread_migration_enable(void)
    605605{
    606         assert(THREAD);
    607         assert(THREAD->nomigrate > 0);
     606        ASSERT(THREAD);
     607        ASSERT(THREAD->nomigrate > 0);
    608608       
    609609        if (THREAD->nomigrate > 0)
     
    650650       
    651651        irq_spinlock_lock(&thread->lock, true);
    652         assert(!thread->detached);
     652        ASSERT(!thread->detached);
    653653        irq_spinlock_unlock(&thread->lock, true);
    654654       
     
    671671         */
    672672        irq_spinlock_lock(&thread->lock, true);
    673         assert(!thread->detached);
     673        ASSERT(!thread->detached);
    674674       
    675675        if (thread->state == Lingering) {
     
    809809bool thread_exists(thread_t *thread)
    810810{
    811         assert(interrupts_disabled());
    812         assert(irq_spinlock_locked(&threads_lock));
     811        ASSERT(interrupts_disabled());
     812        ASSERT(irq_spinlock_locked(&threads_lock));
    813813
    814814        avltree_node_t *node =
     
    830830        uint64_t time = get_cycle();
    831831
    832         assert(interrupts_disabled());
    833         assert(irq_spinlock_locked(&THREAD->lock));
     832        ASSERT(interrupts_disabled());
     833        ASSERT(irq_spinlock_locked(&THREAD->lock));
    834834       
    835835        if (user)
     
    867867thread_t *thread_find_by_id(thread_id_t thread_id)
    868868{
    869         assert(interrupts_disabled());
    870         assert(irq_spinlock_locked(&threads_lock));
     869        ASSERT(interrupts_disabled());
     870        ASSERT(irq_spinlock_locked(&threads_lock));
    871871       
    872872        thread_iterator_t iterator;
Note: See TracChangeset for help on using the changeset viewer.