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/
Home Products Support Community News


RE: [Xen-devel] New Hypercall Declaration

Do you understand that you must also change the hypervisor to recognize and do something with your new hypercall?  Your userland code may actually be working and the hypercall may actually be resulting in an entry into the hypervisor, but unless the hypervisor is modified to recognize the new hypercall (#56) and do something with it, the hypervisor will generate a return value of -1 (essentially saying “I don’t recognize this hypercall number”).


If you have modified the hypervisor, please share that patch.  If not, you will need to modify at least  the hypercall_table and the hypercall_args_table in entry.S (under x86, x86_64, and x86_64/compat, or all three, depending on the bit-ness of your hypervisor and guest) and create a do_my_hypercall() routine somewhere.  Then of course you will need to ensure that you are properly building, installing, and booting your newly modified hypervisor.


Printk’s done inside the hypervisor can be viewed using “xm dmesg” or via a properly configured serial port.


Use “xm info” and look at cc_compile_date to ensure you are booting your newly modified hypervisor.


Hope that helps,



From: Nimgaonkar, Satyajeet [mailto:SatyajeetNimgaonkar@xxxxxxxxxx]
Sent: Thursday, September 30, 2010 4:03 PM
To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] New Hypercall Declaration


Hello Xen Developers,

I am currently working on declaring a new hypercall in Xen.
For this i have declared my hypercall in xen.h -
#define __HYPERVISOR_jeet1                56

Then I modified the xcom_privcmd.c to accomodate my hypercall -
         case __HYPERVISOR_jeet1:
                 printk("Successfull Hypercall made to

I defined the structure for the Hypercall in xc_domain.c

int hypercall_test(int handle){
    int rc;
    /* Hypercall definitions */
    hypercall.op     = __HYPERVISOR_jeet1;
    rc = do_xen_hypercall(handle, &hypercall);
    hypercall.arg[0] = 0;
    hypercall.arg[1] = 1;
    //printf ("Hypercall Details: %d\n", rc);
    return rc;

And then I am calling this Hypercall through an user level program-
#include <xenctrl.h>
#include <stdio.h>

int main(){
     printf("Attempt to invoke the hypercall: __HYPERVISOR_jeet1\n");
     int handle, rc;
         /* Acquire Hypervisor Interface Handle.
            This handle goes as the first argument for the function do_xen_hypercall()
     handle = xc_interface_open();
     printf ("Acquired handle to Xen Hypervisor:%d\n",handle);
     rc = hypercall_test(handle);
     printf ("Hypercall Details: %d\n", rc);
     return 0;

The program compiles properly but gives me -1 error for rc. I have posted the same query and I got replies on it. But even after trying many things, I am still stuck with this problem. Can anyone please tell me what I am doing wrong here. Also please tell me where
should I view the output of printk in xen.

Thanks in advance.

Satyajeet Nimgaonkar

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>