xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Attempted to call hypercall from userspace failed
@ 2012-02-28  7:29 SuperWong
  2012-03-02  7:21 ` SuperWong
  0 siblings, 1 reply; 2+ messages in thread
From: SuperWong @ 2012-02-28  7:29 UTC (permalink / raw)
  To: xen-devel

Hi ALL:
  I am a novice,I have attempted to call hypercall from userspace.It's
failed.
  My OS is Fedora 16(64bit) .
  First,I have created a new hypercall. 
  *xen/include/public*
  #define __HYPERVISOR_tmem_op              38
  #define __HYPERVISOR_print_string           39/*new addition*/
  
  *xen/arch/x86/x86_64*
  ENTRY(hypercall_table)
…
    .quad  do_tmem_op
    .quad  do_print_string
…
  ENTRY(hypercall_args_table)
    .byte 1 /* do_tmem_op  */
    .byte 1 /* do_print_string  */

  *Xen/include/asm-x86/hypercall.h*
  #ifdef  __x86_64__
  …
  extern int
  do_print_string(
         char* message);
  #else

  *xen/arch/x86/mm.c*
  int do_print_string(char *message)
{
  #ifdef __x86_64__
  if(message)
    printk(“MESSAGE(x86_64:%s\n)”,message);
  else
    printk(“MESSAGE(x86_64):Nothing Output!”);
  #endif
    if(message)
    Printk(“MESSAGE(x86_32:%s\n)”,message);
  else
    printk(“MESSAGE(x86_32):Nothing Output!”);
    return 1;
}

hypercall.c
int main(int argc, char *argv[])  
{  
    int fd, ret;  
   char * message;  
    if (argc != 2) {  
        printf("please put one parameter!/n");  
        return -1;  
    }  
   message = (char *) malloc(sizeof(char) * (strlen(argv[1])+1));  
   strcpy(message, argv[1]);  
    privcmd_hypercall_t hcall = {  
        __HYPERVISOR_print_string,  
        {message, 0, 0, 0, 0}  
    };  
    fd = open("/proc/xen/privcmd", O_RDWR);  
    if (fd < 0) {  
        perror("open");  
        exit(1);  
    } else  
        printf("fd = %d/n", fd);  
    ret = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, &hcall);  
    printf("ret = %d/n", ret);  
}  
When I executed ./a.out Hello_world,fd=3 and ret=-1.It's failed.Of course
the command xm dmesg printed nothing.Please tell me where is wrong.Thanks.

--
View this message in context: http://xen.1045712.n5.nabble.com/Attempted-to-call-hypercall-from-userspace-failed-tp5521071p5521071.html
Sent from the Xen - Dev mailing list archive at Nabble.com.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Attempted to call hypercall from userspace failed
  2012-02-28  7:29 Attempted to call hypercall from userspace failed SuperWong
@ 2012-03-02  7:21 ` SuperWong
  0 siblings, 0 replies; 2+ messages in thread
From: SuperWong @ 2012-03-02  7:21 UTC (permalink / raw)
  To: xen-devel

I got it,I have load the wrong xen.

--
View this message in context: http://xen.1045712.n5.nabble.com/Attempted-to-call-hypercall-from-userspace-failed-tp5521071p5530230.html
Sent from the Xen - Dev mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-02  7:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-28  7:29 Attempted to call hypercall from userspace failed SuperWong
2012-03-02  7:21 ` SuperWong

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).