qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6906] kvm: Drop kvm_patch_opcode_byte (Jan Kiszka)
Date: Sat, 28 Mar 2009 17:51:41 +0000	[thread overview]
Message-ID: <E1Lnch3-0000cg-49@cvs.savannah.gnu.org> (raw)

Revision: 6906
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6906
Author:   aliguori
Date:     2009-03-28 17:51:40 +0000 (Sat, 28 Mar 2009)
Log Message:
-----------
kvm: Drop kvm_patch_opcode_byte (Jan Kiszka)

As cpu_memory_rw_debug is now capable of modifying ROM, we can drop our
own patch function.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Modified Paths:
--------------
    trunk/target-i386/kvm.c

Modified: trunk/target-i386/kvm.c
===================================================================
--- trunk/target-i386/kvm.c	2009-03-28 17:51:36 UTC (rev 6905)
+++ trunk/target-i386/kvm.c	2009-03-28 17:51:40 UTC (rev 6906)
@@ -686,31 +686,12 @@
 }
 
 #ifdef KVM_CAP_SET_GUEST_DEBUG
-static int kvm_patch_opcode_byte(CPUState *env, target_ulong addr, uint8_t val)
-{
-    target_phys_addr_t phys_page_addr;
-    unsigned long pd;
-    uint8_t *ptr;
-
-    phys_page_addr = cpu_get_phys_page_debug(env, addr & TARGET_PAGE_MASK);
-    if (phys_page_addr == -1)
-        return -EINVAL;
-
-    pd = cpu_get_physical_page_desc(phys_page_addr);
-    if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM &&
-        (pd & ~TARGET_PAGE_MASK) != IO_MEM_ROM && !(pd & IO_MEM_ROMD))
-        return -EINVAL;
-
-    ptr = phys_ram_base + (pd & TARGET_PAGE_MASK)
-                        + (addr & ~TARGET_PAGE_MASK);
-    *ptr = val;
-    return 0;
-}
-
 int kvm_arch_insert_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp)
 {
+    const static uint8_t int3 = 0xcc;
+
     if (cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 0) ||
-        kvm_patch_opcode_byte(env, bp->pc, 0xcc))
+        cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&int3, 1, 1))
         return -EINVAL;
     return 0;
 }
@@ -720,7 +701,7 @@
     uint8_t int3;
 
     if (cpu_memory_rw_debug(env, bp->pc, &int3, 1, 0) || int3 != 0xcc ||
-        kvm_patch_opcode_byte(env, bp->pc, bp->saved_insn))
+        cpu_memory_rw_debug(env, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1))
         return -EINVAL;
     return 0;
 }

                 reply	other threads:[~2009-03-28 17:51 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=E1Lnch3-0000cg-49@cvs.savannah.gnu.org \
    --to=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).