Subject: sleep and hibernate...
To: None <port-i386@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: port-i386
Date: 11/22/2001 18:44:05
So, my laptop won't sleep, under BSD/OS or NetBSD - it says "unable to enter
requested state".  I finally gave up and looked at power settings under
Windows.

Ah-hah!  The machine *has no sleep mode*.  It has standby - which doesn't do
much - and it has "hibernate".  If you tell it to go to sleep, it actually
writes a memory image of some sort to disk, then, when booting, restores it.

This doesn't appear to require very much APM support, except that you need
to run power hooks for everything.  What it does need is a clever hack fairly
early in the boot that looks for hibernate data and reloads it.

I am thinking, half-heartedly, about destroying my laptop trying to implement
this.  Before I go try that:

1.  Anyone done this?
2.  Any obvious design flaws/gotchas?  (e.g., I can't do it naively on my
system, because the swap partition may get trashed while NetBSD is asleep.)
3.  Is there some established protocol for writing code which says "then
replace the entire contents of memory with this stream, and jump to a specific
location"?

-s