summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/arch/vmpa.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-11-27 22:18:12 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-11-27 22:18:12 (GMT)
commit046c2cfac39e686dee65cdf54035dc5a975bc57f (patch)
treeca578f4576c58a57aa257d5140cdeeeaabb3b7b0 /plugins/pychrysa/arch/vmpa.c
parent903006678160f620b947d5fbce2a8e257a357d77 (diff)
Added offset and address translations to the Python bindings.
Diffstat (limited to 'plugins/pychrysa/arch/vmpa.c')
-rw-r--r--plugins/pychrysa/arch/vmpa.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/pychrysa/arch/vmpa.c b/plugins/pychrysa/arch/vmpa.c
index 8d42a78..af1557d 100644
--- a/plugins/pychrysa/arch/vmpa.c
+++ b/plugins/pychrysa/arch/vmpa.c
@@ -159,25 +159,30 @@ static PyObject *py_vmpa_to_str(PyObject *obj)
{
PyObject *result; /* Chaîne à retourner */
vmpa2t *addr; /* Véritable adresse manipulée */
- off_t physical; /* Position physique */
- uint64_t virtual; /* Adresse virtuelle */
+ phys_t physical; /* Position physique */
+ virt_t virtual; /* Adresse virtuelle */
+ VMPA_BUFFER(phys_str); /* Version humaine de position */
+ VMPA_BUFFER(virt_str); /* Version humaine d'adresse */
addr = &((py_vmpa_t *)obj)->addr;
physical = get_phy_addr(addr);
virtual = get_virt_addr(addr);
+ vmpa2_phys_to_string(addr, MDS_UNDEFINED, phys_str, NULL);
+ vmpa2_phys_to_string(addr, MDS_UNDEFINED, virt_str, NULL);
+
if (physical == VMPA_NO_PHYSICAL && virtual == VMPA_NO_VIRTUAL)
result = PyUnicode_FromFormat("<phy=None, virt=None>");
else if (physical != VMPA_NO_PHYSICAL && virtual == VMPA_NO_VIRTUAL)
- result = PyUnicode_FromFormat("<phy=%d, virt=None>", physical);
+ result = PyUnicode_FromFormat("<phy=%s, virt=None>", phys_str);
else if (physical == VMPA_NO_PHYSICAL && virtual != VMPA_NO_VIRTUAL)
- result = PyUnicode_FromFormat("<phy=None, virt=0x%08x>", virtual);
+ result = PyUnicode_FromFormat("<phy=None, virt=%s>", virt_str);
else
- result = PyUnicode_FromFormat("<phy=%d, virt=0x%08x>", physical, virtual);
+ result = PyUnicode_FromFormat("<phy=%s, virt=%s>", phys_str, virt_str);
return result;