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 /device | |
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.
Diffstat (limited to 'device')
-rw-r--r-- | device/kmsg.c | 13 |
1 files changed, 8 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); } |