diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-28 21:27:36 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-08-28 21:27:36 +0200 |
commit | ecc99f77810305304893d188d25e598f5645ecaf (patch) | |
tree | ccf5769f7bc8394140dd177ac00bcb65bbe6ee64 | |
parent | 87cf68424591ec4576ecfc5833b2babf2d674459 (diff) | |
download | gnumach-ecc99f77810305304893d188d25e598f5645ecaf.tar.gz gnumach-ecc99f77810305304893d188d25e598f5645ecaf.tar.bz2 gnumach-ecc99f77810305304893d188d25e598f5645ecaf.zip |
Fix crash at boot
spl cannot be called before the clock is set up.
-rw-r--r-- | device/kmsg.c | 13 | ||||
-rw-r--r-- | i386/i386/pic.c | 1 | ||||
-rw-r--r-- | i386/i386/spl.h | 1 | ||||
-rw-r--r-- | i386/i386at/ioapic.c | 1 | ||||
-rw-r--r-- | i386/i386at/model_dep.c | 1 | ||||
-rw-r--r-- | xen/evt.c | 1 |
6 files changed, 13 insertions, 5 deletions
diff --git a/device/kmsg.c b/device/kmsg.c index 7551ebad..e5b518e6 100644 --- a/device/kmsg.c +++ b/device/kmsg.c @@ -218,7 +218,7 @@ kmsg_putchar (int c) { io_req_t ior; int offset; - spl_t s; + spl_t s = -1; /* XXX: cninit is not called before cnputc is used. So call kmsginit here if not initialized yet. */ @@ -227,8 +227,9 @@ kmsg_putchar (int c) kmsginit (); kmsg_init_done = TRUE; } - - s = simple_lock_irq (&kmsg_lock); + + if (spl_init) + s = simple_lock_irq (&kmsg_lock); offset = kmsg_write_offset + 1; if (offset == KMSGBUFSIZE) offset = 0; @@ -236,7 +237,8 @@ kmsg_putchar (int c) if (offset == kmsg_read_offset) { /* Discard C. */ - simple_unlock_irq (s, &kmsg_lock); + if (spl_init) + simple_unlock_irq (s, &kmsg_lock); return; } @@ -247,5 +249,6 @@ kmsg_putchar (int c) while ((ior = (io_req_t) dequeue_head (&kmsg_read_queue)) != NULL) iodone (ior); - simple_unlock_irq (s, &kmsg_lock); + if (spl_init) + simple_unlock_irq (s, &kmsg_lock); } diff --git a/i386/i386/pic.c b/i386/i386/pic.c index 2431c838..66fbc04a 100644 --- a/i386/i386/pic.c +++ b/i386/i386/pic.c @@ -76,6 +76,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. spl_t curr_ipl[NCPUS] = {0}; int curr_pic_mask; +int spl_init = 0; int iunit[NINTR] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; diff --git a/i386/i386/spl.h b/i386/i386/spl.h index 173629fe..2a3f1a3a 100644 --- a/i386/i386/spl.h +++ b/i386/i386/spl.h @@ -69,6 +69,7 @@ extern void splon (unsigned long n); extern unsigned long sploff (void); extern void setsoftclock (void); +extern int spl_init; /* XXX Include each other... */ #include <i386/ipl.h> diff --git a/i386/i386at/ioapic.c b/i386/i386at/ioapic.c index 73fd216a..218f9a51 100644 --- a/i386/i386at/ioapic.c +++ b/i386/i386at/ioapic.c @@ -40,6 +40,7 @@ uint32_t lapic_timer_val = 0; uint32_t calibrated_ticks = 0; spl_t curr_ipl[NCPUS] = {0}; +int spl_init = 0; int iunit[NINTR] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}; diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 4ce35dfe..f83214b1 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -360,6 +360,7 @@ i386at_init(void) #else /* MACH_HYP */ hyp_intrinit(); #endif /* MACH_HYP */ + spl_init = 1; /* * Read memory map and load it into the physical page allocator. @@ -29,6 +29,7 @@ int int_mask[NSPL]; spl_t curr_ipl[NCPUS]; +int spl_init = 0; interrupt_handler_fn ivect[NEVNT]; int intpri[NEVNT]; |