stand: further restrict f_kernphys_relocatable and f_tg_kernel_support

f_tg_kernel_support isn't used by any EFI code, and
f_kernphys_relocatable isn't used by the non-EFI i386 code.
This commit is contained in:
Ahmad Khalifa 2024-09-27 18:32:06 +03:00
parent 5ac9320ddf
commit 7bcd510a7b
2 changed files with 5 additions and 5 deletions

View File

@ -239,10 +239,10 @@ struct preloaded_file
size_t f_size; /* file size */ size_t f_size; /* file size */
struct kernel_module *f_modules; /* list of modules if any */ struct kernel_module *f_modules; /* list of modules if any */
struct preloaded_file *f_next; /* next file */ struct preloaded_file *f_next; /* next file */
#if defined(__amd64__) || defined(__i386__) #if defined(__amd64__) || (defined(__i386__) && defined(EFI))
bool f_kernphys_relocatable; bool f_kernphys_relocatable;
#endif #endif
#if defined(__i386__) #if defined(__i386__) && !defined(EFI)
bool f_tg_kernel_support; bool f_tg_kernel_support;
#endif #endif
}; };

View File

@ -217,7 +217,7 @@ static int elf_section_header_convert(const Elf_Ehdr *ehdr, Elf_Shdr *shdr)
} }
#endif #endif
#if defined(__amd64__) || defined(__i386__) #if defined(__amd64__) || (defined(__i386__) && defined(EFI))
static bool static bool
is_kernphys_relocatable(elf_file_t ef) is_kernphys_relocatable(elf_file_t ef)
{ {
@ -491,10 +491,10 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest,
/* Load OK, return module pointer */ /* Load OK, return module pointer */
*result = (struct preloaded_file *)fp; *result = (struct preloaded_file *)fp;
err = 0; err = 0;
#if defined(__amd64__) || defined(__i386__) #if defined(__amd64__) || (defined(__i386__) && defined(EFI))
fp->f_kernphys_relocatable = multiboot || is_kernphys_relocatable(&ef); fp->f_kernphys_relocatable = multiboot || is_kernphys_relocatable(&ef);
#endif #endif
#ifdef __i386__ #if defined(__i386__) && !defined(EFI)
fp->f_tg_kernel_support = is_tg_kernel_support(fp, &ef); fp->f_tg_kernel_support = is_tg_kernel_support(fp, &ef);
#endif #endif
goto out; goto out;