init.cmd Start USB poller, list devices, list processes, Fix cpu_find_lightest () crashing bug
All checks were successful
Build ISO image / build-and-deploy (push) Successful in 36s
Build documentation / build-and-deploy (push) Successful in 26s

This commit is contained in:
2026-04-09 23:51:44 +02:00
parent a86d258a4b
commit 543af9c00b
4 changed files with 19 additions and 32 deletions

View File

@@ -1,9 +1,18 @@
echo "Terminal information: "
terminfo
echo "Available devices:\n"
sys:/devices -C list_all
echo "\n"
echo "Starting USB poller...\n"
sys:/usb -C poll &
echo "\n"
stall 2000
echo "Available devices:\n"
sys:/devices -C list_all
echo "\n"
echo "Running processes:\n"
procinfo
echo "\n"

View File

@@ -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);

View File

@@ -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*)&regs, cr3);
}

View File

@@ -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;