summaryrefslogtreecommitdiff
path: root/libdw/memory-access.h
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-06-24 17:41:40 -0700
committerRoland McGrath <roland@redhat.com>2009-07-08 15:15:52 -0700
commit3c84db3b4b610bf636c4363abb6d3dac5ae020f9 (patch)
treee0af0c5a7f27a3f06a66353a3da9bec0bd7bd32f /libdw/memory-access.h
parentfe8b42e6131b74829fe31d15f31349cade566a59 (diff)
downloadelfutils-3c84db3b4b610bf636c4363abb6d3dac5ae020f9.tar.gz
CFI support: lookup by PC and translate into DWARF location per register
Diffstat (limited to 'libdw/memory-access.h')
-rw-r--r--libdw/memory-access.h37
1 files changed, 25 insertions, 12 deletions
diff --git a/libdw/memory-access.h b/libdw/memory-access.h
index 74054f95..13f79ec2 100644
--- a/libdw/memory-access.h
+++ b/libdw/memory-access.h
@@ -186,19 +186,32 @@ union unaligned
int64_t s8;
} __attribute__ ((packed));
+# define read_2ubyte_unaligned(Dbg, Addr) \
+ read_2ubyte_unaligned_1 ((Dbg)->other_byte_order, (Addr))
+# define read_2sbyte_unaligned(Dbg, Addr) \
+ read_2sbyte_unaligned_1 ((Dbg)->other_byte_order, (Addr))
+# define read_4ubyte_unaligned(Dbg, Addr) \
+ read_4ubyte_unaligned_1 ((Dbg)->other_byte_order, (Addr))
+# define read_4sbyte_unaligned(Dbg, Addr) \
+ read_4sbyte_unaligned_1 ((Dbg)->other_byte_order, (Addr))
+# define read_8ubyte_unaligned(Dbg, Addr) \
+ read_8ubyte_unaligned_1 ((Dbg)->other_byte_order, (Addr))
+# define read_8sbyte_unaligned(Dbg, Addr) \
+ read_8sbyte_unaligned_1 ((Dbg)->other_byte_order, (Addr))
+
static inline uint16_t
-read_2ubyte_unaligned (Dwarf *dbg, const void *p)
+read_2ubyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
- if (dbg->other_byte_order)
+ if (unlikely (other_byte_order))
return bswap_16 (up->u2);
return up->u2;
}
static inline int16_t
-read_2sbyte_unaligned (Dwarf *dbg, const void *p)
+read_2sbyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
- if (dbg->other_byte_order)
+ if (unlikely (other_byte_order))
return (int16_t) bswap_16 (up->u2);
return up->s2;
}
@@ -210,35 +223,35 @@ read_4ubyte_unaligned_noncvt (const void *p)
return up->u4;
}
static inline uint32_t
-read_4ubyte_unaligned (Dwarf *dbg, const void *p)
+read_4ubyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
- if (dbg->other_byte_order)
+ if (unlikely (other_byte_order))
return bswap_32 (up->u4);
return up->u4;
}
static inline int32_t
-read_4sbyte_unaligned (Dwarf *dbg, const void *p)
+read_4sbyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
- if (dbg->other_byte_order)
+ if (unlikely (other_byte_order))
return (int32_t) bswap_32 (up->u4);
return up->s4;
}
static inline uint64_t
-read_8ubyte_unaligned (Dwarf *dbg, const void *p)
+read_8ubyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
- if (dbg->other_byte_order)
+ if (unlikely (other_byte_order))
return bswap_64 (up->u8);
return up->u8;
}
static inline int64_t
-read_8sbyte_unaligned (Dwarf *dbg, const void *p)
+read_8sbyte_unaligned_1 (bool other_byte_order, const void *p)
{
const union unaligned *up = p;
- if (dbg->other_byte_order)
+ if (unlikely (other_byte_order))
return (int64_t) bswap_64 (up->u8);
return up->s8;
}