diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/common/endianness.c | 10 | ||||
-rwxr-xr-x | src/common/endianness.h | 11 | ||||
-rw-r--r-- | src/common/leb128.c | 8 | ||||
-rw-r--r-- | src/common/leb128.h | 5 |
4 files changed, 18 insertions, 16 deletions
diff --git a/src/common/endianness.c b/src/common/endianness.c index 7dc5bc2..bbc3f18 100755 --- a/src/common/endianness.c +++ b/src/common/endianness.c @@ -45,7 +45,7 @@ * * ******************************************************************************/ -bool read_u4(uint8_t *target, const bin_t *data, off_t *pos, off_t end, bool *low) +bool read_u4(uint8_t *target, const bin_t *data, phys_t *pos, phys_t end, bool *low) { if (*pos < 0) return false; if ((end - *pos) < 1) return false; @@ -82,7 +82,7 @@ bool read_u4(uint8_t *target, const bin_t *data, off_t *pos, off_t end, bool *lo * * ******************************************************************************/ -bool read_u8(uint8_t *target, const bin_t *data, off_t *pos, off_t end) +bool read_u8(uint8_t *target, const bin_t *data, phys_t *pos, phys_t end) { if (*pos < 0) return false; if ((end - *pos) < 1) return false; @@ -112,7 +112,7 @@ bool read_u8(uint8_t *target, const bin_t *data, off_t *pos, off_t end) * * ******************************************************************************/ -bool read_u16(uint16_t *target, const bin_t *data, off_t *pos, off_t end, SourceEndian endian) +bool read_u16(uint16_t *target, const bin_t *data, phys_t *pos, phys_t end, SourceEndian endian) { if (*pos < 0) return false; if ((end - *pos) < 2) return false; @@ -185,7 +185,7 @@ bool read_u16(uint16_t *target, const bin_t *data, off_t *pos, off_t end, Source * * ******************************************************************************/ -bool read_u32(uint32_t *target, const bin_t *data, off_t *pos, off_t end, SourceEndian endian) +bool read_u32(uint32_t *target, const bin_t *data, phys_t *pos, phys_t end, SourceEndian endian) { if (*pos < 0) return false; if ((end - *pos) < 4) return false; @@ -262,7 +262,7 @@ bool read_u32(uint32_t *target, const bin_t *data, off_t *pos, off_t end, Source * * ******************************************************************************/ -bool read_u64(uint64_t *target, const bin_t *data, off_t *pos, off_t end, SourceEndian endian) +bool read_u64(uint64_t *target, const bin_t *data, phys_t *pos, phys_t end, SourceEndian endian) { if (*pos < 0) return false; if ((end - *pos) < 8) return false; diff --git a/src/common/endianness.h b/src/common/endianness.h index 2764f66..07c1b76 100755 --- a/src/common/endianness.h +++ b/src/common/endianness.h @@ -29,6 +29,7 @@ #include "../arch/archbase.h" +#include "../arch/vmpa.h" @@ -43,19 +44,19 @@ typedef enum _SourceEndian /* Lit un nombre non signé sur 4 bits. */ -bool read_u4(uint8_t *, const bin_t *, off_t *, off_t, bool *); +bool read_u4(uint8_t *, const bin_t *, phys_t *, phys_t, bool *); /* Lit un nombre non signé sur un octet. */ -bool read_u8(uint8_t *, const bin_t *, off_t *, off_t); +bool read_u8(uint8_t *, const bin_t *, phys_t *, phys_t); /* Lit un nombre non signé sur deux octets. */ -bool read_u16(uint16_t *, const bin_t *, off_t *, off_t, SourceEndian); +bool read_u16(uint16_t *, const bin_t *, phys_t *, phys_t, SourceEndian); /* Lit un nombre non signé sur quatre octets. */ -bool read_u32(uint32_t *, const bin_t *, off_t *, off_t, SourceEndian); +bool read_u32(uint32_t *, const bin_t *, phys_t *, phys_t, SourceEndian); /* Lit un nombre non signé sur huit octets. */ -bool read_u64(uint64_t *, const bin_t *, off_t *, off_t, SourceEndian); +bool read_u64(uint64_t *, const bin_t *, phys_t *, phys_t, SourceEndian); #define read_s4(target, data, pos, len, low) read_u4((uint8_t *)target, data, pos, len, low) diff --git a/src/common/leb128.c b/src/common/leb128.c index dc041b5..5fed92a 100644 --- a/src/common/leb128.c +++ b/src/common/leb128.c @@ -40,10 +40,10 @@ * * ******************************************************************************/ -bool read_uleb128(uleb128_t *target, const bin_t *data, off_t *pos, off_t len) +bool read_uleb128(uleb128_t *target, const bin_t *data, phys_t *pos, phys_t len) { int shift; /* Décallage à appliquer */ - off_t i; /* Boucle de parcours */ + phys_t i; /* Boucle de parcours */ if (*pos < 0) return false; @@ -84,10 +84,10 @@ bool read_uleb128(uleb128_t *target, const bin_t *data, off_t *pos, off_t len) * * ******************************************************************************/ -bool read_leb128(leb128_t *target, const bin_t *data, off_t *pos, off_t len) +bool read_leb128(leb128_t *target, const bin_t *data, phys_t *pos, phys_t len) { int shift; /* Décallage à appliquer */ - off_t i; /* Boucle de parcours */ + phys_t i; /* Boucle de parcours */ if (*pos < 0) return false; diff --git a/src/common/leb128.h b/src/common/leb128.h index b777d94..c7c4aa2 100644 --- a/src/common/leb128.h +++ b/src/common/leb128.h @@ -30,6 +30,7 @@ #include "../arch/archbase.h" +#include "../arch/vmpa.h" @@ -50,10 +51,10 @@ typedef int64_t leb128_t; /* Lit un nombre non signé encodé au format LEB128. */ -bool read_uleb128(uleb128_t *, const bin_t *, off_t *, off_t); +bool read_uleb128(uleb128_t *, const bin_t *, phys_t *, phys_t); /* Lit un nombre signé encodé au format LEB128. */ -bool read_leb128(leb128_t *, const bin_t *, off_t *, off_t); +bool read_leb128(leb128_t *, const bin_t *, phys_t *, phys_t); |