summaryrefslogtreecommitdiff
path: root/elfutils/libdw/memory-access.h
diff options
context:
space:
mode:
Diffstat (limited to 'elfutils/libdw/memory-access.h')
-rw-r--r--elfutils/libdw/memory-access.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/elfutils/libdw/memory-access.h b/elfutils/libdw/memory-access.h
index 52b41b5b..74054f95 100644
--- a/elfutils/libdw/memory-access.h
+++ b/elfutils/libdw/memory-access.h
@@ -1,5 +1,5 @@
/* Unaligned memory access functionality.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
@@ -246,6 +246,17 @@ read_8sbyte_unaligned (Dwarf *dbg, const void *p)
#endif /* allow unaligned */
+#define read_ubyte_unaligned(Nbytes, Dbg, Addr) \
+ ((Nbytes) == 2 ? read_2ubyte_unaligned (Dbg, Addr) \
+ : (Nbytes) == 4 ? read_4ubyte_unaligned (Dbg, Addr) \
+ : read_8ubyte_unaligned (Dbg, Addr))
+
+#define read_sbyte_unaligned(Nbytes, Dbg, Addr) \
+ ((Nbytes) == 2 ? read_2sbyte_unaligned (Dbg, Addr) \
+ : (Nbytes) == 4 ? read_4sbyte_unaligned (Dbg, Addr) \
+ : read_8sbyte_unaligned (Dbg, Addr))
+
+
#define read_2ubyte_unaligned_inc(Dbg, Addr) \
({ uint16_t t_ = read_2ubyte_unaligned (Dbg, Addr); \
Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 2); \
@@ -273,4 +284,15 @@ read_8sbyte_unaligned (Dwarf *dbg, const void *p)
Addr = (__typeof (Addr)) (((uintptr_t) (Addr)) + 8); \
t_; })
+
+#define read_ubyte_unaligned_inc(Nbytes, Dbg, Addr) \
+ ((Nbytes) == 2 ? read_2ubyte_unaligned_inc (Dbg, Addr) \
+ : (Nbytes) == 4 ? read_4ubyte_unaligned_inc (Dbg, Addr) \
+ : read_8ubyte_unaligned_inc (Dbg, Addr))
+
+#define read_sbyte_unaligned_inc(Nbytes, Dbg, Addr) \
+ ((Nbytes) == 2 ? read_2sbyte_unaligned_inc (Dbg, Addr) \
+ : (Nbytes) == 4 ? read_4sbyte_unaligned_inc (Dbg, Addr) \
+ : read_8sbyte_unaligned_inc (Dbg, Addr))
+
#endif /* memory-access.h */