summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-01-04 01:32:44 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-01-04 01:33:13 (GMT)
commit239694d99ad81f1e435125e76a2a930213d06b21 (patch)
treec02344549f10d618159198bd90f1e010d9def258
parent7b3364f3af43961df7c5c7bcd0fe7407e944f16f (diff)
Treated phys_t as uint64_t to avoid huge differences get considered as negative numbers.
-rw-r--r--ChangeLog10
-rw-r--r--src/analysis/disass/area.c6
-rw-r--r--src/arch/vmpa.c14
-rw-r--r--src/arch/vmpa.h3
4 files changed, 21 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fe2f5e..4fc256d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+16-01-04 Cyrille Bagard <nocbos@gmail.com>
+
+ * src/analysis/disass/area.c:
+ Typo.
+
+ * src/arch/vmpa.c:
+ * src/arch/vmpa.h:
+ Typo. Treat phys_t as uint64_t to avoid huge differences in
+ mrange_contains_addr() get considered as negative numbers.
+
16-01-03 Cyrille Bagard <nocbos@gmail.com>
* src/format/format.c:
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index c79b293..eddad5c 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -652,15 +652,15 @@ mem_area_v2 *find_memory_area_by_addr_v2(mem_area_v2 *list, size_t count, const
{
mem_area_v2 *result; /* Elément trouvé à renvoyer */
- int find_mem_area(const vmpa2t *addr, const mem_area_v2 *area)
+ int find_mem_area(const vmpa2t *_addr, const mem_area_v2 *_area)
{
int status; /* Bilan à retourner */
- if (mrange_contains_addr(&area->range, addr))
+ if (mrange_contains_addr(&_area->range, _addr))
status = 0;
else
- status = cmp_vmpa(addr, get_mrange_addr(&area->range));
+ status = cmp_vmpa(_addr, get_mrange_addr(&_area->range));
return status;
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c
index e2da876..25b01c3 100644
--- a/src/arch/vmpa.c
+++ b/src/arch/vmpa.c
@@ -299,10 +299,10 @@ phys_t compute_vmpa_diff(const vmpa2t *a, const vmpa2t *b)
result = VMPA_NO_PHYSICAL;
if (a->physical != VMPA_NO_PHYSICAL && b->physical != VMPA_NO_PHYSICAL)
- result = (b->physical > a->physical ? b->physical - a->physical : a->physical- b->physical);
+ result = (b->physical > a->physical ? b->physical - a->physical : a->physical - b->physical);
else if (a->virtual != VMPA_NO_VIRTUAL && b->virtual != VMPA_NO_VIRTUAL)
- result = (phys_t)(b->virtual > a->virtual ? b->virtual - a->virtual : a->virtual- b->virtual);
+ result = (phys_t)(b->virtual > a->virtual ? b->virtual - a->virtual : a->virtual - b->virtual);
return result;
@@ -398,23 +398,23 @@ static char *_phys_t_to_string(phys_t phys, MemoryDataSize msize, char buffer[VM
switch (msize)
{
case MDS_8_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, phys);
break;
case MDS_16_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, phys);
break;
case MDS_32_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, phys);
break;
case MDS_64_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, phys);
break;
default:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, phys);
break;
}
diff --git a/src/arch/vmpa.h b/src/arch/vmpa.h
index eb63324..cfb9ab5 100644
--- a/src/arch/vmpa.h
+++ b/src/arch/vmpa.h
@@ -29,7 +29,6 @@
#include <malloc.h>
#include <stdbool.h>
#include <stdint.h>
-#include <sys/types.h>
#include "archbase.h"
@@ -49,7 +48,7 @@
/* Types pour respectivement une position physique et une adresse virtuelle */
-#define phys_t off_t
+#define phys_t uint64_t
#define virt_t uint64_t
/* Equivalents pour GLib */