diff options
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; \ + }) |