I ported APM function from FreeBSD 2.0. Last I checked, the only thing that code actually accomplished was resetting the clock after a resume. While that's all fine and dandy, it misses a *lot*, and it was ugly too. The APM code really needs hooks for drivers to reset their state on resume, and to sync before shutdown.