init.cmd Start USB poller, list devices, list processes, Fix cpu_find_lightest () crashing bug
This commit is contained in:
@@ -31,31 +31,6 @@ struct saved_regs {
|
||||
uint64_t ss;
|
||||
} PACKED;
|
||||
|
||||
struct ksaved_regs {
|
||||
/* regs */
|
||||
uint64_t r15;
|
||||
uint64_t r14;
|
||||
uint64_t r13;
|
||||
uint64_t r12;
|
||||
uint64_t r11;
|
||||
uint64_t r10;
|
||||
uint64_t r9;
|
||||
uint64_t r8;
|
||||
uint64_t rbx;
|
||||
uint64_t rbp;
|
||||
uint64_t rdi;
|
||||
uint64_t rsi;
|
||||
uint64_t rdx;
|
||||
uint64_t rcx;
|
||||
uint64_t rax;
|
||||
/* interrupt stuff */
|
||||
uint64_t trap;
|
||||
uint64_t error;
|
||||
uint64_t rip;
|
||||
uint64_t cs;
|
||||
uint64_t rflags;
|
||||
} PACKED;
|
||||
|
||||
void idt_load (void);
|
||||
void intr_init (void);
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
void do_sched (struct proc* proc, spin_lock_t* cpu_lock, uint64_t lockflags) {
|
||||
uint64_t fp;
|
||||
|
||||
__asm__ volatile ("cli");
|
||||
|
||||
spin_lock (&proc->lock, &fp);
|
||||
|
||||
thiscpu->tss.rsp0 = proc->pdata.kernel_stack;
|
||||
@@ -28,9 +30,7 @@ void do_sched (struct proc* proc, spin_lock_t* cpu_lock, uint64_t lockflags) {
|
||||
fx_restore (proc->pdata.fx_env);
|
||||
|
||||
spin_unlock (&proc->lock, fp);
|
||||
spin_unlock (cpu_lock, lockflags);
|
||||
|
||||
__asm__ volatile ("cli");
|
||||
spin_unlock (cpu_lock, 0);
|
||||
|
||||
do_sched1 ((void*)®s, cr3);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ struct cpu* cpu_find_lightest (void) {
|
||||
uint64_t fc;
|
||||
struct limine_mp_response* mp = limine_mp_request.response;
|
||||
|
||||
int start = atomic_fetch_add (&last_cpu_index, 1) % mp->cpu_count;
|
||||
int start = thiscpu->id;
|
||||
|
||||
struct cpu* best_cpu = &cpus[start];
|
||||
|
||||
@@ -80,6 +80,9 @@ struct cpu* cpu_find_lightest (void) {
|
||||
best_load = l;
|
||||
best_cpu = cpu;
|
||||
}
|
||||
|
||||
if (best_load == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
return best_cpu;
|
||||
|
||||
Reference in New Issue
Block a user