diff --git a/iop/kernel/include/defs.h b/iop/kernel/include/defs.h index 8f58b2f79b6..fc5e86f5cd5 100644 --- a/iop/kernel/include/defs.h +++ b/iop/kernel/include/defs.h @@ -34,50 +34,38 @@ extern "C" { #define KSEG1ADDR(a) ((__typeof__(a))(((u32)(a) & 0x1fffffff) | KSEG1)) #if !defined(USE_GP_REGISTER) -#if __GNUC__ > 3 -#define USE_GP_REGISTER 0 -#else #define USE_GP_REGISTER 1 #endif -#endif - -#if USE_GP_REGISTER -static __inline__ void *ChangeGP(void *gp) -{ - void *OldGP; - - __asm__ volatile( "move %0, $gp\n" - "move $gp, %1" - : "=&r"(OldGP) - : "r"(gp) - : "gp", "memory"); - - return OldGP; -} static __inline__ void SetGP(void *gp) { - __asm__ volatile( "move $gp, %0" - : - : "r"(gp) - : "gp", "memory"); + register void *gpReg __asm__("gp"); + + gpReg = gp; + __asm__ __volatile__(" " ::"r"(gpReg)); } extern void *_gp; -#define SetModuleGP() ChangeGP(&_gp) static __inline__ void *GetGP(void) { - void *gp; + register void *gpReg __asm__("gp"); - __asm__ volatile( "move %0, $gp" - : "=r"(gp) - : - : "memory"); + __asm__ __volatile__(" " : "=r"(gpReg)); + return gpReg; +} + +static __inline__ void *ChangeGP(void *gp) +{ + void *OldGP; - return gp; + OldGP = GetGP(); + SetGP(gp); + + return OldGP; } -#endif + +#define SetModuleGP() ChangeGP(&_gp) static inline void *iop_memcpy(void *dest, const void *src, int size) { diff --git a/iop/network/smap/src/main.c b/iop/network/smap/src/main.c index 96f5a96d631..cc48d26d815 100644 --- a/iop/network/smap/src/main.c +++ b/iop/network/smap/src/main.c @@ -2,6 +2,7 @@ #include #endif #include +#include #ifdef BUILDING_SMAP_PS2IP #include #endif @@ -274,7 +275,7 @@ extern struct irx_export_table _exp_smap __attribute__((section("data"))); #endif #ifdef BUILDING_SMAP_MODULAR -extern struct irx_export_table _exp_smapmodu; +extern struct irx_export_table _exp_smapmodu __attribute__((section("data"))); #endif int _start(int argc, char *argv[]) diff --git a/iop/network/smap/src/smap.c b/iop/network/smap/src/smap.c index 69b2297addf..c53bf7373ac 100644 --- a/iop/network/smap/src/smap.c +++ b/iop/network/smap/src/smap.c @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/iop/usb/usbd/src/usbdpriv.h b/iop/usb/usbd/src/usbdpriv.h index d1fd5ebabf8..457f0e516f5 100644 --- a/iop/usb/usbd/src/usbdpriv.h +++ b/iop/usb/usbd/src/usbdpriv.h @@ -18,6 +18,7 @@ #include "usbd.h" #include "types.h" +#include "defs.h" #define OHCI_REG_BASE 0xBF801600