From: Rusty Russell <rusty@rustcorp.com.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: virtualization <virtualization@lists.linux-foundation.org>
Subject: [PATCH] Update lguest's patch code for new paravirt patch architecture
Date: Mon, 16 Apr 2007 12:28:56 +1000 [thread overview]
Message-ID: <1176690536.14322.227.camel@localhost.localdomain> (raw)
The new patching code means that we don't actually have to do as much
work in lguest's patcher.
We use paravirt_patch_default() for cases we don't want to patch
inline, which automatically handles the "patch iret to use a direct
jump" case.
There's no measurable effect on lguest's virtbench scores tho.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
drivers/lguest/lguest.c | 10 ++--------
drivers/lguest/lguest_asm.S | 1 -
2 files changed, 2 insertions(+), 9 deletions(-)
===================================================================
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -388,7 +388,6 @@ static const struct lguest_insns
[PARAVIRT_PATCH(irq_enable)] = { lgstart_sti, lgend_sti },
[PARAVIRT_PATCH(restore_fl)] = { lgstart_popf, lgend_popf },
[PARAVIRT_PATCH(save_fl)] = { lgstart_pushf, lgend_pushf },
- [PARAVIRT_PATCH(iret)] = { lgstart_iret, lgend_iret },
};
static unsigned lguest_patch(u8 type, u16 clobber, void *insns, unsigned len)
{
@@ -396,20 +395,15 @@ static unsigned lguest_patch(u8 type, u1
/* Don't touch it if we don't have a replacement */
if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start)
- return len;
+ return paravirt_patch_default(type, clobber, insns, len);
insn_len = lguest_insns[type].end - lguest_insns[type].start;
/* Similarly if we can't fit replacement. */
if (len < insn_len)
- return len;
+ return paravirt_patch_default(type, clobber, insns, len);
memcpy(insns, lguest_insns[type].start, insn_len);
- if (type == PARAVIRT_PATCH(iret)) {
- /* Jumps are relative. */
- u32 off = (u32)lguest_iret - ((u32)insns + insn_len);
- memcpy(insns+1, &off, sizeof(off));
- }
return insn_len;
}
===================================================================
--- a/drivers/lguest/lguest_asm.S
+++ b/drivers/lguest/lguest_asm.S
@@ -34,7 +34,6 @@ LGUEST_PATCH(sti, movl $X86_EFLAGS_IF, l
LGUEST_PATCH(sti, movl $X86_EFLAGS_IF, lguest_data+LGUEST_DATA_irq_enabled)
LGUEST_PATCH(popf, movl %eax, lguest_data+LGUEST_DATA_irq_enabled)
LGUEST_PATCH(pushf, movl lguest_data+LGUEST_DATA_irq_enabled, %eax)
-LGUEST_PATCH(iret, .byte 0xE9,0,0,0,0) /* jmp <to-be-patched> */
.text
/* These demark the EIP range where host should never deliver interrupts. */
reply other threads:[~2007-04-16 2:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1176690536.14322.227.camel@localhost.localdomain \
--to=rusty@rustcorp.com.au \
--cc=akpm@linux-foundation.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox