* no such file or directory
@ 2008-11-24 7:19 lijiandm
2008-11-24 7:30 ` Paul Samon
0 siblings, 1 reply; 3+ messages in thread
From: lijiandm @ 2008-11-24 7:19 UTC (permalink / raw)
To: xen-devel组
[-- Attachment #1.1: Type: text/plain, Size: 2418 bytes --]
hello list:
I add some code to xen-3.1.0-src\xen\arch\x86\hvm\vmx\vmx.c to export some information when vmx_vmexit_handler() executed:
-------------------------------------------------------------------------------------------------
--- vmx.c 2007-05-18 22:45:22.000000000 +0800
+++ vmx-patch.c 2008-11-24 14:19:18.000000000 +0800
@@ -50,7 +50,9 @@
#include <asm/hvm/vpt.h>
#include <public/hvm/save.h>
#include <asm/hvm/trace.h>
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
char *vmx_msr_bitmap;
static void vmx_ctxt_switch_from(struct vcpu *v);
@@ -2590,9 +2592,13 @@
unsigned int exit_reason;
unsigned long exit_qualification, inst_len = 0;
struct vcpu *v = current;
+ int test;
+ unsigned long FS_SELECTOR,FS_LIMIT,FS_AR_BYTES,FS_BASE,CR3;
+ FILE *fp;
+ char a='\n',b='%';
exit_reason = __vmread(VM_EXIT_REASON);
-
+
HVMTRACE_2D(VMEXIT, v, __vmread(GUEST_RIP), exit_reason);
perfc_incra(vmexits, exit_reason);
@@ -2711,6 +2717,27 @@
}
case EXIT_REASON_CR_ACCESS:
{
+ FS_SELECTOR=(unsigned long)__vmread(EXIT_QUALIFICATION);
+ FS_LIMIT=(unsigned long)__vmread(EXIT_QUALIFICATION);
+ FS_AR_BYTES=(unsigned long)__vmread(EXIT_QUALIFICATION);
+ FS_BASE=(unsigned long)__vmread(EXIT_QUALIFICATION);
+ CR3=(unsigned long)__vmread(EXIT_QUALIFICATION);
+
+ fp=fopen("/home/a.txt","a+");
+
+ fwrite(&FS_SELECTOR,sizeof(unsigned long),1,fp);
+ fwrite(&b,sizeof(char),1,fp);
+ fwrite(&FS_LIMIT,sizeof(unsigned long),1,fp);
+ fwrite(&b,sizeof(char),1,fp);
+ fwrite(&FS_AR_BYTES,sizeof(unsigned long),1,fp);
+ fwrite(&b,sizeof(char),1,fp);
+ fwrite(&FS_BASE,sizeof(unsigned long),1,fp);
+ fwrite(&b,sizeof(char),1,fp);
+ fwrite(&CR3,sizeof(unsigned long),1,fp);
+ fwrite(&a,sizeof(char),1,fp);
+
+ fclose(fp);
+
exit_qualification = __vmread(EXIT_QUALIFICATION);
inst_len = __get_instruction_length(); /* Safe: MOV Cn, LMSW, CLTS */
if ( vmx_cr_access(exit_qualification, regs) )
-----------------------------------------------------------------------------------------------------
but when I compiled the xen,the error occured:
vmx.c:53:19: 错误:stdio.h:No such file or directory
vmx.c:54:20: 错误:stdlib.h:No such file or directory
vmx.c:55:20: 错误:unistd.h:No such file or directory
How can I slove this problem?
Thanks.
[-- Attachment #1.2: Type: text/html, Size: 3618 bytes --]
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: no such file or directory
2008-11-24 7:19 no such file or directory lijiandm
@ 2008-11-24 7:30 ` Paul Samon
[not found] ` <15496892.337061227511999690.JavaMail.coremail@bj163app53.163.com>
0 siblings, 1 reply; 3+ messages in thread
From: Paul Samon @ 2008-11-24 7:30 UTC (permalink / raw)
To: lijiandm; +Cc: xen-devel组
[-- Attachment #1: Type: text/plain, Size: 2938 bytes --]
Oh, no... You can not use C's standard IO library in Xen at all.
For example, Xen has no knowledge about the file system at all, so it
can't understand a file path "/home/a.txt" at all.
By a serial cable, you can use printk() to output the info you need(if
you have no a cable at hand, check the "xm dmesg" in Dom0), or use
some relatively complex methods to export the data in Xen to Dom0's
userspace.
-- Paul. S.
2008/11/23 lijiandm <lijiandm@163.com>:
> hello list:
> I add some code to xen-3.1.0-src\xen\arch\x86\hvm\vmx\vmx.c to export some
> information when vmx_vmexit_handler() executed:
> -------------------------------------------------------------------------------------------------
> --- vmx.c 2007-05-18 22:45:22.000000000 +0800
> +++ vmx-patch.c 2008-11-24 14:19:18.000000000 +0800
> @@ -50,7 +50,9 @@
> #include <asm/hvm/vpt.h>
> #include <public/hvm/save.h>
> #include <asm/hvm/trace.h>
> -
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <unistd.h>
> char *vmx_msr_bitmap;
>
> static void vmx_ctxt_switch_from(struct vcpu *v);
> @@ -2590,9 +2592,13 @@
> unsigned int exit_reason;
> unsigned long exit_qualification, inst_len = 0;
> struct vcpu *v = current;
> + int test;
> + unsigned long FS_SELECTOR,FS_LIMIT,FS_AR_BYTES,FS_BASE,CR3;
> + FILE *fp;
> + char a='\n',b='%';
>
> exit_reason = __vmread(VM_EXIT_REASON);
> -
> +
> HVMTRACE_2D(VMEXIT, v, __vmread(GUEST_RIP), exit_reason);
>
> perfc_incra(vmexits, exit_reason);
> @@ -2711,6 +2717,27 @@
> }
> case EXIT_REASON_CR_ACCESS:
> {
> + FS_SELECTOR=(unsigned long)__vmread(EXIT_QUALIFICATION);
> + FS_LIMIT=(unsigned long)__vmread(EXIT_QUALIFICATION);
> + FS_AR_BYTES=(unsigned long)__vmread(EXIT_QUALIFICATION);
> + FS_BASE=(unsigned long)__vmread(EXIT_QUALIFICATION);
> + CR3=(unsigned long)__vmread(EXIT_QUALIFICATION);
> +
> + fp=fopen("/home/a.txt","a+");
> +
> + fwrite(&FS_SELECTOR,sizeof(unsigned long),1,fp);
> + fwrite(&b,sizeof(char),1,fp);
> + fwrite(&FS_LIMIT,sizeof(unsigned long),1,fp);
> + fwrite(&b,sizeof(char),1,fp);
> + fwrite(&FS_AR_BYTES,sizeof(unsigned long),1,fp);
> + fwrite(&b,sizeof(char),1,fp);
> + fwrite(&FS_BASE,sizeof(unsigned long),1,fp);
> + fwrite(&b,sizeof(char),1,fp);
> + fwrite(&CR3,sizeof(unsigned long),1,fp);
> + fwrite(&a,sizeof(char),1,fp);
> +
> + fclose(fp);
> +
> exit_qualification = __vmread(EXIT_QUALIFICATION);
> inst_len = __get_instruction_length(); /* Safe: MOV Cn, LMSW, CLTS
> */
> if ( vmx_cr_access(exit_qualification, regs) )
> -----------------------------------------------------------------------------------------------------
>
> but when I compiled the xen,the error occured:
> vmx.c:53:19: 错误:stdio.h:No such file or directory
> vmx.c:54:20: 错误:stdlib.h:No such file or directory
> vmx.c:55:20: 错误:unistd.h:No such file or directory
>
> How can I slove this problem?
> Thanks.
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: no such file or directory
[not found] ` <15496892.337061227511999690.JavaMail.coremail@bj163app53.163.com>
@ 2008-11-24 7:54 ` Paul Samon
0 siblings, 0 replies; 3+ messages in thread
From: Paul Samon @ 2008-11-24 7:54 UTC (permalink / raw)
To: lijiandm, xen-devel
[-- Attachment #1: Type: text/plain, Size: 3629 bytes --]
Do you need to export plenty of data of Xen? If not, I think using
printk() or debugtrace_printk() is the best choice.
If you really have much data to export, I think you can look into how
"xm dmesg" or xentrace is implemented.
-- Paul. S.
2008/11/23 lijiandm <lijiandm@163.com>:
> "use some relatively complex methods to export the data in Xen to Dom0's
> userspace."
> What's the complex methods ?Can you give me some suggestion?
> Thanks.
>
>
> 在2008-11-24,"Paul Samon" <paul.samon@gmail.com> 写道:
>>Oh, no... You can not use C's standard IO library in Xen at all.
>>For example, Xen has no knowledge about the file system at all, so it
>>can't understand a file path "/home/a.txt" at all.
>>
>>By a serial cable, you can use printk() to output the info you need(if
>>you have not a cable at hand, check the "xm dmesg" in Dom0), or use
>>some relatively complex methods to export the data in Xen to Dom0's
>>userspace.
>>
>>-- Paul. S.
>>
>>2008/11/23 lijiandm <lijiandm@163.com>:
>>> hello list:
>>> I add some code to xen-3.1.0-src\xen\arch\x86\hvm\vmx\vmx.c to export
>>> some
>>> information when vmx_vmexit_handler() executed:
>>>
>>> -------------------------------------------------------------------------------------------------
>>> --- vmx.c 2007-05-18 22:45:22.000000000 +0800
>>> +++ vmx-patch.c 2008-11-24 14:19:18.000000000 +0800
>>> @@ -50,7 +50,9 @@
>>> #include <asm/hvm/vpt.h>
>>> #include <public/hvm/save.h>
>>> #include <asm/hvm/trace.h>
>>> -
>>> +#include <stdio.h>
>>> +#include <stdlib.h>
>>> +#include <unistd.h>
>>> char *vmx_msr_bitmap;
>>>
>>> static void vmx_ctxt_switch_from(struct vcpu *v);
>>> @@ -2590,9 +2592,13 @@
>>> unsigned int exit_reason;
>>> unsigned long exit_qualification, inst_len = 0;
>>> struct vcpu *v = current;
>>> + int test;
>>> + unsigned long FS_SELECTOR,FS_LIMIT,FS_AR_BYTES,FS_BASE,CR3;
>>> + FILE *fp;
>>> + char a='\n',b='%';
>>>
>>> exit_reason = __vmread(VM_EXIT_REASON);
>>> -
>>> +
>>> HVMTRACE_2D(VMEXIT, v, __vmread(GUEST_RIP), exit_reason);
>>>
>>> perfc_incra(vmexits, exit_reason);
>>> @@ -2711,6 +2717,27 @@
>>> }
>>> case EXIT_REASON_CR_ACCESS:
>>> {
>>> + FS_SELECTOR=(unsigned long)__vmread(EXIT_QUALIFICATION);
>>> + FS_LIMIT=(unsigned long)__vmread(EXIT_QUALIFICATION);
>>> + FS_AR_BYTES=(unsigned long)__vmread(EXIT_QUALIFICATION);
>>> + FS_BASE=(unsigned long)__vmread(EXIT_QUALIFICATION);
>>> + CR3=(unsigned long)__vmread(EXIT_QUALIFICATION);
>>> +
>>> + fp=fopen("/home/a.txt","a+");
>>> +
>>> + fwrite(&FS_SELECTOR,sizeof(unsigned long),1,fp);
>>> + fwrite(&b,sizeof(char),1,fp);
>>> + fwrite(&FS_LIMIT,sizeof(unsigned long),1,fp);
>>> + fwrite(&b,sizeof(char),1,fp);
>>> + fwrite(&FS_AR_BYTES,sizeof(unsigned long),1,fp);
>>> + fwrite(&b,sizeof(char),1,fp);
>>> + fwrite(&FS_BASE,sizeof(unsigned long),1,fp);
>>> + fwrite(&b,sizeof(char),1,fp);
>>> + fwrite(&CR3,sizeof(unsigned long),1,fp);
>>> + fwrite(&a,sizeof(char),1,fp);
>>> +
>>> + fclose(fp);
>>> +
>>> exit_qualification = __vmread(EXIT_QUALIFICATION);
>>> inst_len = __get_instruction_length(); /* Safe: MOV Cn, LMSW,
>>> CLTS
>>> */
>>> if ( vmx_cr_access(exit_qualification, regs) )
>>>
>>> -----------------------------------------------------------------------------------------------------
>>>
>>> but when I compiled the xen,the error occured:
>>> vmx.c:53:19: 错误:stdio.h:No such file or directory
>>> vmx.c:54:20: 错误:stdlib.h:No such file or directory
>>> vmx.c:55:20: 错误:unistd.h:No such file or directory
>>>
>>> How can I slove this problem?
>>> Thanks.
>
[-- Attachment #2: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-24 7:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-24 7:19 no such file or directory lijiandm
2008-11-24 7:30 ` Paul Samon
[not found] ` <15496892.337061227511999690.JavaMail.coremail@bj163app53.163.com>
2008-11-24 7:54 ` Paul Samon
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.