Changeset 58803 in vbox for trunk/src/VBox/Devices/EFI/Firmware
- Timestamp:
- Nov 20, 2015 5:21:41 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware/OvmfPkg/ResetVector/Ia32/PageTables64.asm
r58464 r58803 45 45 46 46 ; 47 %ifdef VBOX 48 ; For OVMF, build some initial page tables at 0x2000000-0x2006000. 49 ; Required because we had to relocate MEMFD where the page table resides 50 ; from 0x800000 to not interfere with certain OS X bootloaders. 51 %else 47 52 ; For OVMF, build some initial page tables at 0x800000-0x806000. 53 %endif 48 54 ; 49 55 ; This range should match with PcdOvmfSecPageTablesBase and … … 57 63 xor eax, eax 58 64 clearPageTablesMemoryLoop: 65 %ifdef VBOX 66 mov dword[ecx * 4 + 0x2000000 - 4], eax 67 %else 59 68 mov dword[ecx * 4 + 0x800000 - 4], eax 69 %endif 60 70 loop clearPageTablesMemoryLoop 61 71 … … 63 73 ; Top level Page Directory Pointers (1 * 512GB entry) 64 74 ; 75 %ifdef VBOX 76 mov dword[0x2000000], 0x2001000 + PAGE_PDP_ATTR 77 %else 65 78 mov dword[0x800000], 0x801000 + PAGE_PDP_ATTR 79 %endif 66 80 67 81 ; 68 82 ; Next level Page Directory Pointers (4 * 1GB entries => 4GB) 69 83 ; 84 %ifdef VBOX 85 mov dword[0x2001000], 0x2002000 + PAGE_PDP_ATTR 86 mov dword[0x2001008], 0x2003000 + PAGE_PDP_ATTR 87 mov dword[0x2001010], 0x2004000 + PAGE_PDP_ATTR 88 mov dword[0x2001018], 0x2005000 + PAGE_PDP_ATTR 89 %else 70 90 mov dword[0x801000], 0x802000 + PAGE_PDP_ATTR 71 91 mov dword[0x801008], 0x803000 + PAGE_PDP_ATTR 72 92 mov dword[0x801010], 0x804000 + PAGE_PDP_ATTR 73 93 mov dword[0x801018], 0x805000 + PAGE_PDP_ATTR 94 %endif 74 95 75 96 ; … … 82 103 shl eax, 21 83 104 add eax, PAGE_2M_PDE_ATTR 105 %ifdef VBOX 106 mov [ecx * 8 + 0x2002000 - 8], eax 107 %else 84 108 mov [ecx * 8 + 0x802000 - 8], eax 109 %endif 85 110 loop pageTableEntriesLoop 86 111 … … 88 113 ; Set CR3 now that the paging structures are available 89 114 ; 115 %ifdef VBOX 116 mov eax, 0x2000000 117 %else 90 118 mov eax, 0x800000 119 %endif 91 120 mov cr3, eax 92 121 -
trunk/src/VBox/Devices/EFI/Firmware/UefiCpuPkg/ResetVector/Vtf0/Ia32/Flat32ToFlat64.asm
r58459 r58803 14 14 ;------------------------------------------------------------------------------ 15 15 16 %ifdef VBOX17 %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, EFLAGS27 ;28 %macro FILL_ENTRIES 329 mov ebx, %230 %%myloop:31 mov [ebx], eax32 mov dword [ebx + 4], 033 add eax, %134 add ebx, 835 cmp ebx, %336 jb %%myloop37 %endmacro38 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, EFLAGS45 ;46 %macro ZERO_ENTRIES 247 mov ebx, %148 xor eax, eax49 %%myloop:50 mov [ebx], eax51 mov dword [ebx + 4], eax52 add ebx, 853 cmp ebx, %254 jb %%myloop55 %endmacro56 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 ; VBOX64 65 66 16 BITS 32 67 17 68 18 ; 69 %ifndef VBOX70 19 ; Modified: EAX 71 %else72 ; Modified: EAX, EBX73 %endif74 20 ; 75 21 Transition32FlatTo64Flat: 76 22 77 %ifndef VBOX78 mov eax, ((ADDR_OF_START_OF_RESET_CODE & ~0xfff) - 0x1000)79 %else ; !VBOX80 ;81 ; Produce our own page table that does not reside in ROM, since the PGM82 ; 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 + 0x400088 89 ; Second, set up page a directory pointer table with 4 entries pointing to90 ; 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_ADDR92 FILL_ENTRIES X86_PAGE_4K_SIZE, VBOX_PDPTR_ADDR, VBOX_PDPTR_ADDR + 4*893 ZERO_ENTRIES VBOX_PDPTR_ADDR + 4*8, VBOX_PDPTR_ADDR + 0x100094 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_ADDR97 mov dword [VBOX_PML4_ADDR + 4], 098 ZERO_ENTRIES VBOX_PML4_ADDR + 1*8, VBOX_PML4_ADDR + 0x100099 100 mov eax, VBOX_PML4_ADDR101 %endif102 23 OneTimeCall SetCr3ForPageTables64 103 24 -
trunk/src/VBox/Devices/EFI/Firmware/vbox-tools_def.txt
r58522 r58803 354 354 *_*_*_NASM_PATH = DEF(NASM_BIN) 355 355 # NASMB uses NASM produce a .bin from a .nasmb NASM source file 356 *_*_*_NASMB_FLAGS = -f bin -D__YASM__ -DASM_FORMAT_BIN 357 356 *_*_*_NASMB_FLAGS = -f bin -D__YASM__ -DASM_FORMAT_BIN -DVBOX 357
Note:
See TracChangeset
for help on using the changeset viewer.