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] Help With Custom Hyper Calls

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] Help With Custom Hyper Calls
From: John Backes <john.backes@xxxxxxxxxxxxxxxxx>
Date: Mon, 15 Aug 2011 09:45:06 -0500
Cc: Keir Fraser <keir.xen@xxxxxxxxx>
Delivery-date: Mon, 15 Aug 2011 07:45:47 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <CA6B1B19.1F29F%keir.xen@xxxxxxxxx>
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: <CA6B1B19.1F29F%keir.xen@xxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10
So I greped through the s

I've altered the hypercall_table and hypercall_args_table to have an
additional entry in xen/arch/x86/x86_32/entry.S and in
xen/arch/x86/x86_64/entry.S:

to the hypercall_table:

...........................
         .long do_sysctl             /* 35 */
         .long do_domctl
         .long do_kexec_op
         .long do_tmem_op
         .long do_new_hyper          /* 39 */
...........................

to the hypercall_args_table:

...........................
         .byte 1 /* do_sysctl            */  /* 35 */
         .byte 1 /* do_domctl            */
         .byte 2 /* do_kexec_op          */
         .byte 1 /* do_tmem_op           */
         .byte 0 /* do_new_hyper         */  /* 39 */
...........................


I've also registered the name in xen/include/public/xen.h

...........................
#define __HYPERVISOR_new_hyper            39
...........................

and I've added the following function to xen/arch/x86/mm.c

...........................
void do_new_hyper ( void )
{
      printk("NEW HYPERCALL RECEIVED\n");
}
...........................

To test this, I am running a fedora 14 dom0 and I wrote the following
kernel module (so the code runs in ring 1):

...........................
#include <linux/init.h>
#include <linux/module.h>
#include <linux/fs.h>

MODULE_LICENSE("GPL");

#define SUCCESS 0

static int hyper_init(void){

  int output;

  printk(KERN_ALERT "Testing Hypercall\n");

  __asm__ ( "movl $39, %%eax;"
            "int $0x82;"
          : "=a" (output)
          );

  return SUCCESS;
}

static void hyper_exit(void){
  printk(KERN_ALERT "Removing Hypercall Module");


}

module_init(hyper_init);
module_exit(hyper_exit);
...........................

I then run "xm dmesg" to see if I can see the "NEW HYPERCALL RECEIVED"
message, but nothing appears.  Any thoughts?

- John


On 08/12/2011 12:02 PM, Keir Fraser wrote:
> On 12/08/2011 17:19, "John Backes" <john.backes@xxxxxxxxxxxxxxxxx> wrote:
> 
>> Hello,
>>
>> So I'm new to Xen development and want to play around with Xen
>> Hypercalls, but havn't been able to find a whole lot of documentation
>> related to creating custom Hypercalls.  I've found that to create a
>> custom Hypercall I need to define it with an unused Hypercall number in
>> "xen/include/public/xen.h", but then I am unsure of the next steps
>> (e.g., where to place the function to call with the Hypercall).
>>
>> Can anyone point more towards some documentation or at least towards the
>> correct locations for registering new Hypercalls?  Thanks in advance.
> 
> Pick the name of a hypercall, e.g., update_va_mapping has a nice distinctive
> name. Recursive grep for that name in the Xen and Linux source trees. Should
> give you a pretty good start on the few places you need to register in the
> hypervisor and in the guest kernel.
> 
>  -- Keir
> 
>> - John
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel
> 
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel