Mike Kelly, le sam. 26 sept. 2026 23:28:39 +0100, a ecrit:
> The comment in the code implied that it was securing the elf content
> because it could be modified in i386at_init(). All it does however is
> copy the references to that data which do not change. We cannot
> reference 'boot_info' at this point with multiboot2 so deferring until
> after i386at_init() is fine for both multiboot cases.
Ok!
> ---
> i386/i386at/model_dep.c | 38 ++++++++++++++++----------------------
> 1 file changed, 16 insertions(+), 22 deletions(-)
>
> diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
> index 17cd452c..173c60f4 100644
> --- a/i386/i386at/model_dep.c
> +++ b/i386/i386at/model_dep.c
> @@ -97,11 +97,13 @@
> #include <ddb/db_sym.h>
> #include <i386/db_interface.h>
>
> +#ifndef MACH_XEN
> /* ELF section header */
> static unsigned elf_shdr_num;
> static vm_size_t elf_shdr_size;
> static vm_offset_t elf_shdr_addr;
> static unsigned elf_shdr_shndx;
> +#endif
>
> #endif /* MACH_KDB */
>
> @@ -593,25 +595,6 @@ void c_boot_entry(vm_offset_t bi)
> #ifdef MACH_PSEUDO_PHYS
> mfn_list = (void*)boot_info.mfn_list;
> #endif
> -#else /* MACH_XEN */
> -
> -#if MACH_KDB
> - /*
> - * Locate the kernel's symbol table, if the boot loader provided it.
> - * We need to do this before i386at_init()
> - * so that the symbol table's memory won't be stomped on.
> - */
> - if ((boot_info.flags & MULTIBOOT_ELF_SHDR)
> - && boot_info.shdr_num)
> - {
> - elf_shdr_num = boot_info.shdr_num;
> - elf_shdr_size = boot_info.shdr_size;
> - elf_shdr_addr = (vm_offset_t)phystokv(boot_info.shdr_addr);
> - elf_shdr_shndx = boot_info.shdr_strndx;
> -
> - printf("ELF section header table at %08" PRIxPTR "\n",
> elf_shdr_addr);
> - }
> -#endif /* MACH_KDB */
> #endif /* MACH_XEN */
>
> cpu_type = discover_x86_cpu_type ();
> @@ -623,19 +606,30 @@ void c_boot_entry(vm_offset_t bi)
> i386at_init();
> #else
> i386at_init(mb2_info);
> -#endif
>
> + /* 'boot_info' is finalised within i386at_init() and can now
> + be used whichever version of multiboot is in use. */
> #if MACH_KDB
> /*
> - * Initialize the kernel debugger's kernel symbol table.
> + * Locate the kernel's symbol table, if the boot loader provided it.
> */
> - if (elf_shdr_num)
> + if ((boot_info.flags & MULTIBOOT_ELF_SHDR)
> + && boot_info.shdr_num)
> {
> + elf_shdr_num = boot_info.shdr_num;
> + elf_shdr_size = boot_info.shdr_size;
> + elf_shdr_addr = (vm_offset_t)phystokv(boot_info.shdr_addr);
> + elf_shdr_shndx = boot_info.shdr_strndx;
> +
> + printf("ELF section header table at %08" PRIxPTR "\n",
> elf_shdr_addr);
> +
> + /* Initialize the kernel debugger's kernel symbol table. */
> elf_db_sym_init(elf_shdr_num,elf_shdr_size,
> elf_shdr_addr, elf_shdr_shndx,
> "mach", NULL);
> }
> #endif /* MACH_KDB */
> +#endif
>
> machine_slot[0].is_cpu = TRUE;
> machine_slot[0].cpu_subtype = CPU_SUBTYPE_AT386;
> --
> 2.47.3
>
>
--
Samuel
j'etais en train de nettoyer ma souris et le coup est parti...
-+- s sur #ens-mim - et en plus c vrai... -+-