On 27/12/2015 03:42, Carl Patenaude Poulin wrote:
Hi all,

I'm looking at how hypercalls are implemented in Mini-OS and Andrew
Cooper's xen-test-framework. In both cases, several registers are
defined as outputs, they're bound by input registers, and their
outputs are ignored. Is there any reason for doing this instead of
just declaring directly the input registers?

Is it because the registers are callee-saved? If that's the case,
why not just put them in the clobber list?

This is because of some of the restrictions when constructing asm statements.

The clobber list must be mutually exclusive with any of the named inputs/ouputs. Anything listed in the inputs alone is expected to retain its value across the asm statement.

As the values in the registers are modified by the hypercall, we need a separate way to indicate that they are clobbered.

This is done by listing them as an output as well (which indicates that their value is now different to the value they had as an input), being directed at a variable which is never referenced again (i.e. we don't care what the eventual value actually is).

~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to