This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, SPU] Add interrupt-safe critical section functions to spu_mfcio.h


Ok for both.

Trevor

* Ulrich Weigand <uweigand@de.ibm.com> [2008-08-22 09:45]:
> Hello,
> 
> this patch to spu_mfcio.h provides the functions to support interrupt-safe
> critical sections as defined in TWG RFC00130-2 (will be included in the
> upcoming version 2.6 of the C/C++ Language Extensions for Cell/B.E. 
> specification).
> 
> OK for mainline and 4.3?
> 
> Bye,
> Ulrich
> 
> 
> ChangeLog:
> 
> 	* config/spu/spu_mfcio.h (mfc_begin_critical_section): New function.
> 	(mfc_end_critical_section): Likewise.
> 
> 
> --- gcc-4.3.1/gcc/config/spu/spu_mfcio.h.orig	2008-08-22 16:43:50.000000000 +0200
> +++ gcc-4.3.1/gcc/config/spu/spu_mfcio.h	2008-08-22 16:43:56.000000000 +0200
> @@ -289,6 +289,34 @@ typedef struct mfc_list_element {
>  #define spu_write_srr0(srr0)          spu_writech(SPU_WrSRR0,srr0)
>  #define spu_read_srr0()               spu_readch(SPU_RdSRR0)
>  
> +/* Interrupt-Safe Critical Sections */
> +
> +static __inline__ unsigned int mfc_begin_critical_section (void)
> +  __attribute__ ((__always_inline__));
> +
> +static __inline__ unsigned int
> +mfc_begin_critical_section (void)
> +{
> +#ifdef SPU_MFCIO_INTERRUPT_SAFE
> +  unsigned int __status = spu_read_machine_status ();
> +  spu_idisable ();
> +  return __status;
> +#else
> +  return 0;
> +#endif
> +}
> +
> +static __inline__ void mfc_end_critical_section (unsigned int)
> +  __attribute__ ((__always_inline__));
> +
> +static __inline__ void
> +mfc_end_critical_section (unsigned int __status __attribute__ ((__unused__)))
> +{
> +#ifdef SPU_MFCIO_INTERRUPT_SAFE
> +  if (__status & 1)
> +    spu_ienable ();
> +#endif
> +}
>  
>  /* MFC Tag Manager */
>  
> -- 
>   Dr. Ulrich Weigand
>   GNU Toolchain for Linux on System z and Cell BE
>   Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]