From: "Zhiguang Liu" <zhiguang.liu@intel.com>
To: "Ni, Ray" <ray.ni@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Andrew Fish <afish@apple.com>
Subject: Re: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before reset
Date: Wed, 7 Dec 2022 08:34:07 +0000 [thread overview]
Message-ID: <PH0PR11MB504893BAC9431CA33508C5D1901A9@PH0PR11MB5048.namprd11.prod.outlook.com> (raw)
In-Reply-To: <MWHPR11MB1631165BA026DBF48AE50F258C1A9@MWHPR11MB1631.namprd11.prod.outlook.com>
Yes, the patch looks fine.
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
> -----Original Message-----
> From: Ni, Ray <ray.ni@intel.com>
> Sent: Wednesday, December 7, 2022 4:08 PM
> To: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
> Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Andrew Fish <afish@apple.com>
> Subject: RE: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before
> reset
>
> Zhiguang, can you please help to review this patch? I guess Andrew is busy
> on something.
>
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni,
> Ray
> > Sent: Monday, December 5, 2022 2:59 PM
> > To: devel@edk2.groups.io
> > Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Andrew Fish
> > <afish@apple.com>
> > Subject: [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before
> > reset
> >
> > EmulatorPkg/Win calls LoadLibraryEx() when the corresponding DLL file
> > is found for each PEIM or DXE driver. The module entry point is
> > changed to point to the entry point from the DLL. This helps to notify
> > Visual Studio that a new windows module is loaded and corresponding
> > symbol parsing is performed for source level debugging.
> >
> > But entry point from the DLL is only executed when the module is not
> > loaded by AddModHandle().
> > When reset happens, we need to clear the DLL loading so that in next
> > boot the module can be loaded again by AddModHandle().
> >
> > Without this patch, source level debugging doesn't work after reset.
> >
> > Signed-off-by: Ray Ni <ray.ni@intel.com>
> > Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> > Cc: Andrew Fish <afish@apple.com>
> > ---
> > EmulatorPkg/Win/Host/WinHost.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/EmulatorPkg/Win/Host/WinHost.c
> > b/EmulatorPkg/Win/Host/WinHost.c index 096292f95a..084cd4cbd7 100644
> > --- a/EmulatorPkg/Win/Host/WinHost.c
> > +++ b/EmulatorPkg/Win/Host/WinHost.c
> > @@ -226,12 +226,26 @@ WinReset (
> > IN VOID *ResetData OPTIONAL
> >
> > )
> >
> > {
> >
> > + UINTN Index;
> >
> > +
> >
> > ASSERT (ResetType <= EfiResetPlatformSpecific);
> >
> > SecPrint (" Emu ResetSystem is called: ResetType = %s\n",
> > mResetTypeStr[ResetType]);
> >
> >
> >
> > if (ResetType == EfiResetShutdown) {
> >
> > exit (0);
> >
> > } else {
> >
> > + //
> >
> > + // Unload all DLLs
> >
> > + //
> >
> > + for (Index = 0; Index < mPdbNameModHandleArraySize; Index++) {
> >
> > + if (mPdbNameModHandleArray[Index].PdbPointer != NULL) {
> >
> > + SecPrint (" Emu Unload DLL: %s\n",
> > + mPdbNameModHandleArray[Index].PdbPointer);
> >
> > + FreeLibrary (mPdbNameModHandleArray[Index].ModHandle);
> >
> > + HeapFree (GetProcessHeap (), 0,
> > + mPdbNameModHandleArray[Index].PdbPointer);
> >
> > + mPdbNameModHandleArray[Index].PdbPointer = NULL;
> >
> > + }
> >
> > + }
> >
> > +
> >
> > //
> >
> > // Jump back to SetJump with jump code = ResetType + 1
> >
> > //
> >
> > --
> > 2.37.2.windows.2
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#96943):
> > https://edk2.groups.io/g/devel/message/96943
> > Mute This Topic: https://groups.io/mt/95464183/1712937
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com]
> > -=-=-=-=-=-=
> >
prev parent reply other threads:[~2022-12-07 8:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <172DD36D81169CD7.13790@groups.io>
2022-12-07 8:07 ` [edk2-devel] [PATCH] EmulatorPkg/Win: Unload DLLs before reset Ni, Ray
2022-12-07 8:34 ` Zhiguang Liu [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=PH0PR11MB504893BAC9431CA33508C5D1901A9@PH0PR11MB5048.namprd11.prod.outlook.com \
--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