mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-29 21:58:20 +00:00
scheduler: continue work
This commit is contained in:
@@ -220,11 +220,20 @@ void arch_cpu_init() {
|
||||
// insert it into the topology tree
|
||||
topology_node_t *topology_nodes[topology_depth];
|
||||
for (int i = 0; i < topology_depth; ++i) {
|
||||
topology_nodes[i] = topology_create_node();
|
||||
__assert(topology_nodes[i]);
|
||||
int id = TOPOLOGY_MAKE_ID(topology_types[i], topology_ids[i]);
|
||||
topology_node_t *parent = i == 0 ? topology_get_root() : topology_nodes[i - 1];
|
||||
|
||||
topology_insert(topology_nodes[i], i == 0 ? topology_get_root() : topology_nodes[i - 1], TOPOLOGY_MAKE_ID(topology_types[i], topology_ids[i]), current_cpu());
|
||||
topology_nodes[i] = topology_find_child_by_id(parent, id);
|
||||
if (topology_nodes[i] == NULL) {
|
||||
topology_nodes[i] = topology_create_node();
|
||||
__assert(topology_nodes[i]);
|
||||
|
||||
topology_insert(topology_nodes[i], i == 0 ? topology_get_root() : topology_nodes[i - 1],
|
||||
TOPOLOGY_MAKE_ID(topology_types[i], topology_ids[i]), (i == topology_depth - 1) ? current_cpu() : NULL);
|
||||
}
|
||||
}
|
||||
|
||||
current_cpu()->topology_node = topology_nodes[topology_depth - 1];
|
||||
}
|
||||
|
||||
INIT_ROUTINE_DEFINE(cpu, INIT_ROUTINE_FLAGS_NONE, arch_cpu_init, acpi_early);
|
||||
|
||||
@@ -210,7 +210,7 @@ static int shootdown_remaining = 0;
|
||||
|
||||
static inline void do_invalidate(void *page, size_t size) {
|
||||
// if a full reload was requested or we are doing a big release on
|
||||
if (page == NULL || size >= 128 * PAGE_SIZE) {
|
||||
if (page == NULL || size >= 32 * PAGE_SIZE) {
|
||||
// TODO if global pages are ever supported, we should disable them in CR4, flush, and then reenable them
|
||||
asm volatile("mov %%cr3, %%rax; mov %%rax, %%cr3;" : : : "rax", "memory");
|
||||
} else {
|
||||
@@ -251,7 +251,7 @@ void arch_mmu_invalidate_range(void *page, size_t size) {
|
||||
if (smp_cpus[i] == current_cpu())
|
||||
continue;
|
||||
|
||||
arch_smp_sendipi(smp_cpus[i], &smp_cpus[i]->isr[0xfe], ARCH_SMP_IPI_TARGET, false);
|
||||
arch_smp_send_ipi(smp_cpus[i], &smp_cpus[i]->isr[0xfe], ARCH_SMP_IPI_TARGET, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ static void pfisr(isr_t *self, context_t *ctx) {
|
||||
|
||||
static void gpfisr(isr_t *self, context_t *ctx) {
|
||||
thread_t *thread = current_thread();
|
||||
if (thread->usercopyctx) {
|
||||
if (thread && thread->usercopyctx) {
|
||||
memcpy(ctx, thread->usercopyctx, sizeof(context_t));
|
||||
thread->usercopyctx = NULL;
|
||||
CTX_RET(ctx) = EFAULT;
|
||||
|
||||
@@ -49,12 +49,12 @@ static void cpuwakeup(struct limine_smp_info *info) {
|
||||
sched_ap_entry();
|
||||
}
|
||||
|
||||
void arch_smp_sendipi(cpu_t *targcpu, isr_t *isr, int target, bool nmi) {
|
||||
void arch_smp_send_ipi(cpu_t *targcpu, isr_t *isr, int target, bool nmi) {
|
||||
arch_apic_sendipi(targcpu ? targcpu->hardware_id : 0, INTERRUPT_IDTOVECTOR(isr->id), target, nmi ? APIC_MODE_NMI : 0, 0);
|
||||
}
|
||||
|
||||
void arch_smp_haltallothers(void) {
|
||||
arch_smp_sendipi(NULL, ¤t_cpu()->isr[0xfd], ARCH_SMP_IPI_OTHERCPUS, true);
|
||||
arch_smp_send_ipi(NULL, ¤t_cpu()->isr[0xfd], ARCH_SMP_IPI_OTHERCPUS, true);
|
||||
}
|
||||
|
||||
size_t arch_smp_get_cpu_count(void) {
|
||||
|
||||
Reference in New Issue
Block a user