Bug #13030

remove 'retu' pattern from bhyve

Added by Patrick Mooney 8 months ago. Updated 7 months ago.

Start date:
Due date:
% Done:


Estimated time:
Gerrit CR:


In the bhyve kernel, there's a common pattern for handlers which may decide that emulation needs to continue in userspace. The existing API for such handlers is to pass a bool *retu argument to the function, and if a return-to-userspace is requested, the callee will set *retu = true and return a zero value. Meanwhile, it will use all the positive non-zero return values for typical error (errno) reporting. It would be simpler to use a negative return code to indicate the non-error return-to-userspace case. It wouldn't require the extra retu parameter and would simplify both callers and callees of the pattern.

Related issues

Related to illumos gate - Bug #13253: bhyve stumbles on APIC ICRLOClosedPatrick Mooney


Updated by Patrick Mooney 8 months ago

  • Subject changed from remove 'retu' pattern in bhyve to remove 'retu' pattern from bhyve

Updated by Electric Monk 8 months ago

  • Gerrit CR set to 840

Updated by Patrick Mooney 7 months ago

This was tested by booting up the usual gang of test guests:
- Windows
- Linux
- FreeBSD
- OpenBSD
- illumos

All continued to function as they did prior to the change.


Updated by Patrick Mooney 7 months ago

Following a conflict-resolution-requiring rebase, I made another lap through those tests, observing the same result.


Updated by Patrick Mooney 7 months ago

  • % Done changed from 0 to 90

Updated by Electric Monk 7 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit 3e1c5f3a80260eb14c78730bcaca9e6c74f528a0

commit  3e1c5f3a80260eb14c78730bcaca9e6c74f528a0
Author: Patrick Mooney <>
Date:   2020-09-25T01:54:59.000Z

    13030 remove 'retu' pattern from bhyve
    13031 bhyve kernel should use proper struct types
    Reviewed by: Robert Mustacchi <>
    Reviewed by: Mike Zeller <>
    Reviewed by: Andy Fiddaman <>
    Approved by: Dan McDonald <>


Updated by Patrick Mooney 6 months ago

  • Related to Bug #13253: bhyve stumbles on APIC ICRLO added

Also available in: Atom PDF