Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 457 → Rev 458

/SPARTAN/trunk/generic/include/synch/spinlock.h
33,7 → 33,7
#include <typedefs.h>
#include <preemption.h>
 
#ifdef __SMP__
#ifdef CONFIG_SMP
struct spinlock {
int val;
};
/SPARTAN/trunk/generic/include/smp/smp.h
29,10 → 29,10
#ifndef __SMP_H__
#define __SMP_H__
 
#ifdef __SMP__
#ifdef CONFIG_SMP
extern void smp_init(void);
#else
#define smp_init() ;
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
#endif /* __SMP_H__ */
/SPARTAN/trunk/generic/include/smp/ipi.h
29,11 → 29,11
#ifndef __IPI_H__
#define __IPI_H__
 
#ifdef __SMP__
#ifdef CONFIG_SMP
extern void ipi_broadcast(int ipi);
extern void ipi_broadcast_arch(int ipi);
#else
#define ipi_broadcast(x) ;
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
#endif
/SPARTAN/trunk/generic/include/mm/tlb.h
33,7 → 33,7
 
extern void tlb_init(void);
 
#ifdef __SMP__
#ifdef CONFIG_SMP
extern void tlb_shootdown_start(void);
extern void tlb_shootdown_finalize(void);
extern void tlb_shootdown_ipi_recv(void);
41,7 → 41,7
# define tlb_shootdown_start() ;
# define tlb_shootdown_finalize() ;
# define tlb_shootdown_ipi_recv() ;
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
/* Export TLB interface that each architecture must implement. */
extern void tlb_init_arch(void);
/SPARTAN/trunk/generic/include/cpu.h
52,10 → 52,10
spinlock_t timeoutlock;
link_t timeout_active_head;
 
#ifdef __SMP__
#ifdef CONFIG_SMP
int kcpulbstarted;
waitq_t kcpulb_wq;
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
int id;
int active;
/SPARTAN/trunk/generic/src/smp/ipi.c
26,7 → 26,7
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#ifdef __SMP__
#ifdef CONFIG_SMP
 
#include <smp/ipi.h>
#include <config.h>
44,7 → 44,7
/*
* Provisions must be made to avoid sending IPI:
* - before all CPU's were configured to accept the IPI
* - if there is only one CPU but the kernel was compiled with __SMP__
* - if there is only one CPU but the kernel was compiled with CONFIG_SMP
*/
 
if ((config.cpu_active > 1) && (config.cpu_active == config.cpu_count))
51,4 → 51,4
ipi_broadcast_arch(ipi);
}
 
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
/SPARTAN/trunk/generic/src/proc/scheduler.c
61,7 → 61,7
void before_thread_runs(void)
{
before_thread_runs_arch();
#ifdef FPU_LAZY
#ifdef CONFIG_FPU_LAZY
if(THREAD==CPU->fpu_owner)
fpu_enable();
else
77,7 → 77,7
#endif
}
 
#ifdef FPU_LAZY
#ifdef CONFIG_FPU_LAZY
void scheduler_fpu_lazy_request(void)
{
fpu_enable();
134,7 → 134,7
interrupts_enable();
if (n == 0) {
#ifdef __SMP__
#ifdef CONFIG_SMP
/*
* If the load balancing thread is not running, wake it up and
* set CPU-private flag that the kcpulb has been started.
143,7 → 143,7
waitq_wakeup(&CPU->kcpulb_wq, 0);
goto loop;
}
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
/*
* For there was nothing to run, the CPU goes to sleep
412,7 → 412,7
 
if (THREAD) {
spinlock_lock(&THREAD->lock);
#ifndef FPU_LAZY
#ifndef CONFIG_FPU_LAZY
fpu_context_save(&(THREAD->saved_fpu_context));
#endif
if (!context_save(&THREAD->saved_context)) {
462,7 → 462,7
 
 
 
#ifdef __SMP__
#ifdef CONFIG_SMP
/** Load balancing thread
*
* SMP load balancing thread, supervising thread supplies
623,4 → 623,4
goto loop;
}
 
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
/SPARTAN/trunk/generic/src/main/kinit.c
43,9 → 43,9
#include <print.h>
#include <memstr.h>
 
#ifdef __SMP__
#ifdef CONFIG_SMP
#include <arch/smp/mps.h>
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
#include <synch/waitq.h>
#include <synch/spinlock.h>
66,7 → 66,7
 
interrupts_disable();
 
#ifdef __SMP__
#ifdef CONFIG_SMP
if (config.cpu_count > 1) {
/*
* Create the kmp thread and wait for its completion.
84,7 → 84,7
}
else panic("thread_create/kmp");
}
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
/*
* Now that all CPUs are up, we can report what we've found.
*/
95,7 → 95,7
printf("cpu%d: not active\n", i);
}
 
#ifdef __SMP__
#ifdef CONFIG_SMP
if (config.cpu_count > 1) {
/*
* For each CPU, create its load balancing thread.
113,7 → 113,7
 
}
}
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
interrupts_enable();
 
/SPARTAN/trunk/generic/src/main/main.c
39,10 → 39,10
#include <cpu.h>
#include <align.h>
 
#ifdef __SMP__
#ifdef CONFIG_SMP
#include <arch/smp/apic.h>
#include <arch/smp/mps.h>
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
#include <smp/smp.h>
 
202,7 → 202,7
}
 
 
#ifdef __SMP__
#ifdef CONFIG_SMP
/** Application CPUs main kernel routine
*
* Executed by application processors, temporary stack
268,4 → 268,4
scheduler();
/* not reached */
}
#endif /* __SMP__*/
#endif /* CONFIG_SMP */
/SPARTAN/trunk/generic/src/synch/spinlock.c
34,7 → 34,7
#include <print.h>
#include <debug.h>
 
#ifdef __SMP__
#ifdef CONFIG_SMP
 
/** Initialize spinlock
*
47,7 → 47,7
sl->val = 0;
}
 
#ifdef DEBUG_SPINLOCK
#ifdef CONFIG_DEBUG_SPINLOCK
/** Lock spinlock
*
* Lock spinlock.
/SPARTAN/trunk/generic/src/cpu/cpu.c
49,9 → 49,9
void cpu_init(void) {
int i, j;
#ifdef __SMP__
#ifdef CONFIG_SMP
if (config.cpu_active == 1) {
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
cpus = (cpu_t *) malloc(sizeof(cpu_t) * config.cpu_count);
if (!cpus)
panic("malloc/cpus");
66,7 → 66,7
cpus[i].id = i;
#ifdef __SMP__
#ifdef CONFIG_SMP
waitq_initialize(&cpus[i].kcpulb_wq);
#endif /* __SMP */
75,9 → 75,9
}
}
#ifdef __SMP__
#ifdef CONFIG_SMP
}
#endif /* __SMP__ */
#endif /* CONFIG_SMP */
 
CPU = &cpus[config.cpu_active-1];
/SPARTAN/trunk/generic/src/mm/tlb.c
36,7 → 36,7
#include <config.h>
#include <arch.h>
 
#ifdef __SMP__
#ifdef CONFIG_SMP
static spinlock_t tlblock;
#endif
 
48,7 → 48,7
tlb_init_arch();
}
 
#ifdef __SMP__
#ifdef CONFIG_SMP
/* must be called with interrupts disabled */
void tlb_shootdown_start(void)
{
84,4 → 84,4
tlb_invalidate(0); /* TODO: use valid ASID */
CPU->tlb_active = 1;
}
#endif /* __SMP__ */
#endif /* CONFIG_SMP */