Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 183 → Rev 184

/SPARTAN/trunk/src/main/main.c
134,10 → 134,7
task_t *k;
thread_t *t;
 
THE->preemption_disabled = 0;
THE->cpu = NULL;
THE->thread = NULL;
THE->task = NULL;
the_initialize(THE);
 
arch_pre_mm_init();
heap_init(config.base + hardcoded_ktext_size + hardcoded_kdata_size, CONFIG_HEAP_SIZE + heap_delta);
/SPARTAN/trunk/src/proc/scheduler.c
252,6 → 252,13
}
 
/*
* Through the 'THE' structure, we keep track of THREAD, TASK, CPU
* and preemption counter. At this point THE could be coming either
* from THREAD's or CPU's stack.
*/
the_copy(THE, (the_t *) CPU->stack);
 
/*
* We may not keep the old stack.
* Reason: If we kept the old stack and got blocked, for instance, in
* find_best_thread(), the old thread could get rescheduled by another
397,6 → 404,8
printf("cpu%d: tid %d (pri=%d,ticks=%d,nrdy=%d)\n", CPU->id, THREAD->tid, THREAD->pri, THREAD->ticks, CPU->nrdy);
#endif
 
the_copy(THE, (the_t *) THREAD->kstack);
context_restore(&THREAD->saved_context);
/* not reached */
}
/SPARTAN/trunk/src/proc/thread.c
196,6 → 196,8
context_save(&t->saved_context);
context_set(&t->saved_context, FADDR(cushion), t->kstack, THREAD_STACK_SIZE);
the_initialize((the_t *) t->kstack);
 
pri = cpu_priority_high();
t->saved_context.pri = cpu_priority_read();
/SPARTAN/trunk/src/lib/the.c
0,0 → 1,58
/*
* Copyright (C) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <arch.h>
#include <typedefs.h>
 
 
/** Initialize THE structure
*
* Initialize THE structure passed as argument.
*
* @the THE structure to be initialized.
*
*/
void the_initialize(the_t *the)
{
the->preemption_disabled = 0;
the->cpu = NULL;
the->thread = NULL;
the->task = NULL;
}
 
/** Copy THE structure
*
* Copy the source THE structure to the destination THE structure.
*
* @src The source THE structure.
* @dst The destination THE structure.
*/
void the_copy(the_t *src, the_t *dst)
{
*dst = *src;
}
/SPARTAN/trunk/src/Makefile
16,6 → 16,7
lib/func.c \
lib/list.c \
lib/memstr.c \
lib/the.c \
debug/print.c \
time/clock.c \
time/timeout.c \