#include <cpu/types.h>
#include <cpu/attr.h>
#include <cfg/debug.h>
+#include <cfg/module.h>
#include <cfg/arch_config.h> /* ARCH_EMUL */
#include <cfg/macros.h> /* ABS() */
#endif
}
+MOD_DEFINE(proc);
void proc_init(void)
{
/* Make sure the assembly routine is up-to-date with us */
ASSERT(asm_switch_version() == 1);
+ MOD_INIT(proc);
}
/* Ignore stack provided by caller and use the large enough default instead. */
stack_base = (cpustack_t *)LIST_HEAD(&StackFreeList);
REMOVE(LIST_HEAD(&StackFreeList));
- stacksize = CONFIG_KERN_DEFSTACKSIZE;
+ stacksize = CONFIG_PROC_DEFSTACKSIZE;
#elif CONFIG_KERN_HEAP
/* Did the caller provide a stack for us? */
if (!stack_base)
{
/* Did the caller specify the desired stack size? */
if (!stacksize)
- stacksize = CONFIG_KERN_DEFSTACKSIZE + sizeof(Process);
+ stacksize = CONFIG_PROC_DEFSTACKSIZE + sizeof(Process);
/* Allocate stack dinamically */
if (!(stack_base = heap_alloc(stacksize)))
*/
void proc_schedule(void)
{
- /* This function must not have any "auto" variables, otherwise
- * the compiler might put them on the stack of the process
- * being switched out.
- */
- static struct Process *old_process;
- static cpuflags_t flags;
+ struct Process *old_process;
+ cpuflags_t flags;
/* Remember old process to save its context later */
old_process = CurrentProcess;
*/
if (CurrentProcess != old_process)
{
- static cpustack_t *dummy;
+ cpustack_t *dummy;
#if CONFIG_KERN_PREEMPTIVE
/* Reset quantum for this process */
#warning This is wrong
/* Reinsert process stack in free list */
ADDHEAD(&StackFreeList, (Node *)(CurrentProcess->stack
- - (CONFIG_KERN_DEFSTACKSIZE / sizeof(cpustack_t))));
+ - (CONFIG_PROC_DEFSTACKSIZE / sizeof(cpustack_t))));
/*
* NOTE: At this point the first two words of what used
*/
void proc_switch(void)
{
- /* Just like proc_schedule, this function must not have auto variables. */
- static cpuflags_t flags;
+ cpuflags_t flags;
IRQ_SAVE_DISABLE(flags);
SCHED_ENQUEUE(CurrentProcess);