"Dmitry V. Levin" <ldv-u2l5PoMzF/vg9huczpv...@public.gmane.org> writes:

> On Tue, Nov 03, 2009 at 01:56:46PM +0100, Andreas Schwab wrote:
>> * linux/powerpc/syscallent.h (sys_readahead): Account for 64bit
>> alignment on powerpc32.
>> * file.c (sys_readahead): Align 64bit arg.
>
> Looks OK.  By the way, do sys_fadvise64() and sys_fadvise64_64() need the
> same fix?

Good catch.  Also, PowerPC64 needs the same treatment as the other 64bit
architectures.

Andreas.

>From 5ece400d716bf1741b97c32128391e3d65d2d6b6 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <sch...@redhat.com>
Date: Tue, 3 Nov 2009 15:21:14 +0100
Subject: [PATCH] Correct decoding of readahead and fadvice64(_64) on PowerPC

* file.c (sys_readahead): Align 64bit argument.  Handle PowerPC64
like other 64bit architectures.
(sys_fadvise64): Likewise.
(sys_fadvise64_64): Handle PowerPC like ARM.
* linux/powerpc/syscallent.h (sys_readahead): Account for 64bit
argument alignment on PowerPC32.
---
 file.c                     |    8 +++++---
 linux/powerpc/syscallent.h |    2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/file.c b/file.c
index 2197cdc..2e46284 100644
--- a/file.c
+++ b/file.c
@@ -610,10 +610,11 @@ int
 sys_readahead(struct tcb *tcp)
 {
        if (entering(tcp)) {
+               ALIGN64 (tcp, 1);
                tprintf("%ld, %lld, %ld", tcp->u_arg[0],
 # if defined LINUX_MIPSN32
                        tcp->ext_arg[1], tcp->u_arg[2]
-# elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
+# elif defined IA64 || defined X86_64 || defined ALPHA || defined 
LINUX_MIPSN64 || (defined POWERPC && defined __powerpc64__)
                        (long long int) tcp->u_arg[1], tcp->u_arg[2]
 # else
                        LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]
@@ -2815,9 +2816,10 @@ int
 sys_fadvise64(struct tcb *tcp)
 {
        if (entering(tcp)) {
+               ALIGN64(tcp, 1);
                tprintf("%ld, %lld, %ld, ",
                        tcp->u_arg[0],
-# if defined IA64 || defined X86_64 || defined ALPHA
+# if defined IA64 || defined X86_64 || defined ALPHA || (defined POWERPC && 
defined __powerpc64__)
                        (long long int) tcp->u_arg[1], tcp->u_arg[2]);
                printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
 #else
@@ -2842,7 +2844,7 @@ sys_fadvise64_64(struct tcb *tcp)
 #elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
                        (long long int) tcp->u_arg[1], (long long int) 
tcp->u_arg[2]);
                printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
-#elif defined ARM
+#elif defined ARM || defined POWERPC
                        LONG_LONG(tcp->u_arg[2], tcp->u_arg[3]),
                        LONG_LONG(tcp->u_arg[4], tcp->u_arg[5]));
                printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h
index 116edc8..ecf7245 100644
--- a/linux/powerpc/syscallent.h
+++ b/linux/powerpc/syscallent.h
@@ -219,7 +219,7 @@
        { 5,    0,      sys_putpmsg,            "putpmsg"               }, /* 
188 */
        { 0,    TP,     sys_vfork,              "vfork"                 }, /* 
189 */
        { 2,    0,      sys_getrlimit,          "getrlimit"             }, /* 
190 */
-       { 4,    TD,     sys_readahead,          "readahead"             }, /* 
190 */
+       { 5,    TD,     sys_readahead,          "readahead"             }, /* 
190 */
        { 6,    0,      sys_mmap,               "mmap2"                 }, /* 
192 */
        { 4,    TF,     sys_truncate64,         "truncate64"            }, /* 
193 */
        { 4,    TD,     sys_ftruncate64,        "ftruncate64"           }, /* 
194 */
-- 
1.6.5.1


-- 
Andreas Schwab, sch...@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to