From bce144211cd70e1be78b7c1b7424fb4609de1ac8 Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 13 Oct 2017 23:30:44 +0300 Subject: [PATCH] some portability cleanups --- cpu/drc/cmn.c | 2 +- cpu/sh2/sh2.h | 6 +----- pico/pico_int.h | 20 +------------------- pico/pico_port.h | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 25 deletions(-) create mode 100644 pico/pico_port.h diff --git a/cpu/drc/cmn.c b/cpu/drc/cmn.c index 37f17ce9..acff42c8 100644 --- a/cpu/drc/cmn.c +++ b/cpu/drc/cmn.c @@ -10,7 +10,7 @@ #include #include "cmn.h" -u8 __attribute__((aligned(4096))) tcache[DRC_TCACHE_SIZE]; +u8 ALIGNED(4096) tcache[DRC_TCACHE_SIZE]; void drc_cmn_init(void) diff --git a/cpu/sh2/sh2.h b/cpu/sh2/sh2.h index 1394f94a..49695b1e 100644 --- a/cpu/sh2/sh2.h +++ b/cpu/sh2/sh2.h @@ -1,11 +1,7 @@ #ifndef __SH2_H__ #define __SH2_H__ -#if !defined(REGPARM) && defined(__i386__) -#define REGPARM(x) __attribute__((regparm(x))) -#else -#define REGPARM(x) -#endif +#include "../../pico/pico_port.h" // registers - matches structure order typedef enum { diff --git a/pico/pico_int.h b/pico/pico_int.h index 369bb5d7..d4fc8357 100644 --- a/pico/pico_int.h +++ b/pico/pico_int.h @@ -13,6 +13,7 @@ #include #include #include +#include "pico_port.h" #include "pico.h" #include "carthw/carthw.h" @@ -1072,25 +1073,6 @@ void pevt_dump(void); #define pevt_dump() #endif -// misc -#ifdef _MSC_VER -#define cdprintf -#else -#define cdprintf(x...) -#endif - -#if defined(__GNUC__) && defined(__i386__) -#define REGPARM(x) __attribute__((regparm(x))) -#else -#define REGPARM(x) -#endif - -#ifdef __GNUC__ -#define NOINLINE __attribute__((noinline)) -#else -#define NOINLINE -#endif - #ifdef __cplusplus } // End of extern "C" #endif diff --git a/pico/pico_port.h b/pico/pico_port.h new file mode 100644 index 00000000..f1d95a56 --- /dev/null +++ b/pico/pico_port.h @@ -0,0 +1,18 @@ +#ifndef PICO_PORT_INCLUDED +#define PICO_PORT_INCLUDED + +#if defined(__GNUC__) && defined(__i386__) +#define REGPARM(x) __attribute__((regparm(x))) +#else +#define REGPARM(x) +#endif + +#ifdef __GNUC__ +#define NOINLINE __attribute__((noinline)) +#define ALIGNED(n) __attribute__((aligned(n))) +#else +#define NOINLINE +#define ALIGNED(n) +#endif + +#endif // PICO_PORT_INCLUDED -- 2.39.5