Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 30 → Rev 31

/SPARTAN/trunk/include/cpu.h
60,6 → 60,7
 
int id;
int active;
int tlb_active;
 
__u16 frequency_mhz;
__u32 delay_loop_const;
/SPARTAN/trunk/src/Makefile.config
22,7 → 22,7
#TEST_DIR=synch/rwlock1/
#TEST_DIR=synch/rwlock2/
#TEST_DIR=synch/rwlock3/
#TEST_DIR=synch/rwlock4/
TEST_DIR=synch/rwlock5/
TEST_DIR=synch/rwlock4/
#TEST_DIR=synch/rwlock5/
#TEST_DIR=synch/semaphore1/
#TEST_DIR=synch/semaphore2/
/SPARTAN/trunk/src/cpu/cpu.c
82,6 → 82,7
#endif /* __SMP__ */
CPU->active = 1;
CPU->tlb_active = 1;
cpu_identify();
cpu_arch_init();
/SPARTAN/trunk/src/mm/tlb.c
33,32 → 33,36
#include <arch/smp/atomic.h>
#include <arch/interrupt.h>
#include <config.h>
#include <arch.h>
 
#ifdef __SMP__
static spinlock_t tlblock;
static volatile int tlb_shootdown_cnt;
 
void tlb_init(void)
{
spinlock_initialize(&tlblock);
tlb_shootdown_cnt = 0;
}
 
/* must be called with interrupts disabled */
void tlb_shootdown_start(void)
{
int i;
 
CPU->tlb_active = 0;
spinlock_lock(&tlblock);
tlb_shootdown_ipi_send();
tlb_invalidate(0); /* TODO: use valid ASID */
while (tlb_shootdown_cnt < config.cpu_active - 1)
;
tlb_shootdown_cnt = 0;
busy_wait:
for (i = 0; i<config.cpu_active; i++)
if (cpus[i].tlb_active)
goto busy_wait;
}
 
void tlb_shootdown_finalize(void)
{
spinlock_unlock(&tlblock);
CPU->tlb_active = 1;
}
 
void tlb_shootdown_ipi_send(void)
68,9 → 72,10
 
void tlb_shootdown_ipi_recv(void)
{
atomic_inc((int *) &tlb_shootdown_cnt);
CPU->tlb_active = 0;
spinlock_lock(&tlblock);
spinlock_unlock(&tlblock);
tlb_invalidate(0); /* TODO: use valid ASID */
CPU->tlb_active = 1;
}
#endif /* __SMP__ */
/SPARTAN/trunk/src/mm/vm.c
179,7 → 179,6
 
spinlock_unlock(&m->lock);
 
tlb_invalidate(0);
tlb_shootdown_finalize();
 
cpu_priority_restore(pri);
/SPARTAN/trunk/arch/ia32/src/bios/bios.c
33,6 → 33,6
 
void bios_init(void)
{
/* Copy the EBDA out from BIOS Data Area */
/* Copy the EBDA address out from BIOS Data Area */
ebda = *((__u16 *) BIOS_EBDA_PTR) * 0x10;
}
/SPARTAN/trunk/arch/ia32/src/smp/apic.c
230,8 → 230,8
 
l_apic[TPR] &= TPRClear;
 
// if (CPU->arch.family >= 6)
// enable_l_apic_in_msr();
if (CPU->arch.family >= 6)
enable_l_apic_in_msr();
tmp = l_apic[ICRlo] & ICRloClear;
l_apic[ICRlo] = tmp | DLVRMODE_INIT | DESTMODE_PHYS | LEVEL_DEASSERT | SHORTHAND_INCL | TRGRMODE_LEVEL;
256,6 → 256,7
t2 = l_apic[CCRT];
l_apic[ICRT] = t1-t2;
}
 
void l_apic_eoi(void)
/SPARTAN/trunk/arch/ia32/src/interrupt.c
92,7 → 92,7
void syscall(__u8 n, __u32 stack[])
{
printf("cpu%d: syscall\n", CPU->id);
thread_usleep(1000000);
thread_usleep(1000);
}
 
void tlb_shootdown_ipi(__u8 n, __u32 stack[])