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 <[email protected]> Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
fbca1c4088
commit
5897f7b623
@@ -10,15 +10,13 @@ for platform in [ MultiBootSubDirSetup bios_ia32 efi pxe_ia32 ] {
|
|||||||
DEFINES = $(defines) ;
|
DEFINES = $(defines) ;
|
||||||
DEFINES += _BOOT_MODE ;
|
DEFINES += _BOOT_MODE ;
|
||||||
|
|
||||||
if $(TARGET_BOOT_PLATFORM) = efi {
|
if $(TARGET_BOOT_PLATFORM) = efi && $(TARGET_ARCH) = x86_64 {
|
||||||
if $(TARGET_ARCH) = x86_64 {
|
|
||||||
DEFINES += BOOT_SUPPORT_ELF64 ;
|
|
||||||
} else {
|
|
||||||
DEFINES += BOOT_SUPPORT_ELF32 ;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
DEFINES += BOOT_SUPPORT_ELF64 ;
|
DEFINES += BOOT_SUPPORT_ELF64 ;
|
||||||
DEFINES += BOOT_SUPPORT_ELF32 ;
|
} else {
|
||||||
|
DEFINES +=
|
||||||
|
BOOT_SUPPORT_ELF32
|
||||||
|
BOOT_SUPPORT_ELF64
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
local kernelArchSources =
|
local kernelArchSources =
|
||||||
|
|||||||
@@ -61,17 +61,16 @@ for platform in [ MultiBootSubDirSetup ] {
|
|||||||
;
|
;
|
||||||
|
|
||||||
if $(TARGET_BOOT_PLATFORM) != efi {
|
if $(TARGET_BOOT_PLATFORM) != efi {
|
||||||
|
DEFINES += _BOOT_PLATFORM_BIOS ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if $(TARGET_BOOT_PLATFORM) = efi && $(TARGET_ARCH) = x86_64 {
|
||||||
|
DEFINES += BOOT_SUPPORT_ELF64 ;
|
||||||
|
} else {
|
||||||
DEFINES +=
|
DEFINES +=
|
||||||
_BOOT_PLATFORM_BIOS
|
|
||||||
BOOT_SUPPORT_ELF32
|
BOOT_SUPPORT_ELF32
|
||||||
BOOT_SUPPORT_ELF64
|
BOOT_SUPPORT_ELF64
|
||||||
;
|
;
|
||||||
} else {
|
|
||||||
if $(TARGET_ARCH) = x86_64 {
|
|
||||||
DEFINES += BOOT_SUPPORT_ELF64 ;
|
|
||||||
} else {
|
|
||||||
DEFINES += BOOT_SUPPORT_ELF32 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "sparc" :
|
case "sparc" :
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ struct ELF64Class {
|
|||||||
AllocateRegion(AddrType* _address, AddrType size, uint8 protection,
|
AllocateRegion(AddrType* _address, AddrType size, uint8 protection,
|
||||||
void **_mappedAddress)
|
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
|
// 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.
|
// the mappings in the loader address space are at KERNEL_LOAD_BASE.
|
||||||
|
|
||||||
@@ -145,26 +145,30 @@ struct ELF64Class {
|
|||||||
return status;
|
return status;
|
||||||
|
|
||||||
*_mappedAddress = address;
|
*_mappedAddress = address;
|
||||||
#if defined(_BOOT_PLATFORM_BIOS)
|
|
||||||
*_address = (AddrType)(addr_t)address + KERNEL_FIXUP_FOR_LONG_MODE;
|
addr_t result;
|
||||||
#else
|
platform_bootloader_address_to_kernel_address(address, &result);
|
||||||
platform_bootloader_address_to_kernel_address(address, _address);
|
*_address = result;
|
||||||
|
#if B_HAIKU_BITS == 32
|
||||||
|
*_address += KERNEL_FIXUP_FOR_LONG_MODE;
|
||||||
#endif
|
#endif
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void*
|
static inline void*
|
||||||
Map(AddrType address)
|
Map(AddrType _address)
|
||||||
{
|
{
|
||||||
#ifdef _BOOT_PLATFORM_BIOS
|
addr_t address;
|
||||||
return (void*)(addr_t)(address - KERNEL_FIXUP_FOR_LONG_MODE);
|
#if B_HAIKU_BITS == 32
|
||||||
|
address = _address - KERNEL_FIXUP_FOR_LONG_MODE;
|
||||||
#else
|
#else
|
||||||
|
address = _address;
|
||||||
|
#endif
|
||||||
void *result;
|
void *result;
|
||||||
if (platform_kernel_address_to_bootloader_address(address, &result) != B_OK) {
|
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;
|
return result;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user