[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH gnumach] i386/apic.c: Pre-initialize the lapic pointer with a
From: |
Samuel Thibault |
Subject: |
Re: [PATCH gnumach] i386/apic.c: Pre-initialize the lapic pointer with a dummy structure |
Date: |
Tue, 20 Jun 2023 13:30:21 +0200 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
Applied, thanks!
Damien Zammit, le mar. 20 juin 2023 10:29:38 +0000, a ecrit:
> Fixes an early crash when APIC is defined, NCPUS > 1 and LINUX_DEV is not
> defined.
>
> CPU_NUMBER can now be called before the local apic pointer is properly
> initialized.
> ---
> i386/i386/apic.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/i386/i386/apic.c b/i386/i386/apic.c
> index ff7ba3e2..c399074d 100644
> --- a/i386/i386/apic.c
> +++ b/i386/i386/apic.c
> @@ -27,7 +27,13 @@
> #include <kern/kalloc.h>
>
>
> -volatile ApicLocalUnit* lapic = NULL;
> +/*
> + * This dummy structure is needed so that CPU_NUMBER can be called
> + * before the lapic pointer is initialized to point to the real Local Apic.
> + * It causes the apic_id to be faked as 0, which is the master processor.
> + */
> +static ApicLocalUnit dummy_lapic = {0};
> +volatile ApicLocalUnit* lapic = &dummy_lapic;
>
> ApicInfo apic_data;
>
> --
> 2.39.0
>
>
>