VirtualBox

Ignore:
Timestamp:
Mar 31, 2025 11:31:09 AM (2 weeks ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
168237
Message:

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/CryptoPkg/Library/BaseCryptLib/SysCall/TimerWrapper.c

    r99404 r108794  
    1010#include <Uefi.h>
    1111#include <CrtLibSupport.h>
     12#include <Library/UefiBootServicesTableLib.h>
    1213#include <Library/UefiRuntimeServicesTableLib.h>
    1314
     
    1920#define SECSPERHOUR  (60 * 60)
    2021#define SECSPERDAY   (24 * SECSPERHOUR)
     22
     23long  timezone;
    2124
    2225//
     
    8083}
    8184
     85STATIC
     86time_t
     87CalculateTimeT (
     88  EFI_TIME  *Time
     89  )
     90{
     91  time_t  CalTime;
     92  UINTN   Year;
     93
     94  //
     95  // Years Handling
     96  // UTime should now be set to 00:00:00 on Jan 1 of the current year.
     97  //
     98  for (Year = 1970, CalTime = 0; Year != Time->Year; Year++) {
     99    CalTime = CalTime + (time_t)(CumulativeDays[IsLeap (Year)][13] * SECSPERDAY);
     100  }
     101
     102  //
     103  // Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment
     104  //
     105  CalTime = CalTime +
     106            (time_t)((Time->TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time->TimeZone * 60) : 0) +
     107            (time_t)(CumulativeDays[IsLeap (Time->Year)][Time->Month] * SECSPERDAY) +
     108            (time_t)(((Time->Day > 0) ? Time->Day - 1 : 0) * SECSPERDAY) +
     109            (time_t)(Time->Hour * SECSPERHOUR) +
     110            (time_t)(Time->Minute * 60) +
     111            (time_t)Time->Second;
     112
     113  return CalTime;
     114}
     115
    82116/* Get the system time as seconds elapsed since midnight, January 1, 1970. */
    83117// INTN time(
     
    92126  EFI_TIME    Time;
    93127  time_t      CalTime;
    94   UINTN       Year;
    95128
    96129  //
     
    102135  }
    103136
    104   //
    105   // Years Handling
    106   // UTime should now be set to 00:00:00 on Jan 1 of the current year.
    107   //
    108   for (Year = 1970, CalTime = 0; Year != Time.Year; Year++) {
    109     CalTime = CalTime + (time_t)(CumulativeDays[IsLeap (Year)][13] * SECSPERDAY);
    110   }
    111 
    112   //
    113   // Add in number of seconds for current Month, Day, Hour, Minute, Seconds, and TimeZone adjustment
    114   //
    115   CalTime = CalTime +
    116             (time_t)((Time.TimeZone != EFI_UNSPECIFIED_TIMEZONE) ? (Time.TimeZone * 60) : 0) +
    117             (time_t)(CumulativeDays[IsLeap (Time.Year)][Time.Month] * SECSPERDAY) +
    118             (time_t)(((Time.Day > 0) ? Time.Day - 1 : 0) * SECSPERDAY) +
    119             (time_t)(Time.Hour * SECSPERHOUR) +
    120             (time_t)(Time.Minute * 60) +
    121             (time_t)Time.Second;
     137  CalTime = CalculateTimeT (&Time);
    122138
    123139  if (timer != NULL) {
     
    126142
    127143  return CalTime;
     144}
     145
     146time_t
     147mktime (
     148  struct tm  *t
     149  )
     150{
     151  EFI_TIME  Time;
     152
     153  Time.Year     = (UINT16)t->tm_year;
     154  Time.Month    = (UINT8)t->tm_mon;
     155  Time.Day      = (UINT8)t->tm_mday;
     156  Time.Hour     = (UINT8)t->tm_hour;
     157  Time.Minute   = (UINT8)t->tm_min;
     158  Time.Second   = (UINT8)t->tm_sec;
     159  Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
     160
     161  return CalculateTimeT (&Time);
    128162}
    129163
     
    196230  return GmTime;
    197231}
     232
     233unsigned int
     234sleep (
     235  unsigned int  seconds
     236  )
     237{
     238  gBS->Stall (seconds * 1000 * 1000);
     239  return 0;
     240}
     241
     242int
     243gettimeofday (
     244  struct timeval   *tv,
     245  struct timezone  *tz
     246  )
     247{
     248  tv->tv_sec  = (long)time (NULL);
     249  tv->tv_usec = 0;
     250  return 0;
     251}
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette