Ignore:
File:
1 edited

Legend:

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

    rc0699467 rae0300b5  
    3939#include <proc/thread.h>
    4040#include <proc/task.h>
     41#include <proc/uarg.h>
    4142#include <mm/frame.h>
    4243#include <mm/page.h>
     
    4445#include <arch/cycle.h>
    4546#include <arch.h>
     47#include <synch/synch.h>
    4648#include <synch/spinlock.h>
    4749#include <synch/waitq.h>
     
    5355#include <time/clock.h>
    5456#include <time/timeout.h>
    55 #include <time/delay.h>
    5657#include <config.h>
    5758#include <arch/interrupt.h>
     
    6667#include <syscall/copy.h>
    6768#include <errno.h>
     69
     70
     71#ifndef LOADED_PROG_STACK_PAGES_NO
     72#define LOADED_PROG_STACK_PAGES_NO 1
     73#endif
     74
    6875
    6976/** Thread states */
     
    258265         */
    259266       
    260         list_append(&thread->rq_link, &cpu->rq[i].rq);
     267        list_append(&thread->rq_link, &cpu->rq[i].rq_head);
    261268        cpu->rq[i].n++;
    262269        irq_spinlock_unlock(&(cpu->rq[i].lock), true);
     
    293300       
    294301        /* Not needed, but good for debugging */
    295         memsetb(thread->kstack, STACK_SIZE, 0);
     302        memsetb(thread->kstack, THREAD_STACK_SIZE * 1 << STACK_FRAMES, 0);
    296303       
    297304        irq_spinlock_lock(&tidlock, true);
     
    301308        context_save(&thread->saved_context);
    302309        context_set(&thread->saved_context, FADDR(cushion),
    303             (uintptr_t) thread->kstack, STACK_SIZE);
     310            (uintptr_t) thread->kstack, THREAD_STACK_SIZE);
    304311       
    305312        the_initialize((the_t *) thread->kstack);
     
    320327        thread->cpu = NULL;
    321328        thread->flags = flags;
    322         thread->nomigrate = 0;
    323329        thread->state = Entering;
    324330       
     
    421427                atomic_inc(&task->lifecount);
    422428       
    423         list_append(&thread->th_link, &task->threads);
     429        list_append(&thread->th_link, &task->th_head);
    424430       
    425431        irq_spinlock_pass(&task->lock, &threads_lock);
     
    483489}
    484490
    485 /** Prevent the current thread from being migrated to another processor. */
    486 void thread_migration_disable(void)
    487 {
    488         ASSERT(THREAD);
    489 
    490         THREAD->nomigrate++;
    491 }
    492 
    493 /** Allow the current thread to be migrated to another processor. */
    494 void thread_migration_enable(void)
    495 {
    496         ASSERT(THREAD);
    497         ASSERT(THREAD->nomigrate > 0);
    498 
    499         THREAD->nomigrate--;
    500 }
    501 
    502491/** Thread sleep
    503492 *
     
    616605                printf("%-8" PRIu64 " %-14s %10p %-8s %10p %-5" PRIu32 "\n",
    617606                    thread->tid, name, thread, thread_states[thread->state],
    618                     thread->task, thread->task->container);
     607                    thread->task, thread->task->context);
    619608#endif
    620609       
     
    628617                printf("%-8" PRIu64 " %-14s %18p %-8s %18p %-5" PRIu32 "\n",
    629618                    thread->tid, name, thread, thread_states[thread->state],
    630                     thread->task, thread->task->container);
     619                    thread->task, thread->task->context);
    631620#endif
    632621       
     
    669658        else
    670659                printf("[id    ] [name        ] [address ] [state ] [task    ]"
    671                     " [ctn]\n");
     660                    " [ctx]\n");
    672661#endif
    673662       
     
    678667        } else
    679668                printf("[id    ] [name        ] [address         ] [state ]"
    680                     " [task            ] [ctn]\n");
     669                    " [task            ] [ctx]\n");
    681670#endif
    682671       
     
    929918}
    930919
    931 sysarg_t sys_thread_udelay(uint32_t usec)
    932 {
    933         delay(usec);
    934         return 0;
    935 }
    936 
    937920/** @}
    938921 */
Note: See TracChangeset for help on using the changeset viewer.