Enforce aligned pc
PATCH 1/1 Enforce aligned pc
Hi,
this patch makes qemu throw an exception when the PC is not aligned to a word boundary.
Signature · 1 line
Marius
translate.c +6 -0
@@ -1320,6 +1707,12 @@uint16_t op, op1;int16_t imm; +/* make sure instructions are on a word boundary */ +if (ctx->pc &0x3 ) { +generate_exception (ctx, EXCP_AdEL); +return ; + } +if ((ctx->hflags &MIPS_HFLAG_BMASK ) ==MIPS_HFLAG_BL ) {/* Handle blikely not taken case */ MIPS_DEBUG ("blikely condition (%08x)" , ctx->pc +4 );
Is it possible that the pc gets unaligned ?
Fabrice.
Quoted 3 lines · Marius Groeger
Hi,
this patch makes qemu throw an exception when the PC is not aligned to a word boundary.
Quoted 1 line · Fabrice Bellard
Is it possible that the pc gets unaligned ?
Yes, e.g. due to stack corruption which overwrites the return address.
Thiemo