OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:27 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Virtual machines and device drivers.
PostPosted: Fri Sep 19, 2014 5:42 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
What is the best way to implement hardware support in a managed code OS? Should I put it in the virtual machine or implement an API for the kernel (which is ran on the VM) for accessing ports, physical memory, etc?

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Fri Sep 19, 2014 8:37 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
I think both would work, so it's really up to you.

Putting the code in the VM would probably perform better, but exposing memory and I/O to your managed code would allow you to write everything in one language, which may be worth considering.

Personally, I'm planning on mixing managed and native code side-by-side, in an attempt to get the best of both worlds. We'll see if it works out our not.

_________________
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Sat Sep 20, 2014 12:00 am 
Roman wrote:
What is the best way ...

First it is required to define some criteria to assess the ways you can chose from. Next it is required to apply the criteria to all ways you have. And finally it is required to select the way with the best score. This is a general approach.

But if you wish to shorten path then you can follow ways of other people, who already defined some criteria and have selected some way to go along. But is it a really best way? Until you know the criteria you can not tell.
Roman wrote:
to implement hardware support in a managed code OS?

I just use drivers. You can use them too. And is the code managed or not is irrelevant.


Top
  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Tue Sep 23, 2014 3:02 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
Roman wrote:
Should I put it in the virtual machine or implement an API for the kernel


I'm working on a x86 emulator atm and the design I'm using is to put the device drivers at the VM level as this provides the fastest access. You can then expose an I/O read and write API to the kernel to allow enhancing or work arounds for an installed the device driver.

_________________
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Wed Sep 24, 2014 1:02 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
b.zaar wrote:
Roman wrote:
Should I put it in the virtual machine or implement an API for the kernel


I'm working on a x86 emulator atm and the design I'm using is to put the device drivers at the VM level as this provides the fastest access. You can then expose an I/O read and write API to the kernel to allow enhancing or work arounds for an installed the device driver.


I think, this can be a security hole, can't it be? What about hardware support extension?

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Wed Sep 24, 2014 2:15 pm 
Offline
Member
Member
User avatar

Joined: Wed May 21, 2008 4:33 am
Posts: 294
Location: Mars MTC +6:00
Roman wrote:
I think, this can be a security hole, can't it be? What about hardware support extension?


The I/O api wouldn't need to be exposed to every process. Do you support any trusted software vs user software layers?

I'm not sure how you would safely expose the api from your original idea without the same kind of security hole.

_________________
"God! Not Unix" - Richard Stallman

Website: venom Dev
OS project: venom OS
Hexadecimal Editor: hexed


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Wed Sep 24, 2014 2:31 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
b.zaar wrote:
Roman wrote:
I think, this can be a security hole, can't it be? What about hardware support extension?


The I/O api wouldn't need to be exposed to every process. Do you support any trusted software vs user software layers?

I'm not sure how you would safely expose the api from your original idea without the same kind of security hole.


Managed code couldn't access memory, which belongs to VM and other managed code. It also shouldn't be able to access IO ports/memory-mapped hardware, accessed by other drivers.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Wed Sep 24, 2014 2:35 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
For example, if there's a valid ATA driver, which operates the ATA hardware, other programs won't be able to access the ATA hardware.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
 Post subject: Re: Virtual machines and device drivers.
PostPosted: Wed Sep 24, 2014 2:40 pm 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 568
Location: Moscow, Russia
So when driver code is managed, it is not a security hole, but it becomes able to cause performance problems. Maybe I could answer this question me myself, but I wanted to hear other people's opinions.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group