summaryrefslogtreecommitdiff
path: root/src/arch/vmpa.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-12-28 16:56:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-12-28 16:56:07 (GMT)
commit276b75e6e9ff99a930bd36045e55b1117bb29579 (patch)
treeadd29839b8b44f730d53d80b20f95cbd8b9ec277 /src/arch/vmpa.c
parent64b50b60e45e4d343ff257c3c9e10788f624a713 (diff)
Converted ranges length to string.
Diffstat (limited to 'src/arch/vmpa.c')
-rw-r--r--src/arch/vmpa.c70
1 files changed, 61 insertions, 9 deletions
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c
index a289a28..a2430b5 100644
--- a/src/arch/vmpa.c
+++ b/src/arch/vmpa.c
@@ -38,6 +38,14 @@
+/* ---------------------- DEFINITION D'UNE POSITION EN MEMOIRE ---------------------- */
+
+
+/* Transforme une position physique en chaîne de caractères. */
+static char *_phys_t_to_string(phys_t, MemoryDataSize, char [VMPA_MAX_LEN], size_t *);
+
+
+
/* ---------------------------------------------------------------------------------- */
/* DEFINITION D'UNE POSITION EN MEMOIRE */
/* ---------------------------------------------------------------------------------- */
@@ -366,12 +374,12 @@ bool send_vmpa(const vmpa2t *addr, int fd, int flags)
/******************************************************************************
* *
-* Paramètres : addr = adresse virtuelle ou physique à traiter. *
+* Paramètres : phys = position physique à traiter. *
* msize = taille de cette adresse, réelle ou désirée. *
* buffer = tampon de sortie utilisé à constituer. [OUT] *
* length = transmission de la taille du résultat ou NULL. [OUT]*
* *
-* Description : Transforme une adresse physique en chaîne de caractères. *
+* Description : Transforme une position physique en chaîne de caractères. *
* *
* Retour : Chaîne de caractères constituée. *
* *
@@ -379,34 +387,34 @@ bool send_vmpa(const vmpa2t *addr, int fd, int flags)
* *
******************************************************************************/
-char *vmpa2_phys_to_string(const vmpa2t *addr, MemoryDataSize msize, char buffer[VMPA_MAX_LEN], size_t *length)
+static char *_phys_t_to_string(phys_t phys, MemoryDataSize msize, char buffer[VMPA_MAX_LEN], size_t *length)
{
size_t ret; /* Retour de l'impression */
- if (addr->physical == VMPA_NO_PHYSICAL)
+ if (phys == VMPA_NO_PHYSICAL)
ret = snprintf(buffer, VMPA_MAX_LEN, _("(none)"));
else
switch (msize)
{
case MDS_8_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, (uint64_t)addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, (uint64_t)phys);
break;
case MDS_16_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, (uint64_t)addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, (uint64_t)phys);
break;
case MDS_32_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, (uint64_t)addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, (uint64_t)phys);
break;
case MDS_64_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, (uint64_t)addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, (uint64_t)phys);
break;
default:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, (uint64_t)addr->physical);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, (uint64_t)phys);
break;
}
@@ -426,6 +434,28 @@ char *vmpa2_phys_to_string(const vmpa2t *addr, MemoryDataSize msize, char buffer
* buffer = tampon de sortie utilisé à constituer. [OUT] *
* length = transmission de la taille du résultat ou NULL. [OUT]*
* *
+* Description : Transforme une adresse physique en chaîne de caractères. *
+* *
+* Retour : Chaîne de caractères constituée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *vmpa2_phys_to_string(const vmpa2t *addr, MemoryDataSize msize, char buffer[VMPA_MAX_LEN], size_t *length)
+{
+ return _phys_t_to_string(addr->physical, msize, buffer, length);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : addr = adresse virtuelle ou physique à traiter. *
+* msize = taille de cette adresse, réelle ou désirée. *
+* buffer = tampon de sortie utilisé à constituer. [OUT] *
+* length = transmission de la taille du résultat ou NULL. [OUT]*
+* *
* Description : Transforme une adresse virtuelle en chaîne de caractères. *
* *
* Retour : Chaîne de caractères constituée. *
@@ -1050,3 +1080,25 @@ char *mrange_virt_to_string(const mrange_t *range, MemoryDataSize msize, bool st
return buffer;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : rane = emplacement virtuel ou physique à traiter. *
+* msize = taille de cette adresse, réelle ou désirée. *
+* buffer = tampon de sortie utilisé à constituer. [OUT] *
+* length = transmission de la taille du résultat ou NULL. [OUT]*
+* *
+* Description : Transforme une taille d'emplacement en chaîne de caractères. *
+* *
+* Retour : Chaîne de caractères constituée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+char *mrange_length_to_string(const mrange_t *range, MemoryDataSize msize, char buffer[VMPA_MAX_LEN], size_t *length)
+{
+ return _phys_t_to_string(range->length, msize, buffer, length);
+
+}