00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __HANDLER_UTILS_H__
00021 #define __HANDLER_UTILS_H__
00022
00023 struct spe_reg128 {
00024 unsigned int slot[4];
00025 };
00026
00027 #ifndef LS_SIZE
00028 #define LS_SIZE 0x40000
00029 #define LS_ADDR_MASK (LS_SIZE - 1)
00030 #endif
00031
00032 #define __PRINTF(fmt, args...) { fprintf(stderr,fmt , ## args); }
00033 #ifdef DEBUG
00034 #define DEBUG_PRINTF(fmt, args...) __PRINTF(fmt , ## args)
00035 #else
00036 #define DEBUG_PRINTF(fmt, args...)
00037 #endif
00038
00039 #define LS_ARG_ADDR(_index) \
00040 (&((struct spe_reg128 *) ((char *) ls + ls_args))[_index])
00041
00042 #define DECL_RET() \
00043 struct spe_reg128 *ret = LS_ARG_ADDR(0)
00044
00045 #define GET_LS_PTR(_off) \
00046 (void *) ((char *) ls + ((_off) & LS_ADDR_MASK))
00047
00048 #define GET_LS_PTR_NULL(_off) \
00049 ((_off) ? GET_LS_PTR(_off) : NULL)
00050
00051 #define DECL_0_ARGS() \
00052 unsigned int ls_args = (opdata & 0xffffff)
00053
00054 #define DECL_1_ARGS() \
00055 DECL_0_ARGS(); \
00056 struct spe_reg128 *arg0 = LS_ARG_ADDR(0)
00057
00058 #define DECL_2_ARGS() \
00059 DECL_1_ARGS(); \
00060 struct spe_reg128 *arg1 = LS_ARG_ADDR(1)
00061
00062 #define DECL_3_ARGS() \
00063 DECL_2_ARGS(); \
00064 struct spe_reg128 *arg2 = LS_ARG_ADDR(2)
00065
00066 #define DECL_4_ARGS() \
00067 DECL_3_ARGS(); \
00068 struct spe_reg128 *arg3 = LS_ARG_ADDR(3)
00069
00070 #define DECL_5_ARGS() \
00071 DECL_4_ARGS(); \
00072 struct spe_reg128 *arg4 = LS_ARG_ADDR(4)
00073
00074 #define DECL_6_ARGS() \
00075 DECL_5_ARGS(); \
00076 struct spe_reg128 *arg5 = LS_ARG_ADDR(5)
00077
00078 #define PUT_LS_RC(_a, _b, _c, _d) \
00079 ret->slot[0] = (unsigned int) (_a); \
00080 ret->slot[1] = (unsigned int) (_b); \
00081 ret->slot[2] = (unsigned int) (_c); \
00082 ret->slot[3] = (unsigned int) (_d); \
00083 __asm__ __volatile__ ("sync" : : : "memory")
00084
00085 #endif