smp: fix wakeups doing bad EOI write

This commit is contained in:
K. Lange 2021-06-01 19:36:46 +09:00
parent c63c8ba7e7
commit aa52db5018
4 changed files with 12 additions and 10 deletions

View File

@ -87,7 +87,8 @@ ISR_NOERR 127
_isr126:
pushq %r12
mov (lapic_final), %r12
movq $0, 0xb0(%r12)
add $0xb0, %r12
movl $0, (%r12)
popq %r12
iretq

View File

@ -289,11 +289,8 @@ void smp_initialize(void) {
}
void arch_wakeup_others(void) {
/* Never wake up BSP, don't hit ourselves, easy. */
for (int i = 1; i < processor_count; ++i) {
if (i == this_core->cpu_id) continue;
if (processor_local_data[i].current_process == processor_local_data[i].kernel_idle_task) {
lapic_send_ipi(processor_local_data[i].lapic_id, 0x407E);
}
}
/* Send broadcast IPI to others; this is a soft interrupt
* that just nudges idle cores out of their HLT states.
* It should be gentle enough that busy cores dont't care. */
lapic_send_ipi(0, 0x7E | (3 << 18));
}

View File

@ -293,8 +293,8 @@ static void _kidle(void) {
static void _kburn(void) {
while (1) {
//arch_pause();
if (((volatile list_t *)process_queue)->head) switch_next();
arch_pause();
switch_next();
}
}

View File

@ -135,6 +135,10 @@ static long sys_sysfunc(long fn, char ** args) {
this_core->current_process->thread.context.tls_base = (uintptr_t)args[0];
arch_set_tls_base(this_core->current_process->thread.context.tls_base);
return 0;
case 99:
arch_wakeup_others();
return 0;
default:
printf("Bad system function: %ld\n", fn);
return -EINVAL;