1
0
Fork 0
forked from len0rd/rockbox

remove MEM_FUNCTION_WRAPPERS, and private mem* implementations from plugins, and replace with pluginlib implementations in plugins/lib/gcc-support.c

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19847 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Andrew Mahone 2009-01-24 22:57:57 +00:00
parent 2490262eee
commit 499426caf9
27 changed files with 20 additions and 104 deletions

View file

@ -853,26 +853,6 @@ extern const struct plugin_api *rb;
enum plugin_status plugin_start(const void* parameter)
NO_PROF_ATTR;
/* Use this macro in plugins where gcc tries to optimize by calling
* these functions directly */
#define MEM_FUNCTION_WRAPPERS \
void *memcpy(void *dest, const void *src, size_t n) \
{ \
return rb->memcpy(dest, src, n); \
} \
void *memset(void *dest, int c, size_t n) \
{ \
return rb->memset(dest, c, n); \
} \
void *memmove(void *dest, const void *src, size_t n) \
{ \
return rb->memmove(dest, src, n); \
} \
int memcmp(const void *s1, const void *s2, size_t n) \
{ \
return rb->memcmp(s1, s2, n); \
}
#undef CACHE_FUNCTION_WRAPPERS
#ifdef CACHE_FUNCTIONS_AS_CALL
#define CACHE_FUNCTION_WRAPPERS \

View file

@ -196,7 +196,6 @@ PLUGIN_HEADER
#endif
/****************************** Plugin Entry Point ****************************/
MEM_FUNCTION_WRAPPERS;
int main(void);
bool exit_tsr(bool);
void thread(void);

View file

@ -390,8 +390,6 @@ extern const fb_data card_back[];
#define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]]
MEM_FUNCTION_WRAPPERS;
/* dealer and player card positions */
unsigned int dealer_x, dealer_y, player_x, player_y;

View file

@ -355,8 +355,6 @@ PLUGIN_HEADER
static struct ts_raster calc_raster = { X_0_POS, Y_1_POS, BUTTON_COLS*REC_WIDTH, BUTTON_ROWS*REC_HEIGHT, REC_WIDTH, REC_HEIGHT };
#endif
MEM_FUNCTION_WRAPPERS;
enum {
basicButtons,
sciButtons

View file

@ -186,8 +186,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define CELL_WIDTH (LCD_WIDTH / 7)
#define CELL_HEIGHT (LCD_HEIGHT / 7)
MEM_FUNCTION_WRAPPERS
static bool leap_year;
/* days_in_month[][0] is for December */
static const int days_in_month[2][13] = {

View file

@ -86,12 +86,6 @@ const char *level_string[] = { "Level 1: 60 moves / 5 min" ,
/* "While thinking" command */
int wt_command = COMMAND_NOP;
/* GCC wants this to be present for some targets */
void* memcpy(void* dst, const void* src, size_t size)
{
return rb->memcpy(dst, src, size);
}
/* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */
void xy2cr ( short x, short y, short *c, short *r ) {
if (computer == black ) {

View file

@ -257,7 +257,6 @@ PLUGIN_HEADER
#define FIRST_LINE 0
#endif
MEM_FUNCTION_WRAPPERS;
#define MAX_PLAYERS 10
static struct {

View file

@ -21,7 +21,6 @@
#include "plugin.h"
PLUGIN_HEADER
MEM_FUNCTION_WRAPPERS
/* function return values */
enum tidy_return

View file

@ -76,8 +76,6 @@ GREY_INFO_STRUCT
/******************************* Globals ***********************************/
MEM_FUNCTION_WRAPPERS;
static int slideshow_enabled = false; /* run slideshow */
static int running_slideshow = false; /* loading image because of slideshw */
#ifndef SIMULATOR

View file

@ -63,7 +63,6 @@ union hash
uint32_t words[4];
};
MEM_FUNCTION_WRAPPERS;
static char buffer[sizeof(struct pw_entry)*MAX_ENTRIES];
static int bytes_read = 0; /* bytes read into the buffer */
static struct gui_synclist kb_list;

View file

@ -1,7 +1,4 @@
#ifdef CPU_ARM
/* For now, only ARM uses this for __div0 */
gcc-support.c
#endif
oldmenuapi.c
configfile.c
fixedpoint.c

View file

@ -28,3 +28,23 @@ void __attribute__((naked)) __div0(void)
asm volatile("bx %0" : : "r"(rb->__div0));
}
#endif
void *memcpy(void *dest, const void *src, size_t n)
{
return rb->memcpy(dest, src, n);
}
void *memset(void *dest, int c, size_t n)
{
return rb->memset(dest, c, n);
}
void *memmove(void *dest, const void *src, size_t n)
{
return rb->memmove(dest, src, n);
}
int memcmp(const void *s1, const void *s2, size_t n)
{
return rb->memcmp(s1, s2, n);
}

View file

@ -32,8 +32,6 @@ PLUGIN_HEADER
const struct button_mapping *plugin_contexts[]
= {generic_directions, generic_actions};
MEM_FUNCTION_WRAPPERS;
/* Use the standard plugin buttons rather than a hard-to-maintain list of
* MazezaM specific buttons. */
#define MAZEZAM_UP PLA_UP

View file

@ -24,8 +24,6 @@
PLUGIN_HEADER
MEM_FUNCTION_WRAPPERS;
#define BUFFERSIZE 16384
static int count = 0;

View file

@ -667,8 +667,6 @@ const struct button_mapping *plugin_contexts[] =
};
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
MEM_FUNCTION_WRAPPERS;
static int bpm = 120;
static int period = 0;
static int minitick = 0;

View file

@ -17,8 +17,6 @@
PLUGIN_HEADER
PLUGIN_IRAM_DECLARE
MEM_FUNCTION_WRAPPERS;
#define SAMP_PER_FRAME 1152
#define SAMPL2 576
#define SBLIMIT 32

View file

@ -153,21 +153,6 @@ bool mpeg_alloc_init(unsigned char *buf, size_t mallocsize)
return true;
}
/* gcc may want to use memcpy before rb is initialised, so here's a trivial
implementation */
void *memcpy(void *dest, const void *src, size_t n)
{
size_t i;
char* d=(char*)dest;
char* s=(char*)src;
for (i=0;i<n;i++)
d[i]=s[i];
return dest;
}
/* allocate non-dedicated buffer space which mpeg2_mem_reset will free */
void * mpeg2_malloc(unsigned size, mpeg2_alloc_t reason)
{
@ -247,13 +232,3 @@ void codec_free(void* ptr)
(void)ptr;
}
void *memmove(void *dest, const void *src, size_t n)
{
return rb->memmove(dest,src,n);
}
void *memset(void *s, int c, size_t n)
{
return rb->memset(s,c,n);
}

View file

@ -35,8 +35,6 @@
PLUGIN_HEADER
MEM_FUNCTION_WRAPPERS
/******************************* Globals ***********************************/
const struct button_mapping *plugin_contexts[]

View file

@ -22,8 +22,6 @@
PLUGIN_HEADER
MEM_FUNCTION_WRAPPERS;
bool its_a_dir = false;
char str_filename[MAX_PATH];

View file

@ -626,8 +626,6 @@ int screen[X_MAX + 1][Y_MAX + 1];
*
*****************************************************************************/
MEM_FUNCTION_WRAPPERS
static void drawchar(int x, int y, char c)
{
char str[2];

View file

@ -58,13 +58,6 @@ void *my_malloc(size_t size)
return alloc;
}
/* Using #define isn't enough with GCC 4.0.1 */
void* memcpy(void* dst, const void* src, size_t size)
{
return rb->memcpy(dst, src, size);
}
static void setoptions (void)
{
int fd;

View file

@ -306,8 +306,6 @@ extern int errno;
int errno;
#endif
MEM_FUNCTION_WRAPPERS;
static int drawcolor=0; /* Current color (in palette) */
static int bgdrawcolor=9; /* Current background color (in palette) */
bool isbg = false; /* gruik ugly hack alert */

View file

@ -21,7 +21,6 @@
****************************************************************************/
#include "shortcuts.h"
MEM_FUNCTION_WRAPPERS;
#define SHORTCUTS_FILENAME "/shortcuts.link"

View file

@ -467,8 +467,6 @@ static struct BufferedBoards {
} buffered_boards;
MEM_FUNCTION_WRAPPERS;
static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */

View file

@ -35,8 +35,6 @@ GREY_INFO_STRUCT
static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT +
BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)];
MEM_FUNCTION_WRAPPERS
/* this is the plugin entry point */
enum plugin_status plugin_start(const void* parameter)
{

View file

@ -29,14 +29,6 @@ PLUGIN_HEADER
#define SAMPLES_PER_BLOCK 22050
void *memset(void *s, int c, size_t n) {
return(rb->memset(s,c,n));
}
void *memcpy(void *dest, const void *src, size_t n) {
return(rb->memcpy(dest,src,n));
}
static char *audiobuf;
static ssize_t audiobuflen;

View file

@ -306,8 +306,6 @@ static int speed = 6; /* CYCLETIME = (11-speed)*10 ms */
static int difficulty = 75; /* Percentage of screen that needs to be filled
* in order to win the game */
MEM_FUNCTION_WRAPPERS;
static bool quit = false;
static unsigned int board[BOARD_H][BOARD_W];