summaryrefslogtreecommitdiff
path: root/src/arch/vmpa.h
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-08-05 20:19:08 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-08-05 20:19:08 (GMT)
commit56ee4d3ecddeee05f11083fcc1595e3756b91790 (patch)
tree5ec6e5449214093280629047c36016a0de09cbeb /src/arch/vmpa.h
parenta2eb5483fe74923e488013b2d8b94ded6340499e (diff)
Defined the first steps for a new disassembling approach.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@387 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/arch/vmpa.h')
-rw-r--r--src/arch/vmpa.h40
1 files changed, 36 insertions, 4 deletions
diff --git a/src/arch/vmpa.h b/src/arch/vmpa.h
index 5df9b8a..461780c 100644
--- a/src/arch/vmpa.h
+++ b/src/arch/vmpa.h
@@ -25,6 +25,7 @@
#define _ARCH_VMPA_H
+#include <alloca.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
@@ -50,9 +51,11 @@ struct _vmpa2_t
off_t physical; /* Position physique */
uint64_t virtual; /* Adresse virtuelle */
- MemoryDataSize last_phy_size; /* Dernière taille demandée #1 */
+ MemoryDataSize last_phys_size; /* Dernière taille demandée #1 */
MemoryDataSize last_virt_size; /* Dernière taille demandée #2 */
- char phy_cache[VMPA_MAX_SIZE]; /* Impression physique cachée */
+ size_t last_phys_len; /* Dernière taille fournie #1 */
+ size_t last_virt_len; /* Dernière taille fournie #2 */
+ char phys_cache[VMPA_MAX_SIZE]; /* Impression physique cachée */
char virt_cache[VMPA_MAX_SIZE]; /* Impression virtuelle cachée */
};
@@ -66,6 +69,30 @@ typedef struct _vmpa2_t vmpa2_t;
typedef struct _vmpa2_t vmpa2t;
+
+
+/* Crée la copie d'un adressage mémoire en local. */
+//inline vmpa2t *local_dup_vmpa(const vmpa2t *) __attribute__((always_inline));
+
+
+
+#define local_dup_vmpa(src) \
+ ({ \
+ vmpa2t *__result; \
+ __result = alloca(sizeof(vmpa2t)); \
+ copy_vmpa(__result, src); \
+ __result; \
+ })
+
+
+
+/* Copie la définition d'un adressage dans un autre. */
+void copy_vmpa(vmpa2t *, const vmpa2t *);
+
+
+
+
+
/* Initialise une localisation dans l'espace mémoire/physique. */
void init_vmpa(vmpa2t *, off_t, uint64_t);
@@ -81,6 +108,11 @@ vmpa2t *make_vmpa(off_t, uint64_t);
+#define get_phy_addr(a) a->physical
+#define get_virt_addr(a) a->virtual
+
+
+
/* Lit la définition d'une adresse depuis un flux réseau. */
bool recv_vmpa(vmpa2t *, int, int);
@@ -89,10 +121,10 @@ bool recv_vmpa(vmpa2t *, int, int);
bool send_vmpa(const vmpa2t *, int, int);
/* Transforme une adresse physique en chaîne de caractères. */
-const char *vmpa2_phy_to_string(vmpa2t *, MemoryDataSize);
+const char *vmpa2_phys_to_string(vmpa2t *, MemoryDataSize, size_t *);
/* Transforme une adresse virtuelle en chaîne de caractères. */
-const char *vmpa2_virt_to_string(vmpa2t *, MemoryDataSize);
+const char *vmpa2_virt_to_string(vmpa2t *, MemoryDataSize, size_t *);