boot/efi/x86: enable support for 64-bit ELF

Change-Id: Id3b207444b55041dc83ee1afdd61b467ce13ff70
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5665
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit is contained in:
David Karoly 2022-09-22 15:05:16 +02:00 committed by Adrien Destugues
parent fbca1c4088
commit 5897f7b623
3 changed files with 26 additions and 25 deletions

View File

@ -10,15 +10,13 @@ for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] {
DEFINES = $(defines) ;
DEFINES += _BOOT_MODE ;
if $(TARGET_BOOT_PLATFORM) = efi {
if $(TARGET_ARCH) = x86_64 {
DEFINES += BOOT_SUPPORT_ELF64 ;
} else {
DEFINES += BOOT_SUPPORT_ELF32 ;
}
} else {
if $(TARGET_BOOT_PLATFORM) = efi && $(TARGET_ARCH) = x86_64 {
DEFINES += BOOT_SUPPORT_ELF64 ;
DEFINES += BOOT_SUPPORT_ELF32 ;
} else {
DEFINES +=
BOOT_SUPPORT_ELF32
BOOT_SUPPORT_ELF64
;
}
local kernelArchSources =

View File

@ -61,17 +61,16 @@ for platform in [ MultiBootSubDirSetup ] {
;
if $(TARGET_BOOT_PLATFORM) != efi {
DEFINES += _BOOT_PLATFORM_BIOS ;
}
if $(TARGET_BOOT_PLATFORM) = efi && $(TARGET_ARCH) = x86_64 {
DEFINES += BOOT_SUPPORT_ELF64 ;
} else {
DEFINES +=
_BOOT_PLATFORM_BIOS
BOOT_SUPPORT_ELF32
BOOT_SUPPORT_ELF64
;
} else {
if $(TARGET_ARCH) = x86_64 {
DEFINES += BOOT_SUPPORT_ELF64 ;
} else {
DEFINES += BOOT_SUPPORT_ELF32 ;
}
}
}
case "sparc" :

View File

@ -130,7 +130,7 @@ struct ELF64Class {
AllocateRegion(AddrType* _address, AddrType size, uint8 protection,
void **_mappedAddress)
{
#if defined(_BOOT_PLATFORM_BIOS)
#if B_HAIKU_BITS == 32
// Assume the real 64-bit base address is KERNEL_LOAD_BASE_64_BIT and
// the mappings in the loader address space are at KERNEL_LOAD_BASE.
@ -145,26 +145,30 @@ struct ELF64Class {
return status;
*_mappedAddress = address;
#if defined(_BOOT_PLATFORM_BIOS)
*_address = (AddrType)(addr_t)address + KERNEL_FIXUP_FOR_LONG_MODE;
#else
platform_bootloader_address_to_kernel_address(address, _address);
addr_t result;
platform_bootloader_address_to_kernel_address(address, &result);
*_address = result;
#if B_HAIKU_BITS == 32
*_address += KERNEL_FIXUP_FOR_LONG_MODE;
#endif
return B_OK;
}
static inline void*
Map(AddrType address)
Map(AddrType _address)
{
#ifdef _BOOT_PLATFORM_BIOS
return (void*)(addr_t)(address - KERNEL_FIXUP_FOR_LONG_MODE);
addr_t address;
#if B_HAIKU_BITS == 32
address = _address - KERNEL_FIXUP_FOR_LONG_MODE;
#else
address = _address;
#endif
void *result;
if (platform_kernel_address_to_bootloader_address(address, &result) != B_OK) {
panic("Couldn't convert address %#" PRIx64, address);
panic("Couldn't convert address %#" PRIx64 "\n", _address);
}
return result;
#endif
}
};