From: "Roman Kagan" <rkagan@virtuozzo.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"afish@apple.com" <afish@apple.com>
Cc: Laszlo Ersek <lersek@redhat.com>, David Woodhouse <dwmw2@infradead.org>
Subject: Re: [edk2-devel] static data in dxe_runtime modules
Date: Fri, 16 Aug 2019 17:00:10 +0000 [thread overview]
Message-ID: <20190816170007.GA10136@rkaganb.sw.ru> (raw)
In-Reply-To: <A4419C98-588F-4C1A-80F8-1C4CFA4AD6DC@apple.com>
On Wed, Aug 14, 2019 at 09:26:47AM -0700, Andrew Fish via Groups.Io wrote:
> Every runtime driver I've every seen usually works like this:
> 1) Loads as an EFI driver and uses EFI Boot Services in its constructor (gBS, gDS, AllocatePool(), etc.)
> 2) You use the EFI Boot Service to register the ExitBootServices Event.
> 3) SetVirtualAddressMap event fires and converts all the pointers
> 4) After all the ExitBootServices events have been processed the DXE Runtime driver re-relocates the Runtime Driver
> 5) The next code that runs is a call from the kernel virtual mapping, and the system is at runtime
>
> It is important to remember that when gRT->SetVirtualAddressMap() is
> called by the OS Loader (or early kernel) that gBS->ExitBootServices()
> has already been called. So by the time you get 3) almost all of EFI
> is gone. The only services that remain are gRT. Note you find the
> location of gRT by using the gST passed into the entry point of the
> driver. So here is lies the problem the entry point is passed a Handle
> (EFI Boot Services concept) and a pointer to gST (another boot
> services table). So you can't really reload a module and expect it to
> work.
Indeed. My hope was that the particular VariableRuntimeDxe module was
just a bunch of self-contained code that accesses all the data it needs
through the arguments it's passed. Having now looked at the code, this
assumption is certainly wrong: the module depends on a lot of private
data that is initialized at boot services time.
Thanks and sorry for the noise,
Roman.
prev parent reply other threads:[~2019-08-16 17:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 19:16 static data in dxe_runtime modules Roman Kagan
2019-08-02 23:54 ` [edk2-devel] " Andrew Fish
2019-08-03 2:03 ` Laszlo Ersek
2019-08-05 10:18 ` Roman Kagan
2019-08-07 17:29 ` Laszlo Ersek
2019-08-07 17:41 ` Andrew Fish
2019-08-08 17:39 ` Laszlo Ersek
2019-08-09 16:07 ` Roman Kagan
[not found] ` <15B94CD6CF07DEE2.13696@groups.io>
2019-08-12 18:43 ` Roman Kagan
2019-08-13 9:10 ` Laszlo Ersek
2019-08-13 11:23 ` Roman Kagan
2019-08-14 15:16 ` Laszlo Ersek
2019-08-14 16:26 ` Andrew Fish
2019-08-16 15:22 ` Laszlo Ersek
2019-08-16 17:00 ` Roman Kagan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190816170007.GA10136@rkaganb.sw.ru \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox