diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-03-29 17:24:22 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-03-29 17:24:22 (GMT) |
commit | 52e036040b5e0ad8acde3d467ac8d9ca43ed414c (patch) | |
tree | 9f869999534857786fc8e0870772d8e5cabef2fb /src/format/executable.h | |
parent | 057cee1c3c109639af8f30e39e00f4884a353f31 (diff) |
Used real virtual addresses when describing ELF items.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@496 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format/executable.h')
-rw-r--r-- | src/format/executable.h | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/format/executable.h b/src/format/executable.h index 0607a0e..8b52ed6 100644 --- a/src/format/executable.h +++ b/src/format/executable.h @@ -38,6 +38,8 @@ #define G_EXE_FORMAT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_executable_format_get_type(), GExeFormatIface)) #define G_EXE_FORMAT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_EXE_FORMAT, GExeFormatClass)) +#define G_EXE_FORMAT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_EXE_FORMAT, GExeFormatClass)) + /* Format d'exécutable générique (instance) */ typedef struct _GExeFormat GExeFormat; @@ -64,11 +66,30 @@ GBinPortion **g_exe_format_get_portions_at_level(GExeFormat *, unsigned int, siz /* Fournit les espaces mémoires des portions exécutables. */ mrange_t *g_exe_format_get_x_ranges(GExeFormat *format, size_t *count); -/* Fournit la position correspondant à une adresse virtuelle. */ -bool g_exe_format_translate_address_into_offset(const GExeFormat *, vmpa_t, off_t *); - -/* Fournit l'adresse virtuelle correspondant à une position. */ -bool g_exe_format_translate_offset_into_address(const GExeFormat *, off_t, vmpa_t *); +/* Fournit l'emplacement correspondant à une position physique. */ +bool g_exe_format_translate_offset_into_vmpa(const GExeFormat *, phys_t, vmpa2t *); + +/* Fournit l'emplacement correspondant à une position physique. */ +bool g_exe_format_translate_address_into_vmpa(const GExeFormat *, virt_t, vmpa2t *); + + +#define g_exe_format_translate_offset_into_address(fmt, off, addr) \ + ({ \ + bool __result; \ + vmpa2t __pos; \ + __result = g_exe_format_translate_offset_into_vmpa(fmt, off, &__pos); \ + *addr = get_virt_addr(&__pos); \ + __result; \ + }) + +#define g_exe_format_translate_address_into_offset(fmt, addr, off) \ + ({ \ + bool __result; \ + vmpa2t __pos; \ + __result = g_exe_format_translate_address_into_vmpa(fmt, addr, &__pos); \ + *off = get_phy_addr(&__pos); \ + __result; \ + }) |