WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] no such file or directory

To: lijiandm <lijiandm@xxxxxxx>
Subject: Re: [Xen-devel] no such file or directory
From: "Paul Samon" <paul.samon@xxxxxxxxx>
Date: Sun, 23 Nov 2008 23:30:03 -0800
Cc: xen-devel组 <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sun, 23 Nov 2008 23:30:28 -0800
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=XOq4jJ6n8dKpTDsQSxEEsG7wbRvzryg1lpXM0pcq4cc=; b=vPzTpr6BxtfNyygV7nwgpRcGiEd+XMSNGs8KyNF+TtolFEfrohnMKWpTrRdjYi39u0 wyLfosS693vvaYrh7YJRFoLoHaDGG5XM4DVfY0auiLLrlRLZVG1z6yO+yTlfYvRt5JPn gvh7K1KH4TfYA+IqlZpR5z3Lh00bn9o1U0QeU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=rfDfkubvOTAuxOOia/6Y+0bCiskJy7INeevDZfjzNy478DnZ+ZNy335Rg1b7lgFmgD AcIx9TQMYZMEIaHR9enWQJD0JPmo4//HNSOrml5J3x9o/aqH9NMApYIeRZrTxKv4L5qN Bem1H+2knlArDxukELTPK9hWIF7s1itI2fC1E=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <11954269.323671227511157497.JavaMail.coremail@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <11954269.323671227511157497.JavaMail.coremail@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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@xxxxxxx>:
>  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.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>