Fix weird startup crashes in debug mode
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m40s

This commit is contained in:
2026-03-20 19:43:52 +01:00
parent bf1e8e8573
commit fd800f6210
2 changed files with 7 additions and 3 deletions

View File

@@ -102,10 +102,10 @@ static void smp_bootstrap (struct limine_mp_info* mp_info) {
DEBUG ("CPU %u is online!\n", thiscpu->id); DEBUG ("CPU %u is online!\n", thiscpu->id);
atomic_fetch_sub (&cpu_counter, 1);
cpu->kproc = kproc_create (); cpu->kproc = kproc_create ();
atomic_fetch_sub (&cpu_counter, 1);
__asm__ volatile ("sti"); __asm__ volatile ("sti");
struct reschedule_ctx rctx; struct reschedule_ctx rctx;
@@ -116,6 +116,9 @@ static void smp_bootstrap (struct limine_mp_info* mp_info) {
spin_lock (&spin_proc->cpu->lock, &fc); spin_lock (&spin_proc->cpu->lock, &fc);
do_sched (spin_proc, &spin_proc->cpu->lock, fc); do_sched (spin_proc, &spin_proc->cpu->lock, fc);
for (;;)
;
} }
/// Initialize SMP subsystem for AMD64. Start AP CPUs /// Initialize SMP subsystem for AMD64. Start AP CPUs
@@ -133,7 +136,7 @@ void smp_init (void) {
DEBUG ("Waiting for other CPUs:\n"); DEBUG ("Waiting for other CPUs:\n");
while (atomic_load (&cpu_counter) > 0) while (atomic_load (&cpu_counter) > 0)
debugprintf (".\n"); ;
DEBUG ("All CPUs are up!\n"); DEBUG ("All CPUs are up!\n");
} }

View File

@@ -25,6 +25,7 @@
#define HAVE_MORECORE 0 #define HAVE_MORECORE 0
#define NO_MALLOC_STATS 1 #define NO_MALLOC_STATS 1
#define USE_LOCKS 1 #define USE_LOCKS 1
#define USE_SPIN_LOCKS 1
#define MALLOC_FAILURE_ACTION \ #define MALLOC_FAILURE_ACTION \
do { \ do { \
DEBUG ("malloc failure\n"); \ DEBUG ("malloc failure\n"); \