28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

149<br />

3.10 Hardware Device Drivers: A Case <strong>of</strong> USB<br />

Hardware device drivers require access to <strong>the</strong>ir counterpart to function. This counterpart<br />

can ei<strong>the</strong>r be hardware itself or s<strong>of</strong>tware which emulates <strong>the</strong> hardware.<br />

Throughout this section our default assumption is that <strong>the</strong> virtualized driver is controlling<br />

real hardware. Hardware access means that <strong>the</strong> hardware must be present<br />

on <strong>the</strong> system where <strong>the</strong> driver is run <strong>and</strong> that <strong>the</strong> driver has to have <strong>the</strong> appropriate<br />

privileges to access hardware. Access is typically available only when <strong>the</strong> CPU is<br />

operating in privileged (kernel) mode.<br />

<strong>The</strong> kernel USB driver stack exports USB device access to userspace via <strong>the</strong> USB<br />

generic driver, or ugen. After ugen attaches to a USB bus node, it provides access<br />

to <strong>the</strong> attached hardware (i.e. not <strong>the</strong> entire USB bus) from userspace via <strong>the</strong><br />

/dev/ugen device nodes. While hardware must still be present, providing access<br />

via a device node means that any entity on <strong>the</strong> host with <strong>the</strong> appropriate privileges<br />

to access <strong>the</strong> device node may communicate with <strong>the</strong> hardware. A key point is that<br />

<strong>the</strong> USB protocol <strong>of</strong>fered by ugen is essentially unchanged from <strong>the</strong> USB hardware<br />

protocol. This protocol compatibility allows preexisting kernel drivers to use ugen<br />

without protocol translation.<br />

Our main goal with USB support was to show it is possible to do kernel hardware<br />

device driver development in userspace. <strong>The</strong> two subproblems we had to solve were<br />

being able to attach drivers to <strong>the</strong> ugen device nodes <strong>and</strong> to integrate with <strong>the</strong><br />

device autoconfiguration subsystem [108].<br />

3.10.1 Structure <strong>of</strong> USB<br />

At <strong>the</strong> root <strong>of</strong> <strong>the</strong> USB bus topology is a USB host controller. It controls all traffic<br />

on <strong>the</strong> USB bus. All device access on <strong>the</strong> bus is done through <strong>the</strong> host controller

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!