diff --git a/Kernel/ELF/ELFLoader.cpp b/Kernel/ELF/ELFLoader.cpp index cfd430f86a..10544be44d 100644 --- a/Kernel/ELF/ELFLoader.cpp +++ b/Kernel/ELF/ELFLoader.cpp @@ -45,10 +45,25 @@ bool ELFLoader::layout() kprintf("PH: L%x %u r:%u w:%u\n", program_header.laddr().get(), program_header.size_in_memory(), program_header.is_readable(), program_header.is_writable()); #endif if (program_header.is_writable()) { - allocate_section(program_header.laddr(), program_header.size_in_memory(), program_header.alignment(), program_header.is_readable(), program_header.is_writable()); + alloc_section_hook( + program_header.laddr(), + program_header.size_in_memory(), + program_header.alignment(), + program_header.is_readable(), + program_header.is_writable(), + String::format("elf-alloc-%s%s", program_header.is_readable() ? "r" : "", program_header.is_writable() ? "w" : "") + ); memcpy(program_header.laddr().as_ptr(), program_header.raw_data(), program_header.size_in_image()); } else { - map_section(program_header.laddr(), program_header.size_in_memory(), program_header.alignment(), program_header.offset(), program_header.is_readable(), program_header.is_writable()); + map_section_hook( + program_header.laddr(), + program_header.size_in_memory(), + program_header.alignment(), + program_header.offset(), + program_header.is_readable(), + program_header.is_writable(), + String::format("elf-map-%s%s", program_header.is_readable() ? "r" : "", program_header.is_writable() ? "w" : "") + ); } }); return !failed; @@ -162,15 +177,3 @@ char* ELFLoader::symbol_ptr(const char* name) }); return found_ptr; } - -bool ELFLoader::allocate_section(LinearAddress laddr, size_t size, size_t alignment, bool is_readable, bool is_writable) -{ - ASSERT(alloc_section_hook); - return alloc_section_hook(laddr, size, alignment, is_readable, is_writable, String::format("elf-alloc-%s%s", is_readable ? "r" : "", is_writable ? "w" : "")); -} - -bool ELFLoader::map_section(LinearAddress laddr, size_t size, size_t alignment, size_t offset_in_image, bool is_readable, bool is_writable) -{ - ASSERT(alloc_section_hook); - return map_section_hook(laddr, size, alignment, offset_in_image, is_readable, is_writable, String::format("elf-map-%s%s", is_readable ? "r" : "", is_writable ? "w" : "")); -} diff --git a/Kernel/ELF/ELFLoader.h b/Kernel/ELF/ELFLoader.h index 8ae4628083..25f47bce45 100644 --- a/Kernel/ELF/ELFLoader.h +++ b/Kernel/ELF/ELFLoader.h @@ -4,7 +4,8 @@ #include #include #include -#include "ELFImage.h" +#include +#include class ELFLoader { public: @@ -15,8 +16,6 @@ public: Function alloc_section_hook; Function map_section_hook; char* symbol_ptr(const char* name); - bool allocate_section(LinearAddress, size_t, size_t alignment, bool is_readable, bool is_writable); - bool map_section(LinearAddress, size_t, size_t alignment, size_t offset_in_image, bool is_readable, bool is_writable); LinearAddress entry() const { return m_image.entry(); } private: