1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:27:35 +00:00

AK: Rename the common integer typedefs to make it obvious what they are.

These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
This commit is contained in:
Andreas Kling 2019-07-03 21:17:35 +02:00
parent c4c4bbc5ba
commit 27f699ef0c
208 changed files with 1603 additions and 1621 deletions

View file

@ -1,7 +1,7 @@
#include "ELFImage.h"
#include <AK/kstdio.h>
ELFImage::ELFImage(const byte* buffer)
ELFImage::ELFImage(const u8* buffer)
: m_buffer(buffer)
{
m_valid = parse();

View file

@ -7,7 +7,7 @@
class ELFImage {
public:
explicit ELFImage(const byte*);
explicit ELFImage(const u8*);
~ELFImage();
void dump();
bool is_valid() const { return m_valid; }
@ -54,13 +54,13 @@ public:
~ProgramHeader() {}
unsigned index() const { return m_program_header_index; }
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; }
u32 type() const { return m_program_header.p_type; }
u32 flags() const { return m_program_header.p_flags; }
u32 offset() const { return m_program_header.p_offset; }
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; }
u32 size_in_memory() const { return m_program_header.p_memsz; }
u32 size_in_image() const { return m_program_header.p_filesz; }
u32 alignment() const { return m_program_header.p_align; }
bool is_readable() const { return flags() & PF_R; }
bool is_writable() const { return flags() & PF_W; }
bool is_executable() const { return flags() & PF_X; }
@ -88,10 +88,10 @@ public:
unsigned size() const { return m_section_header.sh_size; }
unsigned entry_size() const { return m_section_header.sh_entsize; }
unsigned entry_count() const { return !entry_size() ? 0 : size() / entry_size(); }
dword address() const { return m_section_header.sh_addr; }
u32 address() const { return m_section_header.sh_addr; }
const char* raw_data() const { return m_image.raw_data(m_section_header.sh_offset); }
bool is_undefined() const { return m_section_index == SHN_UNDEF; }
dword flags() const { return m_section_header.sh_flags; }
u32 flags() const { return m_section_header.sh_flags; }
bool is_writable() const { return flags() & SHF_WRITE; }
bool is_executable() const { return flags() & PF_X; }
@ -134,7 +134,7 @@ private:
const char* section_header_table_string(unsigned offset) const;
const char* section_index_to_string(unsigned index);
const byte* m_buffer { nullptr };
const u8* m_buffer { nullptr };
bool m_valid { false };
unsigned m_symbol_table_section_index { 0 };
unsigned m_string_table_section_index { 0 };

View file

@ -8,7 +8,7 @@
//#define ELFLOADER_DEBUG
ELFLoader::ELFLoader(const byte* buffer)
ELFLoader::ELFLoader(const u8* buffer)
: m_image(buffer)
{
}
@ -81,7 +81,7 @@ char* ELFLoader::symbol_ptr(const char* name)
return found_ptr;
}
String ELFLoader::symbolicate(dword address) const
String ELFLoader::symbolicate(u32 address) const
{
SortedSymbol* sorted_symbols = nullptr;
#ifdef KERNEL

View file

@ -13,7 +13,7 @@ class Region;
class ELFLoader {
public:
explicit ELFLoader(const byte*);
explicit ELFLoader(const u8*);
~ELFLoader();
bool load();
@ -26,7 +26,7 @@ public:
bool has_symbols() const { return m_image.symbol_count(); }
String symbolicate(dword address) const;
String symbolicate(u32 address) const;
private:
bool layout();
@ -49,7 +49,7 @@ private:
ELFImage m_image;
struct SortedSymbol {
dword address;
u32 address;
const char* name;
};
#ifdef KERNEL