Re: 32 bit Kvm running 32 bit WindowsXp hangs on reboot [SOLVED]

2010-08-12 Thread Philipp Hahn
Hello,

Am Freitag 06 August 2010 18:13:03 schrieb Philipp Hahn:
  kvm: unhandled exit 
  kvm_run returned -22

FYI: Already fixed in newer Kernel (2.6.35) by 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=061e2fd16863009c8005b4b5fdfb75c7215c0b99

BYtE
Philipp
-- 
Philipp Hahn   Open Source Software Engineer  h...@univention.de   
Univention GmbHLinux for Your Businessfon: +49 421 22 232- 0
Mary-Somerville-Str.1  28359 Bremen   fax: +49 421 22 232-99
http://www.univention.de/


signature.asc
Description: This is a digitally signed message part.


help with migrate -d -b

2010-08-12 Thread 姚远
From qemu-kvm-0.12.1, kvm has the function about live migration with
non-shared storage. I don't know how to use it and i can not find any
documents about this new function.
In qemu monitor, migrate -d -b tcp:10.1.10.42:444 is not going
well, it errors migration failed.
Who used this command successfully would help me, thank you.

regards,
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] KVM: x86 emulator: put register operand write back to a function

2010-08-12 Thread Wei Yongjun
Introduce function write_register_operand() to write back the
register operand.

Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
---
 arch/x86/kvm/emulate.c |   53 +++
 1 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index c476a67..8bf80a9 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -1020,6 +1020,26 @@ exception:
return X86EMUL_PROPAGATE_FAULT;
 }
 
+static void write_register_operand(struct operand *op, unsigned long val,
+  unsigned int bytes)
+{
+   /* The 4-byte case *is* correct: in 64-bit mode we zero-extend. */
+   switch (bytes) {
+   case 1:
+   *(u8 *)op-addr.reg = (u8)val;
+   break;
+   case 2:
+   *(u16 *)op-addr.reg = (u16)val;
+   break;
+   case 4:
+   *op-addr.reg = (u32)val;
+   break;  /* 64b: zero-extend */
+   case 8:
+   *op-addr.reg = val;
+   break;
+   }
+}
+
 static inline int writeback(struct x86_emulate_ctxt *ctxt,
struct x86_emulate_ops *ops)
 {
@@ -1029,23 +1049,7 @@ static inline int writeback(struct x86_emulate_ctxt 
*ctxt,
 
switch (c-dst.type) {
case OP_REG:
-   /* The 4-byte case *is* correct:
-* in 64-bit mode we zero-extend.
-*/
-   switch (c-dst.bytes) {
-   case 1:
-   *(u8 *)c-dst.addr.reg = (u8)c-dst.val;
-   break;
-   case 2:
-   *(u16 *)c-dst.addr.reg = (u16)c-dst.val;
-   break;
-   case 4:
-   *c-dst.addr.reg = (u32)c-dst.val;
-   break;  /* 64b: zero-ext */
-   case 8:
-   *c-dst.addr.reg = c-dst.val;
-   break;
-   }
+   write_register_operand(c-dst, c-dst.val, c-dst.bytes);
break;
case OP_MEM:
if (c-lock_prefix)
@@ -2971,20 +2975,7 @@ special_insn:
case 0x86 ... 0x87: /* xchg */
xchg:
/* Write back the register source. */
-   switch (c-dst.bytes) {
-   case 1:
-   *(u8 *) c-src.addr.reg = (u8) c-dst.val;
-   break;
-   case 2:
-   *(u16 *) c-src.addr.reg = (u16) c-dst.val;
-   break;
-   case 4:
-   *c-src.addr.reg = (u32) c-dst.val;
-   break;  /* 64b reg: zero-extend */
-   case 8:
-   *c-src.addr.reg = c-dst.val;
-   break;
-   }
+   write_register_operand(c-src, c-dst.val, c-dst.bytes);
/*
 * Write back the memory destination with implicit LOCK
 * prefix.
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1)

Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
---
 arch/x86/kvm/emulate.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8bf80a9..7c47e37 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2387,7 +2387,8 @@ static struct opcode twobyte_table[256] = {
D(DstReg | SrcMem | ModRM), D(DstReg | SrcMem | ModRM),
D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM 
| Mov),
/* 0xC0 - 0xCF */
-   N, N, N, D(DstMem | SrcReg | ModRM | Mov),
+   D(ByteOp | DstMem | SrcReg | ModRM), D(DstMem | SrcReg | ModRM),
+   N, D(DstMem | SrcReg | ModRM | Mov),
N, N, N, GD(0, group9),
N, N, N, N, N, N, N, N,
/* 0xD0 - 0xDF */
@@ -3532,6 +3533,12 @@ twobyte_insn:
c-dst.val = (c-d  ByteOp) ? (s8) c-src.val :
(s16) c-src.val;
break;
+   case 0xc0 ... 0xc1: /* xadd */
+   /* Write back the register source. */
+   write_register_operand(c-src, c-dst.val, c-dst.bytes);
+   /* Write back the memory destination with implicit LOCK prefix. 
*/
+   c-lock_prefix = 1;
+   goto add;
case 0xc3:  /* movnti */
c-dst.bytes = c-op_bytes;
c-dst.val = (c-op_bytes == 4) ? (u32) c-src.val :
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] test: Add test for xadd instruction

2010-08-12 Thread Wei Yongjun
Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
---
 x86/emulator.c |   51 +++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/x86/emulator.c b/x86/emulator.c
index 348d548..c4579ab 100644
--- a/x86/emulator.c
+++ b/x86/emulator.c
@@ -360,6 +360,56 @@ void test_xchg(void *mem)
   rax == 0x123456789abcdef  *memq == 0xfedcba9876543210);
 }
 
+void test_xadd(void *mem)
+{
+   unsigned long *memq = mem;
+   unsigned long rax;
+
+   asm volatile(mov $0x123456789abcdef, %%rax\n\t
+mov %%rax, (%[memq])\n\t
+mov $0xfedcba9876543210, %%rax\n\t
+xadd %%al, (%[memq])\n\t
+mov %%rax, %[rax]\n\t
+: [rax]=r(rax)
+: [memq]r(memq)
+: memory);
+   report(xadd reg, r/m (1),
+  rax == 0xfedcba98765432ef  *memq == 0x123456789abcdff);
+
+   asm volatile(mov $0x123456789abcdef, %%rax\n\t
+mov %%rax, (%[memq])\n\t
+mov $0xfedcba9876543210, %%rax\n\t
+xadd %%ax, (%[memq])\n\t
+mov %%rax, %[rax]\n\t
+: [rax]=r(rax)
+: [memq]r(memq)
+: memory);
+   report(xadd reg, r/m (2),
+  rax == 0xfedcba987654cdef  *memq == 0x123456789ab);
+
+   asm volatile(mov $0x123456789abcdef, %%rax\n\t
+mov %%rax, (%[memq])\n\t
+mov $0xfedcba9876543210, %%rax\n\t
+xadd %%eax, (%[memq])\n\t
+mov %%rax, %[rax]\n\t
+: [rax]=r(rax)
+: [memq]r(memq)
+: memory);
+   report(xadd reg, r/m (3),
+  rax == 0x89abcdef  *memq == 0x1234567);
+
+   asm volatile(mov $0x123456789abcdef, %%rax\n\t
+mov %%rax, (%[memq])\n\t
+mov $0xfedcba9876543210, %%rax\n\t
+xadd %%rax, (%[memq])\n\t
+mov %%rax, %[rax]\n\t
+: [rax]=r(rax)
+: [memq]r(memq)
+: memory);
+   report(xadd reg, r/m (4),
+  rax == 0x123456789abcdef  *memq == 0x);
+}
+
 void test_btc(void *mem)
 {
unsigned int *a = mem;
@@ -548,6 +598,7 @@ int main()
test_pop(mem);
 
test_xchg(mem);
+   test_xadd(mem);
 
test_cr8();
 
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] arm: higher initrd load addr

2010-08-12 Thread Serge Hallyn
set INITRD_LOAD_ADDR to 0x00d0 instead of 0x0080 as to leave
enough room for vmlinuz + its decompressed counterpart.

It has been mentioned that a better fix might be to peek into the
vmlinux for the real size estimate, but as I'm not sure whether we'd
want to do that peeking here I'm posting this version first for
comment.

Signed-off-by: Loïc Minier loic.min...@ubuntu.com
Signed-off-by: Serge E. Hallyn serge.hal...@canonical.com
---
 hw/arm_boot.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index 620550b..c48c7a2 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -15,7 +15,7 @@
 
 #define KERNEL_ARGS_ADDR 0x100
 #define KERNEL_LOAD_ADDR 0x0001
-#define INITRD_LOAD_ADDR 0x0080
+#define INITRD_LOAD_ADDR 0x00d0
 
 /* The worlds second smallest bootloader.  Set r0-r2, then jump to kernel.  */
 static uint32_t bootloader[] = {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[qemu-kvm PATCH 0/3] small qemu-kvm cleanups

2010-08-12 Thread Paolo Bonzini
Nothing earth shattering. :)

Paolo Bonzini (3):
  move kvm_set_irqfd to kvm-stub.c
  remove unused function
  make kvm_mutex_*lock static

 kvm-all.c  |5 +
 kvm-stub.c |6 ++
 kvm.h  |9 -
 qemu-kvm.c |4 ++--
 qemu-kvm.h |8 
 5 files changed, 13 insertions(+), 19 deletions(-)

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[qemu-kvm PATCH 1/3] move kvm_set_irqfd to kvm-stub.c

2010-08-12 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
---
 kvm-all.c  |5 +
 kvm-stub.c |6 ++
 kvm.h  |9 -
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 47f58a6..78983ee 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -1298,6 +1298,11 @@ int kvm_set_irqfd(int gsi, int fd, bool assigned)
 return r;
 return 0;
 }
+#else
+int kvm_set_irqfd(int gsi, int fd, bool assigned)
+{
+return -ENOSYS;
+}
 #endif
 
 #undef PAGE_SIZE
diff --git a/kvm-stub.c b/kvm-stub.c
index 7be5f5d..dd5ca66 100644
--- a/kvm-stub.c
+++ b/kvm-stub.c
@@ -135,3 +135,9 @@ int kvm_set_ioeventfd_pio_word(int fd, uint16_t addr, 
uint16_t val, bool assign)
 {
 return -ENOSYS;
 }
+
+int
+kvm_set_irqfd(int gsi, int fd, bool assigned)
+{
+return -ENOSYS;
+}
diff --git a/kvm.h b/kvm.h
index aab5118..e937995 100644
--- a/kvm.h
+++ b/kvm.h
@@ -182,15 +182,6 @@ static inline void cpu_synchronize_post_init(CPUState *env)
 
 #endif
 
-#if defined(KVM_IRQFD)  defined(CONFIG_KVM)
 int kvm_set_irqfd(int gsi, int fd, bool assigned);
-#else
-static inline
-int kvm_set_irqfd(int gsi, int fd, bool assigned)
-{
-return -ENOSYS;
-}
-#endif
-
 int kvm_set_ioeventfd_pio_word(int fd, uint16_t adr, uint16_t val, bool 
assign);
 #endif
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[qemu-kvm PATCH 2/3] remove unused function

2010-08-12 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
---
 qemu-kvm.h |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/qemu-kvm.h b/qemu-kvm.h
index 6f6c6d8..c08e9b8 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -896,11 +896,6 @@ int handle_tpr_access(void *opaque, CPUState *env, 
uint64_t rip,
 void kvm_mutex_unlock(void);
 void kvm_mutex_lock(void);
 
-static inline int kvm_sync_vcpus(void)
-{
-return 0;
-}
-
 #ifdef CONFIG_KVM
 
 typedef struct KVMSlot {
-- 
1.7.1


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[qemu-kvm PATCH 3/3] make kvm_mutex_*lock static

2010-08-12 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini pbonz...@redhat.com
---
 qemu-kvm.c |4 ++--
 qemu-kvm.h |3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index 96d458c..f46c394 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -1798,13 +1798,13 @@ int kvm_set_irq(int irq, int level, int *status)
 
 #endif
 
-void kvm_mutex_unlock(void)
+static void kvm_mutex_unlock(void)
 {
 assert(!cpu_single_env);
 pthread_mutex_unlock(qemu_mutex);
 }
 
-void kvm_mutex_lock(void)
+static void kvm_mutex_lock(void)
 {
 pthread_mutex_lock(qemu_mutex);
 cpu_single_env = NULL;
diff --git a/qemu-kvm.h b/qemu-kvm.h
index c08e9b8..6b26daa 100644
--- a/qemu-kvm.h
+++ b/qemu-kvm.h
@@ -893,9 +893,6 @@ int handle_tpr_access(void *opaque, CPUState *env, uint64_t 
rip,
 #define qemu_kvm_cpu_stop(env) do {} while(0)
 #endif
 
-void kvm_mutex_unlock(void);
-void kvm_mutex_lock(void);
-
 #ifdef CONFIG_KVM
 
 typedef struct KVMSlot {
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Paolo Bonzini
On 08/12/2010 09:41 AM, Wei Yongjun wrote:
 + case 0xc0 ... 0xc1: /* xadd */
 + /* Write back the register source. */
 + write_register_operand(c-src, c-dst.val, c-dst.bytes);
 + /* Write back the memory destination with implicit LOCK prefix. 
 */
 + c-lock_prefix = 1;

It's not a major performance problem, but xadd does _not_ have an
implicit LOCK prefix.

Paolo
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Attaching Serial Console

2010-08-12 Thread Phil Winterfield (winterfi)
That does the trick.

Thanks!

 -Original Message-
 From: pradeepkumar [mailto:psuri...@linux.vnet.ibm.com]
 Sent: Wednesday, August 11, 2010 8:09 PM
 To: Phil Winterfield (winterfi)
 Cc: kvm@vger.kernel.org
 Subject: Re: Attaching Serial Console
 
 On Wed, 11 Aug 2010 17:46:53 -0700
 Phil Winterfield (winterfi) winte...@cisco.com wrote:
 
 Add --serial stdio for serial console
 
 For Monitor add  -monitor stdio.you can use vnc also
 
  Startup command:
  /usr/libexec/qemu-kvm -hda /home/winterfi/ios/ios-1.img
  -cdrom /home/winterfi/ios/ios.iso -m 2048 -boot d
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: KSM with Debian GNU/Linux

2010-08-12 Thread Daniel Bareiro
Hi, Michael.

On Monday, 09 August 2010 19:28:23 +0400,
Michael Tokarev wrote:

 I'm also using qemu-kvm 0.12.1.2 compiled by myself with the source
 code of SourceForge.

 Note that this one has numerous bugs, some of which involves data
 corruption. JFYI.

Thanks for the observation.

 These are the checks that I was doing in the VMHost:

 # ll /sys/kernel/mm/ksm/
 total 0
 -r--r--r-- 1 root root 4096 ago  9 06:28 full_scans
 -rw-r--r-- 1 root root 4096 ago  9 06:28 max_kernel_pages
 -r--r--r-- 1 root root 4096 ago  9 06:28 pages_shared
 -r--r--r-- 1 root root 4096 ago  9 06:28 pages_sharing
 -rw-r--r-- 1 root root 4096 ago  9 06:28 pages_to_scan
 -r--r--r-- 1 root root 4096 ago  9 06:28 pages_unshared
 -r--r--r-- 1 root root 4096 ago  9 06:28 pages_volatile
 -rw-r--r-- 1 root root 4096 ago  9 06:27 run
 -rw-r--r-- 1 root root 4096 ago  9 06:28 sleep_millisecs


 # cat /sys/kernel/mm/ksm/max_kernel_pages
 253500

 But KSM seems not work:

 # cat /sys/kernel/mm/ksm/pages_sharing
 0

 Did you actually enable it in the kernel? Did you read the ksm docs
 shipped with the kernel?

Yes, I forgot to mention that I had enabled it:

# cat /sys/kernel/mm/ksm/run
1

 Should I have some additional consideration when compiling qemu-kvm?

 Please note what Nikola Ciprich said. If you don't have kernel headers
 that defines MADV_MERGEABLE, you'll have to define it when compiling
 kvm.

 Note again that debian qemu-kvm package (you're asking about debian
 after all) includes support for KSM. It also includes a small patch to
 #define that symbol.

Keeping the kernel I had compiled and installing the qemu-kvm package in
Backports, now KSM is working:

# cat /sys/kernel/mm/ksm/pages_sharing
181406


This indicates that this was a problem in compiling qemu-kvm since the
kernel is still exactly the same. Now, according to what I was seeing,
headers of my kernel defines MADV_MERGEABLE:

# cat 
/usr/src/linux-2.6.32.3/debian/linux-headers-2.6.32.3-dgb/usr/src/linux-headers-2.6.32.3-dgb/include/asm-generic/mman-common.h
 | grep MERGEABLE
#define MADV_MERGEABLE   12 /* KSM may merge identical pages */
#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */


Would it be that perhaps in my compilation of qemu-kvm, ksm was not
working because I would have to indicate the path
/usr/src/linux-2.6.32.3/debian/...?


Thanks for your reply.


Regards,
Daniel
-- 
Fingerprint: BFB3 08D6 B4D1 31B2 72B9  29CE 6696 BF1B 14E6 1D37
Powered by Debian GNU/Linux Lenny - Linux user #188.598


signature.asc
Description: Digital signature


Re: KVM on MIPS?

2010-08-12 Thread Dale Farnsworth
On Thu, Aug 12, 2010 at 02:26:17PM -0700, Hollis Blanchard wrote:
 On 03/26/2010 12:59 PM, Dale Farnsworth wrote:
 On Fri, Mar 26, 2010 at 09:16:19AM -0700, Dale Farnsworth wrote:
 On Thu, Mar 25, 2010 at 11:32:57PM +0100, Alexander Graf wrote:

 Am 25.03.2010 um 22:04 schrieb Avi Kivitya...@redhat.com:

 On 03/25/2010 06:54 PM, Dale Farnsworth wrote:
 I'm beginning to look at implementing KVM on MIPS.  I've tried to
 search
 for any work-in-progress on this but haven't found much at all.

 If you know of anyone who is working on this or of pitfalls I should
 consider before jumping in, please let me know.


 Is the instruction set virtualizable?

 FWIW it's not. Kernel mode is used based on an address offset of the IP.
 Since you'd want to have your guest running in user mode, you're pretty
 much lost there.

 I guess that would qualify as a pitfall.  Thanks Avi and Alex.

 After thinking about this some more, I think this means we can't run
 an unmodified guest.  It should be possible to build the guest kernel
 to run in supervisor or user mode/address space.

 I'm new to MIPS, so I'm still looking for other challenges in virtualizing
 the instruction set.

 Hi Dale, how is this going?

 Hollis Blanchard
 Mentor Graphics, Embedded Systems Division

Unfortunately, I haven't been able to spend much time on it.
So, it's not really going.

-Dale
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2 v2] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1)

Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
---
v1 - v2: remove implicit LOCK prefix
---
 arch/x86/kvm/emulate.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8bf80a9..279547a 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2387,7 +2387,8 @@ static struct opcode twobyte_table[256] = {
D(DstReg | SrcMem | ModRM), D(DstReg | SrcMem | ModRM),
D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM 
| Mov),
/* 0xC0 - 0xCF */
-   N, N, N, D(DstMem | SrcReg | ModRM | Mov),
+   D(ByteOp | DstMem | SrcReg | ModRM), D(DstMem | SrcReg | ModRM),
+   N, D(DstMem | SrcReg | ModRM | Mov),
N, N, N, GD(0, group9),
N, N, N, N, N, N, N, N,
/* 0xD0 - 0xDF */
@@ -3532,6 +3533,10 @@ twobyte_insn:
c-dst.val = (c-d  ByteOp) ? (s8) c-src.val :
(s16) c-src.val;
break;
+   case 0xc0 ... 0xc1: /* xadd */
+   /* Write back the register source. */
+   write_register_operand(c-src, c-dst.val, c-dst.bytes);
+   goto add;
case 0xc3:  /* movnti */
c-dst.bytes = c-op_bytes;
c-dst.val = (c-op_bytes == 4) ? (u32) c-src.val :
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2 v3] KVM: x86 emulator: add XADD instruction emulation

2010-08-12 Thread Wei Yongjun
Add XADD instruction emulation (opcode 0x0f 0xc0~0xc1)

Signed-off-by: Wei Yongjun yj...@cn.fujitsu.com
---
v2 - v3: add Lock prefix to decode
---
 arch/x86/kvm/emulate.c |7 ++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 8bf80a9..e091718 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -2387,7 +2387,8 @@ static struct opcode twobyte_table[256] = {
D(DstReg | SrcMem | ModRM), D(DstReg | SrcMem | ModRM),
D(ByteOp | DstReg | SrcMem | ModRM | Mov), D(DstReg | SrcMem16 | ModRM 
| Mov),
/* 0xC0 - 0xCF */
-   N, N, N, D(DstMem | SrcReg | ModRM | Mov),
+   D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | 
Lock),
+   N, D(DstMem | SrcReg | ModRM | Mov),
N, N, N, GD(0, group9),
N, N, N, N, N, N, N, N,
/* 0xD0 - 0xDF */
@@ -3532,6 +3533,10 @@ twobyte_insn:
c-dst.val = (c-d  ByteOp) ? (s8) c-src.val :
(s16) c-src.val;
break;
+   case 0xc0 ... 0xc1: /* xadd */
+   /* Write back the register source. */
+   write_register_operand(c-src, c-dst.val, c-dst.bytes);
+   goto add;
case 0xc3:  /* movnti */
c-dst.bytes = c-op_bytes;
c-dst.val = (c-op_bytes == 4) ? (u32) c-src.val :
-- 
1.7.0.4


--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html