Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 4 /* bytes */
-#define REPLACEMENT_STUB_SIZE 5 /* words */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7596 2007-03-28 21:05:53Z twisti $
+ $Id: md.c 8247 2007-07-31 12:06:44Z michi $
*/
#if defined(ENABLE_REPLACEMENT)
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
{
- s4 disp;
u4 mcode;
if (index < 0) {
*(u4*)(savedmcode) = *(u4*)(rp->pc);
/* build the machine code for the patch */
- disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 1;
-
- /* BR */
- mcode = (((s4) (0x30)) << 26) | ((REG_ZERO) << 21) | ((disp) & 0x1fffff);
+ mcode = (0xa41f0000 | (EXCEPTION_HARDWARE_PATCHER));
/* write the new machine code */
*(u4*)(rp->pc) = mcode;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 8127 2007-06-21 11:55:56Z michi $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 4 /* bytes */
-#define REPLACEMENT_STUB_SIZE 5 /* words */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 8210 2007-07-18 12:51:00Z twisti $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 5 /* bytes */
-#define REPLACEMENT_STUB_SIZE (5+5+1) /* bytes */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7596 2007-03-28 21:05:53Z twisti $
+ $Id: md.c 8247 2007-07-31 12:06:44Z michi $
*/
#if defined(ENABLE_REPLACEMENT)
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
{
- s4 disp;
u8 mcode;
/* XXX this is probably unsafe! */
savedmcode[4] = rp->pc[4];
/* build the machine code for the patch */
- disp = (code->replacementstubs - rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 5;
-
- mcode = 0xe9 | ((u8) disp << 8);
+ assert(0); /* XXX build trap instruction below */
+ mcode = 0;
/* write spinning instruction */
*(u2*)(rp->pc) = 0xebfe;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE (2*4) /* bytes */
-#define REPLACEMENT_STUB_SIZE 6 /* words */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7596 2007-03-28 21:05:53Z twisti $
+ $Id: md.c 8247 2007-07-31 12:06:44Z michi $
*/
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp,
u1 *savedmcode)
{
- s4 disp;
union {
u8 both;
u4 words[2];
/* save the current machine code */
*(u8*)(savedmcode) = *(u8*)(rp->pc);
- /* make machine code for patching */
-
- disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 1;
-
- if ((disp < (s4) 0xffff8000) || (disp > (s4) 0x00007fff))
- vm_abort("Jump offset is out of range: %d > +/-%d",
- disp, 0x00007fff);
-
- /* BR */
- mcode.words[0] = (((0x04) << 26) | ((0) << 21) | ((0) << 16) | ((disp) & 0xffff));
- mcode.words[1] = 0; /* NOP in delay slot */
+ /* build the machine code for the patch */
+ assert(0); /* XXX build trap instruction below */
+ mcode.both = 0;
/* write the new machine code */
*(u8*)(rp->pc) = mcode.both;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 4 /* bytes */
-#define REPLACEMENT_STUB_SIZE 6 /* words */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7968 2007-05-25 15:05:04Z twisti $
+ $Id: md.c 8247 2007-07-31 12:06:44Z michi $
*/
#if defined(ENABLE_REPLACEMENT)
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
{
- s4 disp;
u4 mcode;
if (index < 0) {
*(u4*)(savedmcode) = *(u4*)(rp->pc);
/* build the machine code for the patch */
- disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 1;
-
- mcode = (18 << 26) | ((((disp) * 4) + 4) & M_BMASK);
+ assert(0); /* XXX build trap instruction below */
+ mcode = 0;
/* write the new machine code */
*(u4*)(rp->pc) = (u4) mcode;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 4 /* bytes */
-#define REPLACEMENT_STUB_SIZE 6 /* words */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7980 2007-05-30 16:01:09Z twisti $
+ $Id: md.c 8247 2007-07-31 12:06:44Z michi $
*/
#if defined(ENABLE_REPLACEMENT)
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
{
- s4 disp;
u4 mcode;
if (index < 0) {
*(u4*)(savedmcode) = *(u4*)(rp->pc);
/* build the machine code for the patch */
- disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 1;
-
- mcode = (18 << 26) | ((((disp) * 4) + 4) & M_BMASK);
+ assert(0); /* XXX build trap instruction below */
+ mcode = 0;
/* write the new machine code */
*(u4*)(rp->pc) = (u4) mcode;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 8240 2007-07-29 20:36:47Z pm $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 5 /* bytes */
-#define REPLACEMENT_STUB_SIZE (4+(4+4+4+4)+4+(4+4+4+4)+2) /* bytes */
/* misc ***********************************************************************/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 4 /* bytes */
-#define REPLACEMENT_STUB_SIZE 5 /* words */ /* XXX adapt for sparc64 */
#endif /* _ARCH_H */
#if defined(ENABLE_REPLACEMENT)
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
{
- s4 disp;
u4 mcode;
-
- assert(0);
if (index < 0) {
/* restore the patched-over instruction */
*(u4*)(savedmcode) = *(u4*)(rp->pc);
/* build the machine code for the patch */
- disp = ((u4*)code->replacementstubs - (u4*)rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 1;
-
- mcode = (((s4)(0x00))<<30) | ((0)<<29) | ((0x8)<<25) | (0x1<<22) | (0<<20)
- | (1 << 19 ) | ((disp) & 0x007ffff);
+ assert(0); /* XXX build trap instruction below */
+ mcode = 0;
/* write the new machine code */
*(u4*)(rp->pc) = (u4) mcode;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7695 2007-04-12 19:49:34Z twisti $
+ $Id: arch.h 8247 2007-07-31 12:06:44Z michi $
*/
/* replacement ****************************************************************/
#define REPLACEMENT_PATCH_SIZE 5 /* bytes */
-#define REPLACEMENT_STUB_SIZE (10+2+10+2+1) /* bytes */
#endif /* _ARCH_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md.c 7947 2007-05-23 15:57:41Z twisti $
+ $Id: md.c 8247 2007-07-31 12:06:44Z michi $
*/
#include "vm/jit/codegen-common.h"
#include "vm/jit/stacktrace.h"
+#if defined(ENABLE_REPLACEMENT)
+# include "vm/exceptions.h"
+#endif
+
#if !defined(NDEBUG) && defined(ENABLE_DISASSEMBLER)
#include "vmcore/options.h" /* XXX debug */
#include "vm/jit/disass.h" /* XXX debug */
#if defined(ENABLE_REPLACEMENT)
void md_patch_replacement_point(codeinfo *code, s4 index, rplpoint *rp, u1 *savedmcode)
{
- s4 disp;
u8 mcode;
/* XXX this is probably unsafe! */
savedmcode[4] = rp->pc[4];
/* build the machine code for the patch */
- disp = (code->replacementstubs - rp->pc)
- + index * REPLACEMENT_STUB_SIZE
- - 5;
-
- mcode = 0xe9 | ((u8) disp << 8);
+ assert(0); /* XXX build trap instruction below */
+ mcode = 0;
/* write spinning instruction */
*(u2*)(rp->pc) = 0xebfe;