Skip to contentSkip to conversation

How to implement a simple driver in Windows with xen?

DISCUSSION xyu.dai 2 participants 2 messages Aug 8, 2009 – Aug 17, 2009

lore
Share & tools
lore

xyu.dai

author
#0 lore raw

Hi. I'm trying to implement dual-way communication between processes in domain0 and GuestOS.
I'm trying to setup a model like diagram below.

Domain0 GuestOS(windows)
backend-driver <--> evtchn/share page <--> frontend-driver
^ ^
| r/w | r/w
v v
process A process B

Now, I'm wondering how to write a simple driver in windows with xen. What the frontend-driver do is just accept several userspace IRPs (read/write...) and send message to backend-driver, I don't know how to code detaily. I've read part of the win-pv drivers, but most of them are constructed in model like miniport or sth else, which is bind to some device like network,disk.

Could anyone give me some advice or sample code?

Thanks a lot!

Signature · 2 lines
View this message in context: http://www.nabble.com/How-to-implement-a-simple-driver-in-Windows-with-xen--tp24874576p24874576.html
Sent from the Xen - Dev mailing list archive at Nabble.com.
#1 lore raw
Quoted 12 lines · xyu.dai

Hi. I'm trying to implement dual-way communication between processes in domain0 and GuestOS.
I'm trying to setup a model like diagram below.

Domain0 GuestOS(windows)
backend-driver <--> evtchn/share page <--> frontend-driver
^ ^
| r/w | r/w
v v
process A process B

Quoted 6 lines

Now, I'm wondering how to write a simple driver in windows with xen. What the frontend-driver do is just accept several userspace IRPs (read/write...) and send message to backend-driver, I don't know how to code detaily. I've read part of the win-pv drivers, but most of them are constructed in model like miniport or sth else, which is bind to some device like network,disk.

It sounds to me like you are thinking to write an IOCTL driver that will push the data along and then at some point return the result of the IOCTL call?

An rather "easy" (that is if you know what you are doing) is to extract from the win-pv drivers the XenStore (XS) components and make your Windows driver marshall the IRPs in the XS. On the Dom0, your process can just read the keys from the userspace (using xenstore-ls for example). The "write" mechanism can be done by the xenstore-write.

Later on you can work on using Xen hypercalls to request a shared page and use that to write your IRPs (and get the responses back).

Quoted 2 lines

Could anyone give me some advice or sample code?

Hope this helps a bit. Keep in mind that if you use the Win PV-GPL driver (or a derivative of it) your code will also be under the GPL license. And if you use some of the Windows sample code, do check their license to make sure you are allowed to use it with GPL code.