* Help With Custom Hyper Calls
@ 2011-08-12 16:19 John Backes
2011-08-12 17:02 ` Keir Fraser
0 siblings, 1 reply; 6+ messages in thread
From: John Backes @ 2011-08-12 16:19 UTC (permalink / raw)
To: xen-devel
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.
- John
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help With Custom Hyper Calls
2011-08-12 16:19 Help With Custom Hyper Calls John Backes
@ 2011-08-12 17:02 ` Keir Fraser
2011-08-15 14:45 ` John Backes
0 siblings, 1 reply; 6+ messages in thread
From: Keir Fraser @ 2011-08-12 17:02 UTC (permalink / raw)
To: John Backes, xen-devel
On 12/08/2011 17:19, "John Backes" <john.backes@adventiumlabs.org> 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@lists.xensource.com
> http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Help With Custom Hyper Calls
2011-08-12 17:02 ` Keir Fraser
@ 2011-08-15 14:45 ` John Backes
2011-08-15 14:56 ` Tim Deegan
0 siblings, 1 reply; 6+ messages in thread
From: John Backes @ 2011-08-15 14:45 UTC (permalink / raw)
To: xen-devel; +Cc: Keir Fraser
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@adventiumlabs.org> 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@lists.xensource.com
>> http://lists.xensource.com/xen-devel
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Help With Custom Hyper Calls
2011-08-15 14:45 ` John Backes
@ 2011-08-15 14:56 ` Tim Deegan
2011-08-15 15:00 ` John Backes
0 siblings, 1 reply; 6+ messages in thread
From: Tim Deegan @ 2011-08-15 14:56 UTC (permalink / raw)
To: John Backes; +Cc: xen-devel, Keir Fraser
At 09:45 -0500 on 15 Aug (1313401506), John Backes wrote:
> 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:
>
You also need to edit xen/arch/x86/x86_64/compat/entry.S, for the case
where Xen is 64-bit and dom0 kernel is 32-bit.
> static int hyper_init(void){
>
> int output;
>
> printk(KERN_ALERT "Testing Hypercall\n");
>
> __asm__ ( "movl $39, %%eax;"
> "int $0x82;"
> : "=a" (output)
> );
While this should work, you probably ought to be using the hypercall
page (and the existing kernel mechanisms) to make hypercalls.
> 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?
You could print the return value from the hypercall in your module?
Tim.
--
Tim Deegan <tim@xen.org>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Help With Custom Hyper Calls
2011-08-15 14:56 ` Tim Deegan
@ 2011-08-15 15:00 ` John Backes
2011-08-15 15:10 ` Tim Deegan
0 siblings, 1 reply; 6+ messages in thread
From: John Backes @ 2011-08-15 15:00 UTC (permalink / raw)
To: xen-devel; +Cc: Keir Fraser, Tim Deegan
I changed the table entries in both xen/arch/x86/x86_32/entry.S and
xen/arch/x86/x86_64/entry.S. Could you point me towards these existing
kernel mechanisms for issuing hypercalls? Thanks.
- John
On 08/15/2011 09:56 AM, Tim Deegan wrote:
> At 09:45 -0500 on 15 Aug (1313401506), John Backes wrote:
>> 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:
>>
>
> You also need to edit xen/arch/x86/x86_64/compat/entry.S, for the case
> where Xen is 64-bit and dom0 kernel is 32-bit.
>
>> static int hyper_init(void){
>>
>> int output;
>>
>> printk(KERN_ALERT "Testing Hypercall\n");
>>
>> __asm__ ( "movl $39, %%eax;"
>> "int $0x82;"
>> : "=a" (output)
>> );
>
> While this should work, you probably ought to be using the hypercall
> page (and the existing kernel mechanisms) to make hypercalls.
>
>> 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?
>
> You could print the return value from the hypercall in your module?
>
> Tim.
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Help With Custom Hyper Calls
2011-08-15 15:00 ` John Backes
@ 2011-08-15 15:10 ` Tim Deegan
0 siblings, 0 replies; 6+ messages in thread
From: Tim Deegan @ 2011-08-15 15:10 UTC (permalink / raw)
To: John Backes; +Cc: xen-devel, Keir Fraser
Hi,
Please don't top-post.
At 10:00 -0500 on 15 Aug (1313402441), John Backes wrote:
> I changed the table entries in both xen/arch/x86/x86_32/entry.S and
> xen/arch/x86/x86_64/entry.S.
Yes; you also need to edit xen/arch/x86/x86_64/compat/entry.S
> Could you point me towards these existing
> kernel mechanisms for issuing hypercalls? Thanks.
In linux: arch/x86/include/asm/xen/hypercall.h
Cheers,
Tim.
> On 08/15/2011 09:56 AM, Tim Deegan wrote:
> > At 09:45 -0500 on 15 Aug (1313401506), John Backes wrote:
> >> 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:
> >>
> >
> > You also need to edit xen/arch/x86/x86_64/compat/entry.S, for the case
> > where Xen is 64-bit and dom0 kernel is 32-bit.
> >
> >> static int hyper_init(void){
> >>
> >> int output;
> >>
> >> printk(KERN_ALERT "Testing Hypercall\n");
> >>
> >> __asm__ ( "movl $39, %%eax;"
> >> "int $0x82;"
> >> : "=a" (output)
> >> );
> >
> > While this should work, you probably ought to be using the hypercall
> > page (and the existing kernel mechanisms) to make hypercalls.
> >
> >> 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?
> >
> > You could print the return value from the hypercall in your module?
> >
> > Tim.
> >
--
Tim Deegan <tim@xen.org>
Principal Software Engineer, Xen Platform Team
Citrix Systems UK Ltd. (Company #02937203, SL9 0BG)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-15 15:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-12 16:19 Help With Custom Hyper Calls John Backes
2011-08-12 17:02 ` Keir Fraser
2011-08-15 14:45 ` John Backes
2011-08-15 14:56 ` Tim Deegan
2011-08-15 15:00 ` John Backes
2011-08-15 15:10 ` Tim Deegan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.