From 25a82c5feb4af0822de32aaf5e10c58df0e700f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20G?= Date: Tue, 12 Mar 2013 00:00:49 +0100 Subject: [PATCH 1/2] add pspLl and pspSc to inline.h --- include/common/inline.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/common/inline.h b/include/common/inline.h index 400aa78..3e2dc62 100644 --- a/include/common/inline.h +++ b/include/common/inline.h @@ -48,3 +48,16 @@ static inline s32 pspMfic(void) return ret; } +static inline s32 pspLl(s32 *ptr) +{ + s32 ret; + asm ("ll %0, (%1)" : "=r" (ret) : "r" (ptr)); + return ret; +} + +static inline s32 pspSc(s32 value, s32 *ptr) +{ + s32 ret = value; + asm ("sc %0, (%1)" : "=r" (ret) : "r" (ptr)); + return ret; +} From 140f2caad9a08acdd78e7437056d024fce468799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20G?= Date: Tue, 12 Mar 2013 00:02:27 +0100 Subject: [PATCH 2/2] add volatile attributes in inline.h --- include/common/inline.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/common/inline.h b/include/common/inline.h index 3e2dc62..a50f5c6 100644 --- a/include/common/inline.h +++ b/include/common/inline.h @@ -6,56 +6,56 @@ # error "Only include common_imp.h or common_header.h!" #endif -static inline s32 pspMax(s32 a, s32 b) +static volatile inline s32 pspMax(s32 a, s32 b) { s32 ret; asm("max %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b)); return ret; } -static inline s32 pspMin(s32 a, s32 b) +static volatile inline s32 pspMin(s32 a, s32 b) { s32 ret; asm("min %0, %1, %2" : "=r" (ret) : "r" (a), "r" (b)); return ret; } -static inline void pspSync(void) +static volatile inline void pspSync(void) { asm("sync"); } -static inline void pspCache(char op, const void *ptr) +static volatile inline void pspCache(char op, const void *ptr) { asm("cache %0, 0(%1)" : : "ri" (op), "r" (ptr)); } -static inline void pspBreak(s32 op) +static volatile inline void pspBreak(s32 op) { asm("break %0" : : "ri" (op)); } -static inline void pspHalt(void) +static volatile inline void pspHalt(void) { /* The 'HALT' instruction */ asm(".word 0x70000000"); } -static inline s32 pspMfic(void) +static volatile inline s32 pspMfic(void) { s32 ret; asm("mfic %0, $0" : "=r" (ret)); return ret; } -static inline s32 pspLl(s32 *ptr) +static volatile inline s32 pspLl(s32 *ptr) { s32 ret; asm ("ll %0, (%1)" : "=r" (ret) : "r" (ptr)); return ret; } -static inline s32 pspSc(s32 value, s32 *ptr) +static volatile inline s32 pspSc(s32 value, s32 *ptr) { s32 ret = value; asm ("sc %0, (%1)" : "=r" (ret) : "r" (ptr));