1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 04:57:45 +00:00

Kernel: Rename LinearAddress => VirtualAddress.

This commit is contained in:
Andreas Kling 2019-06-07 12:56:50 +02:00
parent 0ed89440f1
commit e42c3b4fd7
33 changed files with 272 additions and 272 deletions

View file

@ -57,7 +57,7 @@ public:
dword type() const { return m_program_header.p_type; }
dword flags() const { return m_program_header.p_flags; }
dword offset() const { return m_program_header.p_offset; }
LinearAddress laddr() const { return LinearAddress(m_program_header.p_vaddr); }
VirtualAddress vaddr() const { return VirtualAddress(m_program_header.p_vaddr); }
dword size_in_memory() const { return m_program_header.p_memsz; }
dword size_in_image() const { return m_program_header.p_filesz; }
dword alignment() const { return m_program_header.p_align; }
@ -117,7 +117,7 @@ public:
bool is_executable() const { return header().e_type == ET_EXEC; }
bool is_relocatable() const { return header().e_type == ET_REL; }
LinearAddress entry() const { return LinearAddress(header().e_entry); }
VirtualAddress entry() const { return VirtualAddress(header().e_entry); }
private:
bool parse_header();

View file

@ -34,21 +34,21 @@ bool ELFLoader::layout()
if (program_header.type() != PT_LOAD)
return;
#ifdef ELFLOADER_DEBUG
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());
kprintf("PH: L%x %u r:%u w:%u\n", program_header.vaddr().get(), program_header.size_in_memory(), program_header.is_readable(), program_header.is_writable());
#endif
if (program_header.is_writable()) {
alloc_section_hook(
program_header.laddr(),
program_header.vaddr(),
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());
memcpy(program_header.vaddr().as_ptr(), program_header.raw_data(), program_header.size_in_image());
} else {
map_section_hook(
program_header.laddr(),
program_header.vaddr(),
program_header.size_in_memory(),
program_header.alignment(),
program_header.offset(),

View file

@ -5,7 +5,7 @@
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#if defined(KERNEL)
#include <Kernel/LinearAddress.h>
#include <Kernel/VirtualAddress.h>
#endif
#include <AK/ELF/ELFImage.h>
@ -16,9 +16,9 @@ public:
bool load();
#if defined(KERNEL)
Function<void*(LinearAddress, size_t, size_t, bool, bool, const String&)> alloc_section_hook;
Function<void*(LinearAddress, size_t, size_t, size_t, bool r, bool w, bool x, const String&)> map_section_hook;
LinearAddress entry() const { return m_image.entry(); }
Function<void*(VirtualAddress, size_t, size_t, bool, bool, const String&)> alloc_section_hook;
Function<void*(VirtualAddress, size_t, size_t, size_t, bool r, bool w, bool x, const String&)> map_section_hook;
VirtualAddress entry() const { return m_image.entry(); }
#endif
char* symbol_ptr(const char* name);