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