VirtualBox

Ignore:
Timestamp:
Nov 20, 2015 5:21:41 PM (9 years ago)
Author:
vboxsync
Message:

EFI/Firmware: Fix page table location for amd64 after MEMFD had to be relocated because of OS X guests. The page table location must match the gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecPageTablesBase PCD defined in OvmfPkgX64.fdf. Remove unused modifications in the old ResetVector code which now moved to OvmfPkg

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm

    r58459 r58803  
    1414;------------------------------------------------------------------------------
    1515
    16 %ifdef VBOX
    17  %include "VBox/nasm.mac"
    18  %include "iprt/x86.mac"
    19 
    20  ;;
    21  ; Macro for filling in page table entries with EAX as base content.
    22  ;
    23  ; @param    %1  What to increment EAX with for each iteration.
    24  ; @param    %2  Start address.
    25  ; @param    %3  End address (exclusive).
    26  ; @uses     EAX, EBX, EFLAGS
    27  ;
    28  %macro FILL_ENTRIES 3
    29      mov     ebx, %2
    30  %%myloop:
    31      mov     [ebx], eax
    32      mov     dword [ebx + 4], 0
    33      add     eax, %1
    34      add     ebx, 8
    35      cmp     ebx, %3
    36      jb      %%myloop
    37  %endmacro
    38 
    39  ;;
    40  ; Macro for filling in page table entries with zeros.
    41  ;
    42  ; @param    %1 Start address.
    43  ; @param    %2  End address (exclusive).
    44  ; @uses     EAX, EBX, EFLAGS
    45  ;
    46  %macro ZERO_ENTRIES 2
    47      mov     ebx, %1
    48      xor     eax, eax
    49  %%myloop:
    50      mov     [ebx], eax
    51      mov     dword [ebx + 4], eax
    52      add     ebx, 8
    53      cmp     ebx, %2
    54      jb      %%myloop
    55  %endmacro
    56 
    57  ;;
    58  ; The address of the page tables.
    59  %define VBOX_PDPT_ADDR     (0x00800000 - 0x6000)
    60  %define VBOX_PDPTR_ADDR    (0x00800000 - 0x2000)
    61  %define VBOX_PML4_ADDR     (0x00800000 - 0x1000)
    62 
    63 %endif ; VBOX
    64 
    65 
    6616BITS    32
    6717
    6818;
    69 %ifndef VBOX
    7019; Modified:  EAX
    71 %else
    72 ; Modified:  EAX, EBX
    73 %endif
    7420;
    7521Transition32FlatTo64Flat:
    7622
    77 %ifndef VBOX
    78     mov     eax, ((ADDR_OF_START_OF_RESET_CODE & ~0xfff) - 0x1000)
    79 %else ; !VBOX
    80     ;
    81     ; Produce our own page table that does not reside in ROM, since the PGM
    82     ; pool code cannot quite cope with write monitoring ROM pages.
    83     ;
    84 
    85     ; First, set up page directories with 2MB pages for the first 4GB.
    86     mov     eax, ( X86_PDE4M_P | X86_PDE4M_A | X86_PDE4M_PS | X86_PDE4M_PCD | X86_PDE4M_RW | X86_PDE4M_D )
    87     FILL_ENTRIES X86_PAGE_2M_SIZE, VBOX_PDPT_ADDR, VBOX_PDPT_ADDR + 0x4000
    88 
    89     ; Second, set up page a directory pointer table with 4 entries pointing to
    90     ; the PTPDs we created above and the remainder as zeros.
    91     mov     eax, ( X86_PDPE_P | X86_PDPE_RW | X86_PDPE_A | X86_PDPE_PCD ) + VBOX_PDPT_ADDR
    92     FILL_ENTRIES X86_PAGE_4K_SIZE, VBOX_PDPTR_ADDR, VBOX_PDPTR_ADDR + 4*8
    93     ZERO_ENTRIES VBOX_PDPTR_ADDR + 4*8, VBOX_PDPTR_ADDR + 0x1000
    94 
    95     ; Third, set up a PML4 with the first entry pointing to the previous table.
    96     mov     dword [VBOX_PML4_ADDR], ( X86_PML4E_P | X86_PML4E_PCD | X86_PML4E_A | X86_PML4E_RW ) + VBOX_PDPTR_ADDR
    97     mov     dword [VBOX_PML4_ADDR + 4], 0
    98     ZERO_ENTRIES VBOX_PML4_ADDR + 1*8, VBOX_PML4_ADDR + 0x1000
    99 
    100     mov     eax, VBOX_PML4_ADDR
    101 %endif
    10223    OneTimeCall SetCr3ForPageTables64
    10324
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