Cleaned up ELF64 address handling.
* platform_allocate_elf_region() is removed, it is implemented in platform- independent code now (ELF*Class::AllocateRegion). For ELF64 it is now assumed that 64-bit addresses are mapped in the loader's 32-bit address space as (address - KERNEL_BASE_64BIT + KERNEL_BASE). * mapped_delta field from preloaded_*_image removed, now handled compile-time using the ELF*Class::Map method. * Also link the kernel with -z max-page-size=0x1000, removes the need for 2MB alignment on the data segment (not going to map the kernel with large pages for the time being).
This commit is contained in:
@@ -47,7 +47,6 @@ struct preloaded_elf32_image : public preloaded_image {
|
||||
Elf32_Ehdr elf_header;
|
||||
elf32_region text_region;
|
||||
elf32_region data_region;
|
||||
uint32 mapped_delta;
|
||||
|
||||
FixedWidthPointer<Elf32_Sym> syms;
|
||||
FixedWidthPointer<Elf32_Rel> rel;
|
||||
@@ -65,7 +64,6 @@ struct preloaded_elf64_image : public preloaded_image {
|
||||
Elf64_Ehdr elf_header;
|
||||
elf64_region text_region;
|
||||
elf64_region data_region;
|
||||
uint64 mapped_delta;
|
||||
|
||||
FixedWidthPointer<Elf64_Sym> syms;
|
||||
FixedWidthPointer<Elf64_Rel> rel;
|
||||
@@ -84,18 +82,8 @@ extern status_t boot_elf_resolve_symbol(preloaded_elf32_image* image,
|
||||
struct Elf32_Sym* symbol, Elf32_Addr* symbolAddress);
|
||||
extern status_t boot_elf_resolve_symbol(preloaded_elf64_image* image,
|
||||
struct Elf64_Sym* symbol, Elf64_Addr* symbolAddress);
|
||||
|
||||
|
||||
// Helper method to set a relocation at the mapped address in the loader's
|
||||
// address space.
|
||||
template<typename ImageType, typename AddrType>
|
||||
inline void
|
||||
boot_elf_set_relocation(ImageType* image, AddrType resolveAddress,
|
||||
AddrType finalAddress)
|
||||
{
|
||||
AddrType* dest = (AddrType*)(addr_t)(resolveAddress + image->mapped_delta);
|
||||
*dest = finalAddress;
|
||||
}
|
||||
extern void boot_elf64_set_relocation(Elf64_Addr resolveAddress,
|
||||
Elf64_Addr finalAddress);
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL_BOOT_ELF_H */
|
||||
|
||||
@@ -72,13 +72,6 @@ extern size_t platform_get_user_input_text(Menu *menu, MenuItem *item,
|
||||
char *buffer, size_t bufferSize);
|
||||
extern char* platform_debug_get_log_buffer(size_t* _size);
|
||||
|
||||
/* ELF functions */
|
||||
|
||||
extern status_t platform_allocate_elf_region(uint32 *_address, uint32 size,
|
||||
uint8 protection, void **_mappedAddress);
|
||||
extern status_t platform_allocate_elf_region(uint64 *_address, uint64 size,
|
||||
uint8 protection, void **_mappedAddress);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL_BOOT_PLATFORM_H */
|
||||
|
||||
Reference in New Issue
Block a user