From 1ef41207dc5fe92acb63dc0e4d0e4d9fab2ff3d9 Mon Sep 17 00:00:00 2001 From: andrewfish Date: Tue, 21 Jun 2011 23:41:31 +0000 Subject: InOsEmuPkg: Add TimerLib for PEI, DXE_CORE, and DXE/EFI drivers/applications. Start using MdeModulePkg MetronomeDxe driver. Add PEI and DXE_CORE TimerLibs that just call back to the emulator. Add a DXE/UEFI TimerLib that also does a gBS->WaitForEvent() if the stall is for a long period of time. Change the Thunk API for Sleep to nanoseconds. Signed-off-by: andrewfish git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11872 6f19259b-4bc3-4df7-8a09-765794883524 --- InOsEmuPkg/Unix/Sec/EmuThunk.c | 6 +++--- InOsEmuPkg/Unix/Sec/Gasket.h | 2 +- InOsEmuPkg/Unix/Sec/SecMain.h | 2 +- InOsEmuPkg/Unix/UnixX64.dsc | 7 ++++++- InOsEmuPkg/Unix/UnixX64.fdf | 4 ++-- 5 files changed, 13 insertions(+), 8 deletions(-) (limited to 'InOsEmuPkg/Unix') diff --git a/InOsEmuPkg/Unix/Sec/EmuThunk.c b/InOsEmuPkg/Unix/Sec/EmuThunk.c index ca8be55a0f..194cf137f9 100644 --- a/InOsEmuPkg/Unix/Sec/EmuThunk.c +++ b/InOsEmuPkg/Unix/Sec/EmuThunk.c @@ -250,15 +250,15 @@ QueryPerformanceCounter ( VOID SecSleep ( - IN UINT64 Milliseconds + IN UINT64 Nanoseconds ) { struct timespec rq, rm; struct timeval start, end; unsigned long MicroSec; - rq.tv_sec = Milliseconds / 1000; - rq.tv_nsec = (Milliseconds % 1000) * 1000000; + rq.tv_sec = Nanoseconds / 1000000000; + rq.tv_nsec = Nanoseconds % 1000000000; // // nanosleep gets interrupted by our timer tic. diff --git a/InOsEmuPkg/Unix/Sec/Gasket.h b/InOsEmuPkg/Unix/Sec/Gasket.h index e5966964c5..725e250eb3 100644 --- a/InOsEmuPkg/Unix/Sec/Gasket.h +++ b/InOsEmuPkg/Unix/Sec/Gasket.h @@ -109,7 +109,7 @@ GasketQueryPerformanceCounter ( VOID EFIAPI GasketSecSleep ( - IN UINT64 Milliseconds + IN UINT64 Nanoseconds ); VOID diff --git a/InOsEmuPkg/Unix/Sec/SecMain.h b/InOsEmuPkg/Unix/Sec/SecMain.h index 01254de0c7..68cb007ed8 100644 --- a/InOsEmuPkg/Unix/Sec/SecMain.h +++ b/InOsEmuPkg/Unix/Sec/SecMain.h @@ -336,7 +336,7 @@ MapFd0 ( -VOID SecSleep (UINT64 Milliseconds); +VOID SecSleep (UINT64 Nanoseconds); VOID SecEnableInterrupt (VOID); VOID SecDisableInterrupt (VOID); BOOLEAN SecInterruptEanbled (VOID); diff --git a/InOsEmuPkg/Unix/UnixX64.dsc b/InOsEmuPkg/Unix/UnixX64.dsc index 4012acfdeb..d6ce60ee30 100644 --- a/InOsEmuPkg/Unix/UnixX64.dsc +++ b/InOsEmuPkg/Unix/UnixX64.dsc @@ -124,6 +124,7 @@ SerialPortLib|InOsEmuPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf PpiListLib|InOsEmuPkg/Library/SecPpiListLib/SecPpiListLib.inf DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + TimerLib|InOsEmuPkg/Library/PeiTimerLib/PeiTimerLib.inf [LibraryClasses.common.USER_DEFINED, LibraryClasses.common.BASE] DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf @@ -147,6 +148,7 @@ ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf SerialPortLib|InOsEmuPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf + TimerLib|InOsEmuPkg/Library/PeiTimerLib/PeiTimerLib.inf [LibraryClasses.common.PEI_CORE] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf @@ -161,6 +163,8 @@ PeCoffExtraActionLib|InOsEmuPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + TimerLib|InOsEmuPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf + EmuThunkLib|InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf [LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_APPLICATION] HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf @@ -170,6 +174,7 @@ EmuThunkLib|InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.inf PeCoffExtraActionLib|InOsEmuPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf + TimerLib|InOsEmuPkg/Library/DxeTimerLib/DxeTimerLib.inf [LibraryClasses.common.UEFI_DRIVER] PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf @@ -340,7 +345,7 @@ SerialPortLib|InOsEmuPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf } - InOsEmuPkg/MetronomeDxe/Metronome.inf + MdeModulePkg/Universal/Metronome/Metronome.inf InOsEmuPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf InOsEmuPkg/ResetRuntimeDxe/Reset.inf MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf diff --git a/InOsEmuPkg/Unix/UnixX64.fdf b/InOsEmuPkg/Unix/UnixX64.fdf index 1f2fe7e633..b6d80a22ea 100644 --- a/InOsEmuPkg/Unix/UnixX64.fdf +++ b/InOsEmuPkg/Unix/UnixX64.fdf @@ -165,7 +165,7 @@ APRIORI PEI { } APRIORI DXE { INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf - INF InOsEmuPkg/MetronomeDxe/Metronome.inf + INF MdeModulePkg/Universal/Metronome/Metronome.inf } INF InOsEmuPkg/Sec/Sec.inf INF MdeModulePkg/Core/Pei/PeiMain.inf @@ -187,7 +187,7 @@ INF MdeModulePkg/Core/Dxe/DxeMain.inf INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf -INF InOsEmuPkg/MetronomeDxe/Metronome.inf +INF MdeModulePkg/Universal/Metronome/Metronome.inf INF InOsEmuPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf INF InOsEmuPkg/ResetRuntimeDxe/Reset.inf INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf -- cgit v1.2.3