VirtualBox

Ignore:
Timestamp:
Jan 21, 2025 2:53:44 PM (2 weeks ago)
Author:
vboxsync
Message:

Devices/EFI/Firmware: Workaround clang generating instruction sequences we can't emulate right on arm64 now when the flash MMIO region is accessed because IEM is not implemented there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/BaseMemoryLib/CopyMem.c

    r107872 r107874  
    1414#include "MemLibInternals.h"
    1515
    16 #if defined(VBOX) && defined(_MSC_VER)
    17 # pragma optimize("", off)
    18 #endif
     16#include <Library/IoLib.h>
     17
    1918
    2019/**
     
    5453      Source64      = (CONST UINT64 *)SourceBuffer;
    5554      while (Length >= 8) {
     55#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    5656        *(Destination64++) = *(Source64++);
     57#else
     58        MmioWrite64(Destination64, MmioRead64(Source64));
     59        Destination64++;
     60        Source64++;
     61#endif
    5762        Length            -= 8;
    5863      }
     
    6267      Source8      = (CONST UINT8 *)Source64;
    6368      while (Length-- != 0) {
     69#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    6470        *(Destination8++) = *(Source8++);
     71#else
     72        MmioWrite8(Destination8, MmioRead8(Source8));
     73        Destination8++;
     74        Source8++;
     75#endif
    6576      }
    6677    } else if (SourceBuffer < DestinationBuffer) {
     
    7889
    7990        while (Alignment-- != 0) {
     91#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    8092          *(--Destination8) = *(--Source8);
     93#else
     94          Destination8--;
     95          Source8--;
     96          MmioWrite8(Destination8, MmioRead8(Source8));
     97#endif
    8198          --Length;
    8299        }
     
    87104
    88105      while (Length > 0) {
     106#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    89107        *(--Destination64) = *(--Source64);
     108#else
     109        Destination64--;
     110        Source64--;
     111        MmioWrite64(Destination64, MmioRead64(Source64));
     112#endif
    90113        Length            -= 8;
    91114      }
     
    96119      Source32      = (CONST UINT32 *)SourceBuffer;
    97120      while (Length >= 4) {
     121#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    98122        *(Destination32++) = *(Source32++);
     123#else
     124        MmioWrite32(Destination32, MmioRead32(Source32));
     125        Destination32++;
     126        Source32++;
     127#endif
    99128        Length            -= 4;
    100129      }
     
    104133      Source8      = (CONST UINT8 *)Source32;
    105134      while (Length-- != 0) {
     135#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    106136        *(Destination8++) = *(Source8++);
     137#else
     138        MmioWrite8(Destination8, MmioRead8(Source8));
     139        Destination8++;
     140        Source8++;
     141#endif
    107142      }
    108143    } else if (SourceBuffer < DestinationBuffer) {
     
    120155
    121156        while (Alignment-- != 0) {
     157#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    122158          *(--Destination8) = *(--Source8);
     159#else
     160          Destination8--;
     161          Source8--;
     162          MmioWrite8(Destination8, MmioRead8(Source8));
     163#endif
    123164          --Length;
    124165        }
     
    129170
    130171      while (Length > 0) {
     172#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    131173        *(--Destination32) = *(--Source32);
     174#else
     175        Destination32--;
     176        Source32--;
     177        MmioWrite32(Destination32, MmioRead32(Source32));
     178#endif
    132179        Length            -= 4;
    133180      }
     
    138185      Source8      = (CONST UINT8 *)SourceBuffer;
    139186      while (Length-- != 0) {
     187#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    140188        *(Destination8++) = *(Source8++);
     189#else
     190        MmioWrite8(Destination8, MmioRead8(Source8));
     191        Destination8++;
     192        Source8++;
     193#endif
    141194      }
    142195    } else if (SourceBuffer < DestinationBuffer) {
     
    144197      Source8      = (CONST UINT8 *)SourceBuffer + (Length - 1);
    145198      while (Length-- != 0) {
     199#if !defined(VBOX) || !defined(MDE_CPU_AARCH64)
    146200        *(Destination8--) = *(Source8--);
     201#else
     202        MmioWrite8(Destination8, MmioRead8(Source8));
     203        Destination8--;
     204        Source8--;
     205#endif
    147206      }
    148207    }
     
    151210  return DestinationBuffer;
    152211}
    153 
    154 #if defined(VBOX) && defined(_MSC_VER)
    155 # pragma optimize("", on)
    156 #endif
Note: See TracChangeset for help on using the changeset viewer.

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