From: Xiaofeng Ling <xiaofeng.ling@intel.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>,
Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH][2/6] add call entry for vmx guest
Date: Mon, 05 Sep 2005 18:40:43 +0800 [thread overview]
Message-ID: <431C20AB.8080109@intel.com> (raw)
This patch add the entry to hypercall for vmx guest.
vmx guest use vmcall to invoke hypercall.
This patch use the original hypercall table with a permit check.
If you think use a seperate table it better, I'll send another
patch later.
Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
Signed-off-by: Arun Sharma <arun.sharma@intel.com>
diff -r 287d36b46fa3 xen/arch/x86/vmx.c
--- a/xen/arch/x86/vmx.c Tue Aug 30 20:36:49 2005
+++ b/xen/arch/x86/vmx.c Fri Sep 2 22:46:13 2005
@@ -1463,9 +1463,12 @@
char print_buf[BUF_SIZ];
static int index;
-static void vmx_print_line(const char c, struct vcpu *d)
-{
-
+asmlinkage unsigned long do_vmx_print_line(unsigned long ch)
+{
+
+#if VMX_DEBUG
+ char c = (char)ch;
+ struct vcpu *d = current;
if (index == MAX_LINE || c == '\n') {
if (index == MAX_LINE) {
print_buf[index++] = c;
@@ -1476,7 +1479,55 @@
}
else
print_buf[index++] = c;
-}
+ return 0;
+#endif
+ return -ENOSYS;
+}
+
+unsigned char vmx_hypercall_permit[NR_hypercalls/sizeof(unsigned char)] =
+{
+ 0x2, /* do_mmu_update */
+ 0x78, /* do_dom_mem_op 12
+ do_multicall 13
+ do_update_va_mapping 14
+ */
+ 0x13, /* do_event_channel_op 16
+ do_xen_version 17
+ do_grant_table_op 20
+ */
+ 0x10 /* do_virtual_device_op 28*/
+};
+#if defined(__i386__)
+void vmx_do_hypercall(struct cpu_user_regs *pregs)
+{
+ unsigned long retcode;
+
+ /* Check whether this hypercall is permited from vmx domain*/
+ if(unlikely(!test_bit(pregs->eax, &vmx_hypercall_permit[0]))){
+ printk("not permit hypercall, %d\n", pregs->eax);
+ return;
+ }
+ __asm__ __volatile__(
+ "pushl %6\n\t"
+ "pushl %5\n\t"
+ "pushl %4\n\t"
+ "pushl %3\n\t"
+ "pushl %2\n\t"
+ "call *(hypercall_table)(,%0,4)\n\t"
+ "addl $20, %%esp\n\t"
+ :"=&a"(retcode)
+ :"0"(pregs->eax), "r"(pregs->ebx), "r"(pregs->ecx),
+ "r"(pregs->edx), "r"(pregs->esi), "r"(pregs->edi)
+ );
+ pregs->eax = retcode;
+ return;
+}
+#else
+void vmx_do_hypercall(struct cpu_user_regs *pregs)
+{
+ printk("not supported yet!\n");
+}
+#endif
void save_vmx_cpu_user_regs(struct cpu_user_regs *ctxt)
{
@@ -1691,7 +1742,7 @@
__vmread(GUEST_RIP, &eip);
__vmread(EXIT_QUALIFICATION, &exit_qualification);
- vmx_print_line(regs.eax, v); /* provides the current domain */
+ vmx_do_hypercall(®s);
__update_guest_eip(inst_len);
break;
case EXIT_REASON_CR_ACCESS:
@@ -1772,7 +1898,6 @@
return;
}
#endif
-#endif /* CONFIG_VMX */
/*
* Local variables:
diff -r 287d36b46fa3 xen/include/public/arch-x86_32.h
--- a/xen/include/public/arch-x86_32.h Tue Aug 30 20:36:49 2005
+++ b/xen/include/public/arch-x86_32.h Fri Sep 2 22:46:13 2005
@@ -42,7 +42,12 @@
#define FLAT_USER_SS FLAT_RING3_SS
/* And the trap vector is... */
+#if defined (CONFIG_VMX_GUEST)
+/*for VMX paravirtualized driver*/
+#define TRAP_INSTR ".byte 0x0f,0x01,0xc1\n"
+#else
#define TRAP_INSTR "int $0x82"
+#endif
/*
next reply other threads:[~2005-09-05 10:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-05 10:40 Xiaofeng Ling [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-09-05 14:36 [PATCH][2/6] add call entry for vmx guest Ling, Xiaofeng
2005-09-07 3:14 Ling, Xiaofeng
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=431C20AB.8080109@intel.com \
--to=xiaofeng.ling@intel.com \
--cc=Keir.Fraser@cl.cam.ac.uk \
--cc=m+Ian.Pratt@cl.cam.ac.uk \
--cc=xen-devel@lists.xensource.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.