VirtualBox

Changeset 77669 in vbox


Ignore:
Timestamp:
Mar 12, 2019 4:34:13 PM (6 years ago)
Author:
vboxsync
Message:

EFI: Switched yasm to nasm, misc build fixes; work in progress.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew/Config.kmk

    r77662 r77669  
    4545# VBox Yasm command
    4646VBOX_YASMCMD   ?= $(firstword $(wildcard $(KBUILD_DEVTOOLS_HST)/bin/yasm$(HOSTSUFF_EXE)) yasm$(HOSTSUFF_EXE))
     47
     48# VBox nasm command
     49include $(KBUILD_PATH)/tools/NASM.kmk
     50TOOL_VBoxNasm = Our version of the NASM tool
     51ifndef TOOL_VBoxNasm_PATH
     52 TOOL_VBoxNasm_PATH   := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
     53 if "$(TOOL_VBoxNasm_PATH)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
     54  TOOL_VBoxNasm_PATH  := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
     55 endif
     56endif
     57ifneq ($(TOOL_VBoxNasm_PATH),)
     58 VBOX_NASMCMD     ?= $(TOOL_VBoxNasm_PATH)/nasm$(HOSTSUFF_EXE)
     59else
     60 VBOX_NASMCMD     ?= nasm$(HOSTSUFF_EXE)
     61endif
    4762
    4863# EFI requires python v2.x, so provide a way to select that while using 3.x for the rest of VBox.
  • trunk/src/VBox/Devices/EFI/FirmwareNew/Makefile.kmk

    r77662 r77669  
    213213        -E 'PYTHONDONTWRITEBYTECODE=1' \
    214214        -E 'IASL_BIN=$(VBOX_IASLCMD)' \
    215         -E 'NASM_BIN=$(VBOX_YASMCMD)' \
     215        -E 'NASM_BIN=$(VBOX_NASMCMD)' \
    216216        -E 'CONF_PATH=$(abspath $(@D)/../../Conf)' \
    217217        -E 'WORKSPACE=$(VBOX_PATH_EFI_FIRMWARE)' \
     
    258258                -e 's,@VBOX_IASLCMD@,$(VBOX_IASLCMD),' \
    259259                -e 's,@VBOX_YASMCMD@,$(VBOX_YASMCMD),' \
     260                -e 's,@VBOX_NASMCMD@,$(VBOX_NASMCMD),' \
    260261                -e 's,@KMK@,$(MAKE),' \
    261262               \
     
    280281                -e 's,@VBOX_IASLCMD@,$(VBOX_IASLCMD),' \
    281282                -e 's,@VBOX_YASMCMD@,$(VBOX_YASMCMD),' \
     283                -e 's,@VBOX_NASMCMD@,$(VBOX_NASMCMD),' \
    282284                -e 's,@KMK@,$(MAKE),' \
    283285               \
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Core/Dxe/Misc/Stall.c

    r77662 r77669  
    6969  //
    7070  if ((UINT64) Microseconds > 0x1999999999999999ULL) {
    71 #else
    72   if (0) {
    73 #endif
    7471    //
    7572    // Microseconds is too large to multiple by 10 first.  Perform the divide
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Logo/LogoDxe.inf

    r77662 r77669  
    2626#  This flag specifies whether HII resource section is generated into PE image.
    2727#
    28   UEFI_HII_RESOURCE_SECTION      = TRUE
     28# VBOX -- 'true' requires a resource compiler (@todo).
     29#  UEFI_HII_RESOURCE_SECTION      = TRUE
    2930
    3031#
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/Disk/PartitionDxe/Apple.c

    r76553 r77669  
    106106  UINT32                    SubBlockSize;
    107107  UINT32                    BlkPerSec;
     108  EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;
    108109
    109110  VBoxLogFlowFuncMarkDP(DevicePath);
     
    213214              DevicePath,
    214215              (EFI_DEVICE_PATH_PROTOCOL *) &CdDev,
     216              &PartitionInfo,
    215217              CdDev.PartitionStart,
    216218              CdDev.PartitionStart + CdDev.PartitionSize - 1,
    217               SubBlockSize,
    218               FALSE);
     219              SubBlockSize);
    219220
    220221          if (!EFI_ERROR (Status)) {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Universal/Disk/PartitionDxe/Mbr.c

    r77662 r77669  
    232232      ZeroMem (&PartitionInfo, sizeof (EFI_PARTITION_INFO_PROTOCOL));
    233233      PartitionInfo.Revision = EFI_PARTITION_INFO_PROTOCOL_REVISION;
    234       PartitionInfo.Type     = PARTITION_TYPE_MBR;
    235       if (Mbr->Partition[Index].OSIndicator == EFI_PARTITION) {
    236         PartitionInfo.System = 1;
    237       }
    238       CopyMem (&PartitionInfo.Info.Mbr, &Mbr->Partition[Index], sizeof (MBR_PARTITION_RECORD));
     234      PartitionInfo.Type     = PARTITION_TYPE_OTHER;
    239235
    240236      Status = PartitionInstallChildHandle (
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Library/AcpiTimerLib/AcpiTimerLib.c

    r77662 r77669  
    2626#define ACPI_TIMER_COUNT_SIZE  BIT24
    2727
    28 #ifdef VBOX
    29 UINT32 mPmba = 0x4000;
    30 
    31 #define PCI_BAR_IO             0x1
    32 #endif
    33 
    34 /**
    35   The constructor function enables ACPI IO space.
    36 
    37   If ACPI I/O space not enabled, this function will enable it.
    38   It will always return RETURN_SUCCESS.
    39 
    40   @retval EFI_SUCCESS   The constructor always returns RETURN_SUCCESS.
    41 
    42 **/
    43 #ifndef VBOX
    44 RETURN_STATUS
    45 EFIAPI
    46 AcpiTimerLibConstructor (
    47   VOID
    48   )
    49 {
    50   //
    51   // Check to see if the Power Management Base Address is already enabled
    52   //
    53   if ((PciRead8 (PMREGMISC) & PMIOSE) == 0) {
    54     //
    55     // If the Power Management Base Address is not programmed,
    56     // then program the Power Management Base Address from a PCD.
    57     //
    58     PciAndThenOr32 (PMBA, (UINT32)(~0x0000FFC0), PcdGet16 (PcdAcpiPmBaseAddress));
    59 
    60     //
    61     // Enable PMBA I/O port decodes in PMREGMISC
    62     //
    63     PciOr8 (PMREGMISC, PMIOSE);
    64   }
    65 
    66   return RETURN_SUCCESS;
    67 }
    68 #else
    69 RETURN_STATUS
    70 EFIAPI
    71 AcpiTimerLibConstructor (
    72   VOID
    73   )
    74 {
    75   UINT8     u8Device = 7;
    76   UINT16    u16VendorID = 0;
    77   UINT16    u16DeviceID = 0;
    78   u16VendorID = PciRead16(PCI_LIB_ADDRESS(0, u8Device, 0, 0));
    79   u16DeviceID = PciRead16(PCI_LIB_ADDRESS(0, u8Device, 0, 2));
    80   if (   u16VendorID != 0x8086
    81       || u16DeviceID != 0x7113)
    82     return RETURN_ABORTED;
    83 
    84   if (PciRead8 (PCI_LIB_ADDRESS (0,u8Device,0,0x80)) & 1) {
    85     mPmba = PciRead32 (PCI_LIB_ADDRESS (0, u8Device, 0, 0x40));
    86     ASSERT (mPmba & PCI_BAR_IO);
    87     DEBUG((DEBUG_INFO, "%a:%d mPmba:%x\n", __FUNCTION__, __LINE__, mPmba));
    88     mPmba &= ~PCI_BAR_IO;
    89     DEBUG((DEBUG_INFO, "%a:%d mPmba:%x\n", __FUNCTION__, __LINE__, mPmba));
    90   } else {
    91     PciAndThenOr32 (PCI_LIB_ADDRESS (0,u8Device,0,0x40),
    92                     (UINT32) ~0xfc0, mPmba);
    93     PciOr8         (PCI_LIB_ADDRESS (0,u8Device,0,0x04), 0x01);
    94     DEBUG((DEBUG_INFO, "%a:%d mPmba:%x\n", __FUNCTION__, __LINE__, mPmba));
    95   }
    96 
    97   //
    98   // ACPI Timer enable is in Bus 0, Device ?, Function 3
    99   //
    100   PciOr8         (PCI_LIB_ADDRESS (0,u8Device,0,0x80), 0x01);
    101   return RETURN_SUCCESS;
    102 }
    103 #endif
    104 
    105 /**
    106   Internal function to read the current tick counter of ACPI.
    107 
    108   Internal function to read the current tick counter of ACPI.
    109 
    110   @return The tick counter read.
    111 
    112 **/
    113 UINT32
    114 InternalAcpiGetTimerTick (
    115   VOID
    116   )
    117 {
    118   //
    119   //   Read PMBA to read and return the current ACPI timer value.
    120   //
    121 #ifndef VBOX
    122   return IoRead32 ((PciRead32 (PMBA) & ~PMBA_RTE) + ACPI_TIMER_OFFSET);
    123 #else
    124   return IoRead32 (mPmba + ACPI_TIMER_OFFSET);
    125 #endif
    126 }
    127 
    128 /**
    129   Stalls the CPU for at least the given number of ticks.
     28/**
    13029  Stalls the CPU for at least the given number of ticks.
    13130
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/PlatformPei/MemDetect.c

    r77662 r77669  
    725725
    726726  if (mBootMode == BOOT_ON_S3_RESUME) {
    727     MemoryBase = PcdGet32 (PcdS3AcpiReservedMemoryBase);
    728     MemorySize = PcdGet32 (PcdS3AcpiReservedMemorySize);
     727    //
     728    // Create the following memory HOB as an exception on the S3 boot path.
     729    //
     730    // Normally we'd create memory HOBs only on the normal boot path. However,
     731    // CpuMpPei specifically needs such a low-memory HOB on the S3 path as
     732    // well, for "borrowing" a subset of it temporarily, for the AP startup
     733    // vector.
     734    //
     735    // CpuMpPei saves the original contents of the borrowed area in permanent
     736    // PEI RAM, in a backup buffer allocated with the normal PEI services.
     737    // CpuMpPei restores the original contents ("returns" the borrowed area) at
     738    // End-of-PEI. End-of-PEI in turn is emitted by S3Resume2Pei before
     739    // transferring control to the OS's wakeup vector in the FACS.
     740    //
     741    // We expect any other PEIMs that "borrow" memory similarly to CpuMpPei to
     742    // restore the original contents. Furthermore, we expect all such PEIMs
     743    // (CpuMpPei included) to claim the borrowed areas by producing memory
     744    // allocation HOBs, and to honor preexistent memory allocation HOBs when
     745    // looking for an area to borrow.
     746    //
     747    AddMemoryRangeHob (0, BASE_512KB + BASE_128KB);
     748    MemoryBase = 0;
     749    MemorySize = BASE_512KB + BASE_128KB;
    729750  } else {
    730751    LowerMemorySize = GetSystemMemorySizeBelow4gb ();
     
    752773
    753774  if (UpperMemorySize != 0) {
    754     AddUntestedMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
     775    AddMemoryBaseSizeHob (BASE_4GB, UpperMemorySize);
    755776
    756777    MtrrSetMemoryAttribute (BASE_4GB, UpperMemorySize, CacheWriteBack);
  • trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/PlatformPei/Platform.c

    r77662 r77669  
    232232  RETURN_STATUS PcdStatus;
    233233
    234   PciIoBase = 0xC000;
    235   PciIoSize = 0x4000;
    236 
    237234#ifdef VBOX
    238235  EFI_PHYSICAL_ADDRESS RsdPtr;
     
    241238  UINT64 McfgSize = 0;
    242239#endif
     240  PciIoBase = 0xC000;
     241  PciIoSize = 0x4000;
     242
    243243  //
    244244  // Create Memory Type Information HOB
  • trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/DynamicCommand/TftpDynamicCommand/TftpDynamicCommand.inf

    r77662 r77669  
    2626#  This flag specifies whether HII resource section is generated into PE image.
    2727#
    28   UEFI_HII_RESOURCE_SECTION      = TRUE
     28# VBOX -- 'true' requires a resource compiler (@todo).
     29#  UEFI_HII_RESOURCE_SECTION      = TRUE
    2930
    3031[Sources.common]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/VBoxPkg/VBoxVgaDxe/VBoxVgaGraphicsOutput.c

    r76900 r77669  
    501501    );
    502502
    503   PcdSet32(PcdVideoHorizontalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].HorizontalResolution);
    504   PcdSet32(PcdVideoVerticalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution);
     503  PcdSet32S(PcdVideoHorizontalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].HorizontalResolution);
     504  PcdSet32S(PcdVideoVerticalResolution, Private->ModeData[Private->GraphicsOutput.Mode->Mode].VerticalResolution);
    505505
    506506  return EFI_SUCCESS;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/VBoxPkg/VBoxVgaDxe/VBoxVgaUgaDraw.c

    r76900 r77669  
    400400    );
    401401
    402   PcdSet32(PcdVideoHorizontalResolution, HorizontalResolution);
    403   PcdSet32(PcdVideoVerticalResolution, VerticalResolution);
     402  PcdSet32S(PcdVideoHorizontalResolution, HorizontalResolution);
     403  PcdSet32S(PcdVideoVerticalResolution, VerticalResolution);
    404404
    405405  return EFI_SUCCESS;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/vbox-tools_def.txt

    r77662 r77669  
    2727DEFINE IASL_OUTFLAGS           = -p
    2828
    29 DEFINE NASM_BIN                = @VBOX_YASMCMD@
     29DEFINE NASM_BIN                = @VBOX_NASMCMD@
    3030
    3131DEFINE MSFT_ASLPP_FLAGS        = /nologo /E /C /FIAutoGen.h
     
    156156NOOPT_VS2010_IA32_ASM_FLAGS       = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
    157157
    158 # yasm does not like plain -g option, needs format type
    159   DEBUG_VS2010_IA32_NASM_FLAGS    = -Ox -f win32 -g cv8
     158  DEBUG_VS2010_IA32_NASM_FLAGS    = -Ox -f win32 -g
    160159RELEASE_VS2010_IA32_NASM_FLAGS    = -Ox -f win32
    161 NOOPT_VS2010_IA32_NASM_FLAGS      = -O0 -f win32 -g cv8
     160NOOPT_VS2010_IA32_NASM_FLAGS      = -O0 -f win32 -g
    162161
    163162  DEBUG_VS2010_IA32_DLINK_FLAGS   = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:X86 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
     
    190189NOOPT_VS2010_X64_ASM_FLAGS    = /nologo /c /WX /W3 /Cx /Zd /Zi
    191190
    192 # yasm does not like plain -g option, needs format type
    193   DEBUG_VS2010_X64_NASM_FLAGS   = -Ox -f win64 -g cv8
     191  DEBUG_VS2010_X64_NASM_FLAGS   = -Ox -f win64 -g
    194192RELEASE_VS2010_X64_NASM_FLAGS   = -Ox -f win64
    195 NOOPT_VS2010_X64_NASM_FLAGS     = -O0 -f win64 -g cv8
     193NOOPT_VS2010_X64_NASM_FLAGS     = -O0 -f win64 -g
    196194
    197195  DEBUG_VS2010_X64_DLINK_FLAGS  = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
     
    366364*_*_*_NASM_PATH                = DEF(NASM_BIN)
    367365# NASMB uses NASM produce a .bin from a .nasmb NASM source file
    368 *_*_*_NASMB_FLAGS              = -f bin -D__YASM__ -DASM_FORMAT_BIN -DVBOX
     366#*_*_*_NASMB_FLAGS              = -f bin -D__YASM__ -DASM_FORMAT_BIN -DVBOX
     367*_*_*_NASMB_FLAGS              = -f bin -DASM_FORMAT_BIN -DVBOX
    369368
    370369#################
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