diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2011-12-26 20:12:02 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2011-12-26 21:09:29 +0000 |
commit | 856c7ed97bce524ade99bb1fc41e746973d45acc (patch) | |
tree | f216a0feda1354e2feefecd6a2224f64090f3dbb | |
parent | a5a839a920da9d54c4174ebc82b29d7718839029 (diff) | |
download | strace-856c7ed97bce524ade99bb1fc41e746973d45acc.tar.gz |
Enhance decoding for personalities with small wordsize
* util.c (umoven, umovestr) [SUPPORTED_PERSONALITIES > 1]: If current
personality's wordsize is less than sizeof(long), use only significant
bits of the given address.
-rw-r--r-- | util.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -785,6 +785,11 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr) char x[sizeof(long)]; } u; +#if SUPPORTED_PERSONALITIES > 1 + if (personality_wordsize[current_personality] < sizeof(addr)) + addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1; +#endif + if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */ n = addr - (addr & -sizeof(long)); /* residue */ @@ -902,6 +907,11 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr) char x[sizeof(long)]; } u; +#if SUPPORTED_PERSONALITIES > 1 + if (personality_wordsize[current_personality] < sizeof(addr)) + addr &= (1ul << 8 * personality_wordsize[current_personality]) - 1; +#endif + if (addr & (sizeof(long) - 1)) { /* addr not a multiple of sizeof(long) */ n = addr - (addr & -sizeof(long)); /* residue */ |