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:
parent
2490262eee
commit
499426caf9
27 changed files with 20 additions and 104 deletions
|
|
@ -853,26 +853,6 @@ extern const struct plugin_api *rb;
|
||||||
enum plugin_status plugin_start(const void* parameter)
|
enum plugin_status plugin_start(const void* parameter)
|
||||||
NO_PROF_ATTR;
|
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
|
#undef CACHE_FUNCTION_WRAPPERS
|
||||||
#ifdef CACHE_FUNCTIONS_AS_CALL
|
#ifdef CACHE_FUNCTIONS_AS_CALL
|
||||||
#define CACHE_FUNCTION_WRAPPERS \
|
#define CACHE_FUNCTION_WRAPPERS \
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,6 @@ PLUGIN_HEADER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************** Plugin Entry Point ****************************/
|
/****************************** Plugin Entry Point ****************************/
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
int main(void);
|
int main(void);
|
||||||
bool exit_tsr(bool);
|
bool exit_tsr(bool);
|
||||||
void thread(void);
|
void thread(void);
|
||||||
|
|
|
||||||
|
|
@ -390,8 +390,6 @@ extern const fb_data card_back[];
|
||||||
|
|
||||||
#define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]]
|
#define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]]
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
/* dealer and player card positions */
|
/* dealer and player card positions */
|
||||||
unsigned int dealer_x, dealer_y, player_x, player_y;
|
unsigned int dealer_x, dealer_y, player_x, player_y;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 };
|
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
|
#endif
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
basicButtons,
|
basicButtons,
|
||||||
sciButtons
|
sciButtons
|
||||||
|
|
|
||||||
|
|
@ -186,8 +186,6 @@ CONFIG_KEYPAD == SANSA_M200_PAD
|
||||||
#define CELL_WIDTH (LCD_WIDTH / 7)
|
#define CELL_WIDTH (LCD_WIDTH / 7)
|
||||||
#define CELL_HEIGHT (LCD_HEIGHT / 7)
|
#define CELL_HEIGHT (LCD_HEIGHT / 7)
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS
|
|
||||||
|
|
||||||
static bool leap_year;
|
static bool leap_year;
|
||||||
/* days_in_month[][0] is for December */
|
/* days_in_month[][0] is for December */
|
||||||
static const int days_in_month[2][13] = {
|
static const int days_in_month[2][13] = {
|
||||||
|
|
|
||||||
|
|
@ -86,12 +86,6 @@ const char *level_string[] = { "Level 1: 60 moves / 5 min" ,
|
||||||
/* "While thinking" command */
|
/* "While thinking" command */
|
||||||
int wt_command = COMMAND_NOP;
|
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 ---- */
|
/* ---- Get the board column and row (e2 f.e.) for a physical x y ---- */
|
||||||
void xy2cr ( short x, short y, short *c, short *r ) {
|
void xy2cr ( short x, short y, short *c, short *r ) {
|
||||||
if (computer == black ) {
|
if (computer == black ) {
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,6 @@ PLUGIN_HEADER
|
||||||
#define FIRST_LINE 0
|
#define FIRST_LINE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
#define MAX_PLAYERS 10
|
#define MAX_PLAYERS 10
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
MEM_FUNCTION_WRAPPERS
|
|
||||||
|
|
||||||
/* function return values */
|
/* function return values */
|
||||||
enum tidy_return
|
enum tidy_return
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,6 @@ GREY_INFO_STRUCT
|
||||||
|
|
||||||
/******************************* Globals ***********************************/
|
/******************************* Globals ***********************************/
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
static int slideshow_enabled = false; /* run slideshow */
|
static int slideshow_enabled = false; /* run slideshow */
|
||||||
static int running_slideshow = false; /* loading image because of slideshw */
|
static int running_slideshow = false; /* loading image because of slideshw */
|
||||||
#ifndef SIMULATOR
|
#ifndef SIMULATOR
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ union hash
|
||||||
uint32_t words[4];
|
uint32_t words[4];
|
||||||
};
|
};
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
static char buffer[sizeof(struct pw_entry)*MAX_ENTRIES];
|
static char buffer[sizeof(struct pw_entry)*MAX_ENTRIES];
|
||||||
static int bytes_read = 0; /* bytes read into the buffer */
|
static int bytes_read = 0; /* bytes read into the buffer */
|
||||||
static struct gui_synclist kb_list;
|
static struct gui_synclist kb_list;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,4 @@
|
||||||
#ifdef CPU_ARM
|
|
||||||
/* For now, only ARM uses this for __div0 */
|
|
||||||
gcc-support.c
|
gcc-support.c
|
||||||
#endif
|
|
||||||
oldmenuapi.c
|
oldmenuapi.c
|
||||||
configfile.c
|
configfile.c
|
||||||
fixedpoint.c
|
fixedpoint.c
|
||||||
|
|
|
||||||
|
|
@ -28,3 +28,23 @@ void __attribute__((naked)) __div0(void)
|
||||||
asm volatile("bx %0" : : "r"(rb->__div0));
|
asm volatile("bx %0" : : "r"(rb->__div0));
|
||||||
}
|
}
|
||||||
#endif
|
#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);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ PLUGIN_HEADER
|
||||||
const struct button_mapping *plugin_contexts[]
|
const struct button_mapping *plugin_contexts[]
|
||||||
= {generic_directions, generic_actions};
|
= {generic_directions, generic_actions};
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
/* Use the standard plugin buttons rather than a hard-to-maintain list of
|
/* Use the standard plugin buttons rather than a hard-to-maintain list of
|
||||||
* MazezaM specific buttons. */
|
* MazezaM specific buttons. */
|
||||||
#define MAZEZAM_UP PLA_UP
|
#define MAZEZAM_UP PLA_UP
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
#define BUFFERSIZE 16384
|
#define BUFFERSIZE 16384
|
||||||
|
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
|
|
|
||||||
|
|
@ -667,8 +667,6 @@ const struct button_mapping *plugin_contexts[] =
|
||||||
};
|
};
|
||||||
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
|
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
static int bpm = 120;
|
static int bpm = 120;
|
||||||
static int period = 0;
|
static int period = 0;
|
||||||
static int minitick = 0;
|
static int minitick = 0;
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
PLUGIN_IRAM_DECLARE
|
PLUGIN_IRAM_DECLARE
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
#define SAMP_PER_FRAME 1152
|
#define SAMP_PER_FRAME 1152
|
||||||
#define SAMPL2 576
|
#define SAMPL2 576
|
||||||
#define SBLIMIT 32
|
#define SBLIMIT 32
|
||||||
|
|
|
||||||
|
|
@ -153,21 +153,6 @@ bool mpeg_alloc_init(unsigned char *buf, size_t mallocsize)
|
||||||
return true;
|
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 */
|
/* allocate non-dedicated buffer space which mpeg2_mem_reset will free */
|
||||||
void * mpeg2_malloc(unsigned size, mpeg2_alloc_t reason)
|
void * mpeg2_malloc(unsigned size, mpeg2_alloc_t reason)
|
||||||
{
|
{
|
||||||
|
|
@ -247,13 +232,3 @@ void codec_free(void* ptr)
|
||||||
(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS
|
|
||||||
|
|
||||||
/******************************* Globals ***********************************/
|
/******************************* Globals ***********************************/
|
||||||
|
|
||||||
const struct button_mapping *plugin_contexts[]
|
const struct button_mapping *plugin_contexts[]
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@
|
||||||
|
|
||||||
PLUGIN_HEADER
|
PLUGIN_HEADER
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
bool its_a_dir = false;
|
bool its_a_dir = false;
|
||||||
|
|
||||||
char str_filename[MAX_PATH];
|
char str_filename[MAX_PATH];
|
||||||
|
|
|
||||||
|
|
@ -626,8 +626,6 @@ int screen[X_MAX + 1][Y_MAX + 1];
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS
|
|
||||||
|
|
||||||
static void drawchar(int x, int y, char c)
|
static void drawchar(int x, int y, char c)
|
||||||
{
|
{
|
||||||
char str[2];
|
char str[2];
|
||||||
|
|
|
||||||
|
|
@ -58,13 +58,6 @@ void *my_malloc(size_t size)
|
||||||
return alloc;
|
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)
|
static void setoptions (void)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
|
||||||
|
|
@ -306,8 +306,6 @@ extern int errno;
|
||||||
int errno;
|
int errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
static int drawcolor=0; /* Current color (in palette) */
|
static int drawcolor=0; /* Current color (in palette) */
|
||||||
static int bgdrawcolor=9; /* Current background color (in palette) */
|
static int bgdrawcolor=9; /* Current background color (in palette) */
|
||||||
bool isbg = false; /* gruik ugly hack alert */
|
bool isbg = false; /* gruik ugly hack alert */
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "shortcuts.h"
|
#include "shortcuts.h"
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
#define SHORTCUTS_FILENAME "/shortcuts.link"
|
#define SHORTCUTS_FILENAME "/shortcuts.link"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -467,8 +467,6 @@ static struct BufferedBoards {
|
||||||
} buffered_boards;
|
} buffered_boards;
|
||||||
|
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */
|
static char buf[ROWS*(COLS + 1)]; /* Enough for a whole board or a filename */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,6 @@ GREY_INFO_STRUCT
|
||||||
static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT +
|
static unsigned char grey_bm_buf[LCD_WIDTH * LCD_HEIGHT +
|
||||||
BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)];
|
BM_SCALED_SIZE(LCD_WIDTH,0,FORMAT_NATIVE,0)];
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS
|
|
||||||
|
|
||||||
/* this is the plugin entry point */
|
/* this is the plugin entry point */
|
||||||
enum plugin_status plugin_start(const void* parameter)
|
enum plugin_status plugin_start(const void* parameter)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,6 @@ PLUGIN_HEADER
|
||||||
|
|
||||||
#define SAMPLES_PER_BLOCK 22050
|
#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 char *audiobuf;
|
||||||
static ssize_t audiobuflen;
|
static ssize_t audiobuflen;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
static int difficulty = 75; /* Percentage of screen that needs to be filled
|
||||||
* in order to win the game */
|
* in order to win the game */
|
||||||
|
|
||||||
MEM_FUNCTION_WRAPPERS;
|
|
||||||
|
|
||||||
static bool quit = false;
|
static bool quit = false;
|
||||||
|
|
||||||
static unsigned int board[BOARD_H][BOARD_W];
|
static unsigned int board[BOARD_H][BOARD_W];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue