| /* CODE_ADDRESS is the address of the code jumped to through the code field */ |
/* CODE_ADDRESS is the address of the code jumped to through the code field */ |
| # define CODE_ADDRESS(cfa) ((Label)(((*(unsigned *)(cfa))^JAL_PATTERN^(SEGMENT_NUM<<26))<<2)) |
# define CODE_ADDRESS(cfa) ((Label)(((*(unsigned *)(cfa))^JAL_PATTERN^(SEGMENT_NUM<<26))<<2)) |
| # define MAKE_CF(cfa,ca) ({long *_cfa = (long *)(cfa); \ |
# define MAKE_CF(cfa,ca) ({long *_cfa = (long *)(cfa); \ |
| long _ca = (long)(ca); |
long _ca = (long)(ca); \ |
| _cfa[0] = JAL_PATTERN|(((((long)_ca)>>2)+4)&JUMP_MASK), /* JAL ca+4 */ \ |
_cfa[0] = JAL_PATTERN|(((((long)_ca)>>2))&JUMP_MASK); /* JAL ca+4 */ \ |
| _cfa[1] = *(long *)_ca; /* delay slot */}) |
_cfa[1] = 0; /* *(long *)_ca; delay slot */}) |
| # endif /* undefined */ |
# endif /* undefined */ |
| |
|
| /* this is the point where the does code starts if label points to the |
/* this is the point where the does code starts if label points to the |
| # define DOES_CODE1(cfa) DOES_CODE(cfa) |
# define DOES_CODE1(cfa) DOES_CODE(cfa) |
| |
|
| # define DOES_HANDLER_SIZE 8 |
# define DOES_HANDLER_SIZE 8 |
| |
# define MAKE_DOES_CF(cfa,does_code) \ |
| |
({long does_handlerp=((long)(does_code))-DOES_HANDLER_SIZE; \ |
| |
long *_cfa = (long*)(cfa); \ |
| |
_cfa[0] = J_PATTERN|((does_handlerp&JUMP_MASK)>>2); /* J ca */ \ |
| |
_cfa[1] = 0; /* nop */}) |
| |
/* |
| # define MAKE_DOES_CF(cfa, does_code) ({char *does_handlerp=((char *)does_code)-DOES_HANDLER_SIZE; \ |
# define MAKE_DOES_CF(cfa, does_code) ({char *does_handlerp=((char *)does_code)-DOES_HANDLER_SIZE; \ |
| MAKE_CF(cfa,does_handlerp); \ |
MAKE_CF(cfa,does_handlerp); \ |
| MAKE_DOES_HANDLER(does_handlerp);}) |
MAKE_DOES_HANDLER(does_handlerp);}) |
| |
*/ |
| /* this stores a jump dodoes at addr */ |
/* this stores a jump dodoes at addr */ |
| # define MAKE_DOES_HANDLER(addr) ({long * _addr = (long *)addr; \ |
# define MAKE_DOES_HANDLER(addr) MAKE_CF(addr,symbols[DODOES]) |
| _addr[0] = J_PATTERN|((((long)DODOES)>>2)&JUMP_MASK); /* J dodoes */ \ |
|
| _addr[1] = 0; /* nop */}) |
|
| #endif |
#endif |
| #ifdef undefined |
#ifdef undefined |
| /* and here are some more efficient versions that can be tried later */ |
/* and here are some more efficient versions that can be tried later */ |
| */ |
*/ |
| |
|
| #define MAKE_DOESJUMP(addr) ({long * _addr = (long *)addr; \ |
#define MAKE_DOESJUMP(addr) ({long * _addr = (long *)addr; \ |
| _addr[0] = J_PATTERN|(((((long)symbols[3])>>2)+4)&JUMP_MASK), /* J dodoes+4 */ \ |
_addr[0] = J_PATTERN|(((((long)symbols[DODOES])>>2)+4)&JUMP_MASK), /* J dodoes+4 */ \ |
| _addr[1] = *(long *)symbols[3]; /* delay */}) |
_addr[1] = *(long *)symbols[DODOES]; /* delay */}) |
| |
|
| /* the following version uses JAL to make DOES_CODE1 faster */ |
/* the following version uses JAL to make DOES_CODE1 faster */ |
| /* !! does the declaration clear the register ? */ |
/* !! does the declaration clear the register ? */ |
| /* it's ok to use the same reg as in PFA1: |
/* it's ok to use the same reg as in PFA1: |
| dodoes is the only potential problem and I have taken care of it */ |
dodoes is the only potential problem and I have taken care of it */ |
| |
|
| #define DOES_CODE1(cfa) ({register Code *_does_code asm("$31"); \ |
#define DOES_CODE1(cfa) ({register Code *_does_code asm("$31"); \ |
| _does_code; }) |
_does_code; }) |
| #define MAKE_DOESJUMP(addr) ({long * _addr = (long *)addr; \ |
#define MAKE_DOESJUMP(addr) ({long * _addr = (long *)addr; \ |
| _addr[0] = JAL_PATTERN|(((((long)symbols[3])>>2)+4)&JUMP_MASK), /* JAL dodoes+4 */ \ |
_addr[0] = JAL_PATTERN|(((((long)symbols[DODOES])>>2)+4)&JUMP_MASK), /* JAL dodoes+4 */ \ |
| _addr[1] = *(long *)symbols[3]; /* delay */}) |
_addr[1] = *(long *)symbols[DODOES]; /* delay */}) |
| |
|
| #endif |
#endif |
| |
|