* [Qemu-devel] [PATCH][MIPS] Enforce aligned pc
@ 2006-04-26 14:22 Marius Groeger
2006-04-26 22:07 ` Fabrice Bellard
0 siblings, 1 reply; 3+ messages in thread
From: Marius Groeger @ 2006-04-26 14:22 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 105 bytes --]
Hi,
this patch makes qemu throw an exception when the PC is not aligned to
a word boundary.
--
Marius
[-- Attachment #2: Type: TEXT/PLAIN, Size: 498 bytes --]
--- target-mips/translate.c 23 Apr 2006 15:21:24 -0000 1.12
+++ target-mips/translate.c 26 Apr 2006 14:02:19 -0000
@@ -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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH][MIPS] Enforce aligned pc
2006-04-26 14:22 [Qemu-devel] [PATCH][MIPS] Enforce aligned pc Marius Groeger
@ 2006-04-26 22:07 ` Fabrice Bellard
2006-04-26 22:53 ` Thiemo Seufer
0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Bellard @ 2006-04-26 22:07 UTC (permalink / raw)
To: qemu-devel
Is it possible that the pc gets unaligned ?
Fabrice.
Marius Groeger wrote:
> Hi,
>
> this patch makes qemu throw an exception when the PC is not aligned to a
> word boundary.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH][MIPS] Enforce aligned pc
2006-04-26 22:07 ` Fabrice Bellard
@ 2006-04-26 22:53 ` Thiemo Seufer
0 siblings, 0 replies; 3+ messages in thread
From: Thiemo Seufer @ 2006-04-26 22:53 UTC (permalink / raw)
To: qemu-devel
Fabrice Bellard wrote:
> Is it possible that the pc gets unaligned ?
Yes, e.g. due to stack corruption which overwrites the return address.
Thiemo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-04-26 22:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-26 14:22 [Qemu-devel] [PATCH][MIPS] Enforce aligned pc Marius Groeger
2006-04-26 22:07 ` Fabrice Bellard
2006-04-26 22:53 ` Thiemo Seufer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).