summaryrefslogtreecommitdiff
path: root/src/arch/vmpa.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/vmpa.h')
-rw-r--r--src/arch/vmpa.h64
1 files changed, 60 insertions, 4 deletions
diff --git a/src/arch/vmpa.h b/src/arch/vmpa.h
index 5c82885..4f35ebe 100644
--- a/src/arch/vmpa.h
+++ b/src/arch/vmpa.h
@@ -125,10 +125,10 @@ void align_vmpa(vmpa2t *, phys_t);
phys_t compute_vmpa_diff(const vmpa2t *, const vmpa2t *);
/* Lit la définition d'une adresse depuis un tampon. */
-bool unpack_vmpa(vmpa2t *, packed_buffer *);
+bool unpack_vmpa(vmpa2t *, packed_buffer_t *);
/* Ecrit la définition d'une adresse dans un tampon. */
-bool pack_vmpa(const vmpa2t *, packed_buffer *);
+bool pack_vmpa(const vmpa2t *, packed_buffer_t *);
/* Transforme une adresse physique en chaîne de caractères. */
char *vmpa2_phys_to_string(const vmpa2t *, MemoryDataSize, char [VMPA_MAX_LEN], size_t *);
@@ -156,6 +156,62 @@ bool store_vmpa(const vmpa2t *, const char *, bound_value **, size_t *);
+/* ------------------------ DEFINITION DE POSITION AVEC BITS ------------------------ */
+
+
+/* Adresse mémoire ou position physique */
+typedef struct _ext_vmpa_t
+{
+ vmpa2t base; /* Vision macroscopique */
+
+ uint8_t consumed_extra_bits; /* Avancée supplémentaire */
+
+} ext_vmpa_t;
+
+
+#define init_evmpa_from_vmpa(d, s) \
+ do \
+ { \
+ copy_vmpa(&(d)->base, (s)); \
+ (d)->consumed_extra_bits = 0; \
+ } \
+ while (0)
+
+#define copy_evmpa(d, s) \
+ do \
+ { \
+ copy_vmpa(&(d)->base, &(s)->base); \
+ (d)->consumed_extra_bits = (s)->consumed_extra_bits; \
+ } \
+ while (0)
+
+#define advance_evmpa_bits(a, q) \
+ do \
+ { \
+ uint8_t __sum; \
+ __sum = (a)->consumed_extra_bits + q; \
+ if (__sum > 8) \
+ { \
+ advance_vmpa(&(a)->base, __sum / 8); \
+ (a)->consumed_extra_bits = __sum % 8; \
+ } \
+ else \
+ (a)->consumed_extra_bits = __sum; \
+ } \
+ while (0)
+
+#define align_evmpa_on_byte(a) \
+ do \
+ { \
+ if ((a)->consumed_extra_bits > 0) \
+ { \
+ advance_vmpa(&(a)->base, 1); \
+ (a)->consumed_extra_bits = 0; \
+ } \
+ } \
+ while (0);
+
+
/* ------------------------ AIDES FONCTIONNELLES AUXILIAIRES ------------------------ */
@@ -224,10 +280,10 @@ bool mrange_intersects_mrange(const mrange_t *, const mrange_t *);
void compute_mrange_end_addr(const mrange_t *, vmpa2t *);
/* Lit la définition d'une couverture depuis un tampon. */
-bool unpack_mrange(mrange_t *, packed_buffer *);
+bool unpack_mrange(mrange_t *, packed_buffer_t *);
/* Ecrit la définition d'une couverture dans un tampon. */
-bool pack_mrange(const mrange_t *, packed_buffer *);
+bool pack_mrange(const mrange_t *, packed_buffer_t *);
/* Transforme un emplacement physique en chaîne de caractères. */
char *mrange_phys_to_string(const mrange_t *, MemoryDataSize, bool, char [VMPA_MAX_LEN], size_t *);