On Sun, 2014-11-16 at 23:00 -0800, Jordan Justen wrote:
> On 2014-11-16 21:26:16, Chen, Fan wrote:
> > On Sun, 2014-11-16 at 19:59 -0800, Jordan Justen wrote:
> > > On 2014-11-16 18:51:15, Chen Fan wrote:
> > > > Because TimeoutInMicrosecsond is a unsigned value, converting it to
> > > > signed value will cause the data region changed. so this patch fix
> > > > that.
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.0
> > > > Signed-off-by: Chen Fan <[email protected]>
> > > > ---
> > > > EmulatorPkg/CpuRuntimeDxe/MpService.c | 20 ++++++++++----------
> > > > 1 file changed, 10 insertions(+), 10 deletions(-)
> > > >
> > > > diff --git a/EmulatorPkg/CpuRuntimeDxe/MpService.c
> > > > b/EmulatorPkg/CpuRuntimeDxe/MpService.c
> > > > index d6dd984..8263915 100644
> > > > --- a/EmulatorPkg/CpuRuntimeDxe/MpService.c
> > > > +++ b/EmulatorPkg/CpuRuntimeDxe/MpService.c
> > > > @@ -378,7 +378,7 @@ CpuMpServicesStartupAllAps (
> > > > UINTN NextNumber;
> > > > PROCESSOR_STATE APInitialState;
> > > > PROCESSOR_STATE ProcessorState;
> > > > - INTN Timeout;
> > > > + UINTN Timeout;
> > > >
> > > >
> > > > if (!IsBSP ()) {
> > > > @@ -540,13 +540,13 @@ CpuMpServicesStartupAllAps (
> > > > goto Done;
> > > > }
> > > >
> > > > - if ((TimeoutInMicroseconds != 0) && (Timeout < 0)) {
> > > > + if ((TimeoutInMicroseconds != 0) && (Timeout == 0)) {
> > > > Status = EFI_TIMEOUT;
> > > > goto Done;
> > > > }
> > > >
> > > > - gBS->Stall (gPollInterval);
> > > > - Timeout -= gPollInterval;
> > > > + Timeout -= MIN (Timeout, gPollInterval);
> > > > + gBS->Stall (Timeout);
> > >
> > > This isn't quite right. We usually want to stall for gPollInterval,
> > > except if Timeout > 0 and Timeout < gPollInterval. I think we need to
> > > do this comparison before the -= operator adjusts Timeout.
> > Oh, right, I think we should introduce a local value:
> > StallTime = MIN (Timeout, gPollInterval);
>
> Except, when Timeout is 0, StallTime should also be gPollInterval.
Yes, I sent a v5 patch to fix this. please help to review.
Thanks,
Chen
>
> -Jordan
>
> > gBS->Stall (StallTime);
> > Timeout -= StallTime;
> >
> > Thanks,
> > Chen
> >
> >
> > >
> > > Or, we could just stick with gPollInterval for the stall even though
> > > it might cause a little extra waiting.
> > >
> > > -Jordan
> > >
> > > > }
> > > >
> > > > Done:
> > > > @@ -659,7 +659,7 @@ CpuMpServicesStartupThisAP (
> > > > OUT BOOLEAN *Finished OPTIONAL
> > > > )
> > > > {
> > > > - INTN Timeout;
> > > > + UINTN Timeout;
> > > >
> > > > if (!IsBSP ()) {
> > > > return EFI_DEVICE_ERROR;
> > > > @@ -717,12 +717,12 @@ CpuMpServicesStartupThisAP (
> > > >
> > > > gThread->MutexUnlock
> > > > (gMPSystem.ProcessorData[ProcessorNumber].StateLock);
> > > >
> > > > - if ((TimeoutInMicroseconds != 0) && (Timeout < 0)) {
> > > > + if ((TimeoutInMicroseconds != 0) && (Timeout == 0)) {
> > > > return EFI_TIMEOUT;
> > > > }
> > > >
> > > > - gBS->Stall (gPollInterval);
> > > > - Timeout -= gPollInterval;
> > > > + Timeout -= MIN (Timeout, gPollInterval);
> > > > + gBS->Stall (Timeout);
> > > > }
> > > >
> > > > return EFI_SUCCESS;
> > > > @@ -987,7 +987,7 @@ CpuCheckAllAPsStatus (
> > > > BOOLEAN Found;
> > > >
> > > > if (gMPSystem.TimeoutActive) {
> > > > - gMPSystem.Timeout -= gPollInterval;
> > > > + gMPSystem.Timeout -= MIN (gMPSystem.Timeout, gPollInterval);
> > > > }
> > > >
> > > > for (ProcessorNumber = 0; ProcessorNumber <
> > > > gMPSystem.NumberOfProcessors; ProcessorNumber++) {
> > > > @@ -1040,7 +1040,7 @@ CpuCheckAllAPsStatus (
> > > > }
> > > > }
> > > >
> > > > - if (gMPSystem.TimeoutActive && gMPSystem.Timeout < 0) {
> > > > + if (gMPSystem.TimeoutActive && gMPSystem.Timeout == 0) {
> > > > //
> > > > // Timeout
> > > > //
> > > > --
> > > > 1.9.3
> > > >
> >
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel