On Fri, Mar 29, 2019 at 12:58:18PM +0000, Shivaprashanth H wrote:
> Another section I am facing difficulty in understanding is thats called 
> TRAMPOLINE
> 
> I am not finding much details on this. so whats the concept here?
> 

The image unpack code places the machine into a mode compatible with our
existing "resume from S3" trampoline. This is code that resumes the machine
from real mode back into the kernel.

The code is in sys/arch/[i386,amd64]/[i386,amd64]/acpi_wakecode.s

-ml

> ________________________________
> From: Theo de Raadt <[email protected]>
> Sent: Friday, March 29, 2019 7:05:54 AM
> To: Mike Larkin
> Cc: Shivaprashanth H; [email protected]
> Subject: Re: hibernate_io function
> 
> Mike Larkin <[email protected]> wrote:
> 
> > On Thu, Mar 28, 2019 at 07:02:11AM +0000, Shivaprashanth H wrote:
> > > hi Larkin,
> > >
> > > yes. I am looking to port the hibernate feature from openbsd to freebsd.
> > >
> > > so in freebsd, i see dev/ada
> > >
> >
> > I don't know what physical device that corresponds to. According to the
> > FreeBSD man page, that could really be anything that communicates using
> > the ATA command set.
> >
> > Once you find out what physical device it is, you'll need to implement
> > a side-effect-free I/O routine. The ones we've built so far
> > (wd/ahci/nvme/sdmmc) all reimplement a write function that uses private
> > memory carved out of an area reserved in memory called the piglet. The
> > machine is quiesced by that point (no interrupts, etc) and the write
> > routine is required to only touch memory in the page it has been assigned
> > in the piglet. The one that is likely closest to your needs is
> > ahci_hibernate_io, found in /sys/dev/ic/ahci.c. The layout of the private
> > area in the piglet is described by the struct at the head of that function.
> >
> > Note that in the case softraid(4) is being used, the private page is shared
> > between both the side effect free softraid I/O functions and whatever
> > underlying device-specific side effect free I/O function. IIRC when I
> > wrote that code, I put one struct at one end of the private page and
> > the other struct at the other end. I am not sure if FreeBSD has a similar
> > concept.
> >
> > Good luck.
> 
> And then, you'll need the underlying VM functionality that handles this
> concept called "piglet", a reserved zone for storaged so that the internal
> state can be copied side-effect-free to/from disk..
> 
> And then you'll need the actual soft-state vs hard-state storage, and
> all timeouts deactivated, in all drivers, the way that suspend/resume
> handle it.
> 
> hibernate (and suspend/resume) took about 5 years to incrementally
> develop in OpenBSD.
> 
> There are lots of pieces, which we built in relationship to our
> own ACPI stack, and you may not have the pleasure of making the
> same decisions we made.
> 
> the side-effect-free drivers are only a small piece of the total
> framework. You may need more than good luck...
> 
> 
> Disclaimer: "This message is intended only for the designated recipient(s). 
> It may contain confidential or proprietary information and may be subject to 
> other confidentiality protections. If you are not a designated recipient, you 
> may not review, copy or distribute this message. Please notify the sender by 
> e-mail and delete this message. GlobalEdge does not accept any liability for 
> virus infected mails."

Reply via email to