patches/glibc/2.3.2/glibc-2.3.2-sh4-trapa.patch
changeset 301 2be7232a73ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.3.2/glibc-2.3.2-sh4-trapa.patch	Sat Jul 28 21:34:41 2007 +0000
     1.3 @@ -0,0 +1,55 @@
     1.4 +http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/unix/sysv/linux/sh/sysdep.h.diff?r1=1.9&r2=1.10&cvsroot=glibc
     1.5 +
     1.6 +Ankur Sheth said:
     1.7 +
     1.8 +"This is actually a workaround for a bug in the sh4.  The actual bug is
     1.9 +documented here :
    1.10 +http://documentation.renesas.com/eng/products/mpumcu/tu/tnsh7456ae.pdf
    1.11 +Basically the cache & TLB should not be accessed for 4 (or was it 5?) cycles
    1.12 +after isssuing a TRAPA instruction.  I didn't run into any specific problem
    1.13 +because of this bug, but it seems useful to have and the patch itself seems
    1.14 +pretty harmless."
    1.15 +
    1.16 +
    1.17 +===================================================================
    1.18 +RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/sh/sysdep.h,v
    1.19 +retrieving revision 1.9
    1.20 +retrieving revision 1.10
    1.21 +diff -u -r1.9 -r1.10
    1.22 +--- libc/sysdeps/unix/sysv/linux/sh/sysdep.h	2003/09/01 04:05:21	1.9
    1.23 ++++ libc/sysdeps/unix/sysv/linux/sh/sysdep.h	2003/10/15 04:36:32	1.10
    1.24 +@@ -183,6 +183,13 @@
    1.25 + # endif	/* _LIBC_REENTRANT */
    1.26 + #endif	/* PIC */
    1.27 + 
    1.28 ++# ifdef NEED_SYSCALL_INST_PAD
    1.29 ++#  define SYSCALL_INST_PAD \
    1.30 ++	or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0
    1.31 ++# else
    1.32 ++#  define SYSCALL_INST_PAD
    1.33 ++# endif
    1.34 ++
    1.35 + #define SYSCALL_INST0	trapa #0x10
    1.36 + #define SYSCALL_INST1	trapa #0x11
    1.37 + #define SYSCALL_INST2	trapa #0x12
    1.38 +@@ -195,19 +202,13 @@
    1.39 + #define DO_CALL(syscall_name, args)	\
    1.40 +     mov.l 1f,r3;			\
    1.41 +     SYSCALL_INST##args;			\
    1.42 ++    SYSCALL_INST_PAD;			\
    1.43 +     bra 2f;				\
    1.44 +      nop;				\
    1.45 +     .align 2;				\
    1.46 +  1: .long SYS_ify (syscall_name);	\
    1.47 +  2:
    1.48 + 
    1.49 +-# ifdef NEED_SYSCALL_INST_PAD
    1.50 +-#  define SYSCALL_INST_PAD \
    1.51 +-	or r0,r0; or r0,r0; or r0,r0; or r0,r0; or r0,r0
    1.52 +-# else
    1.53 +-#  define SYSCALL_INST_PAD
    1.54 +-# endif
    1.55 +-
    1.56 + #else /* not __ASSEMBLER__ */
    1.57 + 
    1.58 + #define SYSCALL_INST_STR0	"trapa #0x10\n\t"