Changeset 60433 in vbox for trunk/src/VBox/Devices
- Timestamp:
- Apr 11, 2016 5:14:35 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106519
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/BiosCommonCode/biosorg_check.sed
r60422 r60433 18 18 19 19 20 /biosorg_check_/!b end 20 /biosorg_check_at_/b check_at 21 /biosorg_check_before_or_at_/b check_before_or_at 22 b end 23 24 :check_at 25 #p # --debug 21 26 s/\(.*\)/\L\1/g 22 s/ f000:\(....\). *biosorg_check_0\(\1\)h *//27 s/....:\(....\). *biosorg_check_at_0\(\1\)h *// 23 28 /^$/b end 29 q 1 30 b end 31 32 # after or equal. 33 :check_before_or_at 34 #p # --debug 35 s/\(.*\)/\L\1/g 36 37 h 38 s/^....:\(....\). *biosorg_check_before_or_at_0\(....\)h */\2/ 39 x 40 s/^....:\(....\)/\1 / 41 42 43 # Loop for comparing the two addresses. The one in the pattern buffer (left) must be 44 # smaller or equal to the one in in the pattern buffer (BIOSORG address). 45 :compare_loop 46 /^f/b match_f_or_greater 47 /^e/b match_e_or_greater 48 /^d/b match_d_or_greater 49 /^c/b match_c_or_greater 50 /^b/b match_b_or_greater 51 /^a/b match_a_or_greater 52 /^9/b match_9_or_greater 53 /^8/b match_8_or_greater 54 /^7/b match_7_or_greater 55 /^6/b match_6_or_greater 56 /^5/b match_5_or_greater 57 /^4/b match_4_or_greater 58 /^3/b match_3_or_greater 59 /^2/b match_2_or_greater 60 /^1/b match_1_or_greater 61 /^0/b match_0_or_greater 62 :bad 63 p 64 x 24 65 p 25 66 q 1 67 b end 68 69 :bad_other 70 x 71 b bad 72 73 74 :match_f_or_greater 75 x 76 /^f/b next_compare 77 b bad_other 78 79 :match_e_or_greater 80 x 81 /^f/b end 82 /^e/b next_compare 83 b bad_other 84 85 :match_d_or_greater 86 x 87 /^[e-f]/b end 88 /^d/b next_compare 89 b bad_other 90 91 :match_c_or_greater 92 x 93 /^[d-f]/b end 94 /^c/b next_compare 95 b bad_other 96 97 :match_b_or_greater 98 x 99 /^[c-f]/b end 100 /^b/b next_compare 101 b bad_other 102 103 :match_a_or_greater 104 x 105 /^[b-f]/b end 106 /^a/b next_compare 107 b bad_other 108 109 :match_9_or_greater 110 x 111 /^[a-f]/b end 112 /^9/b next_compare 113 b bad_other 114 115 :match_8_or_greater 116 x 117 /^[9a-f]/b end 118 /^8/b next_compare 119 b bad_other 120 121 :match_7_or_greater 122 x 123 /^[8-9a-f]/b end 124 /^7/b next_compare 125 b bad_other 126 127 :match_6_or_greater 128 x 129 /^[7-9a-f]/b end 130 /^6/b next_compare 131 b bad_other 132 133 :match_5_or_greater 134 x 135 /^[6-9a-f]/b end 136 /^5/b next_compare 137 b bad_other 138 139 :match_4_or_greater 140 x 141 /^[5-9a-f]/b end 142 /^4/b next_compare 143 b bad_other 144 145 :match_3_or_greater 146 x 147 /^[4-9a-f]/b end 148 /^3/b next_compare 149 b bad_other 150 151 :match_2_or_greater 152 x 153 /^[3-9a-f]/b end 154 /^2/b next_compare 155 b bad_other 156 157 :match_1_or_greater 158 x 159 /^[2-9a-f]/b end 160 /^1/b next_compare 161 b bad_other 162 163 :match_0_or_greater 164 x 165 /^[1-9a-f]/b end 166 /^0/b next_compare 167 b bad_other 168 169 170 # Next round of the loop. 171 # 1. Drop the leading digit of the max address (BIOSORG). 172 # 2. Check if we've reached end of the address. If so, check that we've reached the space in the actual address. 173 # 3. Switch buffers so the actual address in the pattern space. 174 # 4. Drop the leading digit of the actual address. 175 # 5. Repeat. 176 :next_compare 177 s/^.// 178 /^$/b end_of_compare 179 x 180 s/^.// 181 b compare_loop 182 183 :end_of_compare 184 x 185 /^. /b end 186 b bad 187 26 188 :end 27 189 -
trunk/src/VBox/Devices/BiosCommonCode/commondefs.inc
r60422 r60433 119 119 120 120 ;; Adds a special label that will have its address checked after linking. 121 BIOSORG_CHECK macro 122 public biosorg_check_&addr123 biosorg_check_ &addr:121 BIOSORG_CHECK macro addr 122 public biosorg_check_at_&addr 123 biosorg_check_at_&addr: 124 124 endm 125 125 126 ;; Adds a special label that will have its address checked after linking. 127 BIOSORG_CHECK_BEFORE macro addr 128 public biosorg_check_before_or_at_&addr 129 biosorg_check_before_or_at_&addr: 130 endm 131 132 -
trunk/src/VBox/Devices/PC/BIOS/ata.c
r60422 r60433 475 475 476 476 removable = (*(buffer+0) & 0x80) ? 1 : 0; 477 #if VBOX_BIOS_CPU >= 80386 477 478 mode = *(buffer+96) ? ATA_MODE_PIO32 : ATA_MODE_PIO16; 479 #else 480 mode = ATA_MODE_PIO16; 481 #endif 478 482 blksize = 512; /* There is no sector size field any more. */ 479 483 … … 572 576 type = *(buffer+1) & 0x1f; 573 577 removable = (*(buffer+0) & 0x80) ? 1 : 0; 578 #if VBOX_BIOS_CPU >= 80386 574 579 mode = *(buffer+96) ? ATA_MODE_PIO32 : ATA_MODE_PIO16; 580 #else 581 mode = ATA_MODE_PIO16; 582 #endif 575 583 blksize = 2048; 576 584 -
trunk/src/VBox/Devices/PC/BIOS/ata.h
r56292 r60433 50 50 #define ATA_MODE_NONE 0x00 51 51 #define ATA_MODE_PIO16 0x00 52 #define ATA_MODE_PIO32 0x01 52 #if VBOX_BIOS_CPU >= 80386 53 # define ATA_MODE_PIO32 0x01 54 #endif 53 55 #define ATA_MODE_ISADMA 0x02 54 56 #define ATA_MODE_PCIDMA 0x03 -
trunk/src/VBox/Devices/PC/BIOS/disk.c
r58724 r60433 487 487 options = (translation == GEO_TRANSLATION_NONE ? 0 : 1 << 3); // chs translation 488 488 options |= (1 << 4); // lba translation 489 #if VBOX_BIOS_CPU >= 80386 489 490 options |= (mode == ATA_MODE_PIO32 ? 1 : 0 << 7); 491 #endif 490 492 options |= (translation == GEO_TRANSLATION_LBA ? 1 : 0 << 9); 491 493 options |= (translation == GEO_TRANSLATION_RECHS ? 3 : 0 << 9); -
trunk/src/VBox/Devices/PC/BIOS/eltorito.c
r58841 r60433 921 921 options |= (1<<5); // removable device 922 922 options |= (1<<6); // atapi device 923 #if VBOX_BIOS_CPU >= 80386 923 924 options |= (mode==ATA_MODE_PIO32?1:0<<7); 925 #endif 924 926 925 927 bios_dsk->dpte.iobase1 = iobase1; -
trunk/src/VBox/Devices/PC/BIOS/logo.c
r56292 r60433 116 116 */ 117 117 void wait_uninit(void); 118 #pragma aux wait_uninit = \ 118 #if VBOX_BIOS_CPU >= 80386 119 # pragma aux wait_uninit = \ 119 120 ".386" \ 120 121 "mov al, 34h" \ … … 130 131 "popad" \ 131 132 modify [ax] nomemory; 133 #else 134 # pragma aux wait_uninit = \ 135 "mov al, 34h" \ 136 "out 43h, al" \ 137 "xor ax, ax" \ 138 "out 40h, al" \ 139 "out 40h, al" \ 140 "push bp" \ 141 "push ds" \ 142 "mov ds, ax" \ 143 "call rtc_post" \ 144 "pop ds" \ 145 "pop bp" \ 146 modify [ax bx cx dx si di]; 147 #endif 132 148 133 149 … … 331 347 332 348 333 // Set PIT to 1ms ticks349 // Set PIT to 64hz. 334 350 wait_init(); 335 351 -
trunk/src/VBox/Devices/PC/BIOS/orgs.asm
r60422 r60433 74 74 75 75 ;; Set a fixed BIOS location, with a marker for verification 76 BIOSORG macro addr 76 BIOSORG macro addr, addr_minus_two 77 .errnz (addr - 2 - addr_minus_two) ;; Couldn't convince wasm to accept $ here. Would've save us a lot of bother and ugly SED. 78 BIOSORG_CHECK_BEFORE addr_minus_two 77 79 org addr - BIOS_FIX_BASE - 2 78 80 db 'XM' … … 204 206 ;; Start of fixed code - eoi_jmp_post is kept near here to allow short jumps. 205 207 ;; 206 BIOSORG 0E030h 208 BIOSORG 0E030h, 0E02Eh 207 209 eoi_both_pics: 208 210 mov al, PIC_CMD_EOI … … 236 238 ;; POST entry point 237 239 ;; -------------------------------------------------------- 238 BIOSORG 0E05Bh 240 BIOSORG 0E05Bh, 0E059h 239 241 post: 240 242 cli … … 426 428 427 429 ;; Initialize PCI devices. This can and should be done early. 428 if VBOX_BIOS_CPU ge 80386 430 if VBOX_BIOS_CPU ge 80386 ; (Impossible to do on 16-bit CPUs.) 429 431 call pcibios_init_iomem_bases 430 432 call pcibios_init_irqs … … 532 534 ;; NMI handler 533 535 ;; -------------------------------------------------------- 534 BIOSORG 0E2C3h 536 BIOSORG 0E2C3h, 0E2C1h 535 537 nmi: 536 538 C_SETUP … … 660 662 ;; INT 13h handler - Disk services 661 663 ;; -------------------------------------------------------- 662 BIOSORG 0E3FEh 664 BIOSORG 0E3FEh, 0E3FCh 663 665 664 666 int13_handler: … … 676 678 ;; INT 19h handler - Boot load service 677 679 ;; -------------------------------------------------------- 678 BIOSORG 0E6F2h 680 BIOSORG 0E6F2h, 0E6F0h 679 681 680 682 int19_handler: … … 744 746 ;; Baud Rate Generator Table 745 747 ;; -------------------------------------------------------- 746 BIOSORG 0E729h 748 BIOSORG 0E729h, 0E727h 747 749 748 750 … … 750 752 ;; INT 14h handler - Serial Communication Service 751 753 ;; -------------------------------------------------------- 752 BIOSORG 0E739h 754 BIOSORG 0E739h, 0E737h 753 755 int14_handler: 754 756 push ds … … 826 828 ;; INT 16h handler - Keyboard service 827 829 ;; -------------------------------------------------------- 828 BIOSORG 0E82Eh 830 BIOSORG 0E82Eh, 0E82Ch 829 831 int16_handler: 830 832 sti … … 898 900 ;; INT 09h handler - Keyboard ISR (IRQ 1) 899 901 ;; -------------------------------------------------------- 900 BIOSORG 0E987h 902 BIOSORG 0E987h, 0E985h 901 903 int09_handler: 902 904 cli ; TODO: why? they're off already! … … 976 978 ;; INT 13h handler - Diskette service 977 979 ;; -------------------------------------------------------- 978 BIOSORG 0EC59h 980 BIOSORG 0EC59h, 0EC57h 979 981 int13_diskette: 980 982 jmp int13_noeltorito … … 1297 1299 jnz rtc_pos_hour_loop 1298 1300 1299 1300 mov ax, [46Ch]1301 mov dx, [46Ch+2]1302 1303 1301 rtc_pos_shift: 1304 1302 mov cl, ch … … 1365 1363 ;; INT 0Eh handler - Diskette IRQ 6 ISR 1366 1364 ;; -------------------------------------------------------- 1367 BIOSORG 0EF57h 1365 BIOSORG 0EF57h, 0EF55h 1368 1366 int0e_handler: 1369 1367 push ax … … 1409 1407 ;; Diskette Parameter Table 1410 1408 ;; -------------------------------------------------------- 1411 BIOSORG 0EFC7h 1409 BIOSORG 0EFC7h, 0EFC5h 1412 1410 _diskette_param_table: 1413 1411 db 0AFh … … 1483 1481 ;; INT 10h functions 0-Fh entry point 1484 1482 ;; -------------------------------------------------------- 1485 BIOSORG 0F045h 1483 BIOSORG 0F045h, 0F043h 1486 1484 i10f0f_entry: 1487 1485 iret … … 1491 1489 ;; INT 10h handler - MDA/CGA video 1492 1490 ;; -------------------------------------------------------- 1493 BIOSORG 0F065h 1491 BIOSORG 0F065h, 0F063h 1494 1492 int10_handler: 1495 1493 ;; do nothing - assumes VGA … … 1500 1498 ;; MDA/CGA Video Parameter Table (INT 1Dh) 1501 1499 ;; -------------------------------------------------------- 1502 BIOSORG 0F0A4h 1500 BIOSORG 0F0A4h, 0F0A2h 1503 1501 mdacga_vpt: 1504 1502 … … 1614 1612 ;; INT 12h handler - Memory size 1615 1613 ;; -------------------------------------------------------- 1616 BIOSORG 0F841h 1614 BIOSORG 0F841h, 0F83Fh 1617 1615 int12_handler: 1618 1616 ;; Don't touch - fixed size! … … 1765 1763 ;; 8x8 font (first 128 characters) 1766 1764 ;; -------------------------------------------------------- 1767 BIOSORG 0FA6Eh 1765 BIOSORG 0FA6Eh, 0FA6Ch 1768 1766 include font8x8.inc 1769 1767 … … 1818 1816 iret 1819 1817 1818 if VBOX_BIOS_CPU lt 80386 1819 ; 1820 ; We're tight on space down below in the int08_handler, so put 1821 ; the 16-bit rollover code here. 1822 ; 1823 int08_maybe_rollover: 1824 ja int08_rollover 1825 cmp ax, 00B0h 1826 jb int08_store_ticks 1827 ;; there has been a midnight rollover 1828 int08_rollover: 1829 xor dx, dx 1830 xor ax, ax 1831 1832 inc byte ptr ds:[70h] ; increment rollover flag 1833 jmp int08_store_ticks 1834 endif 1820 1835 1821 1836 ;; -------------------------------------------------------- 1822 1837 ;; Timer tick - IRQ 0 handler 1823 1838 ;; -------------------------------------------------------- 1824 BIOSORG 0FEA5h 1839 BIOSORG 0FEA5h, 0FEA3h 1825 1840 int08_handler: 1826 1841 if VBOX_BIOS_CPU ge 80386 … … 1831 1846 sti 1832 1847 push ax 1833 push bx1834 1848 endif 1835 1849 push ds … … 1843 1857 else 1844 1858 mov ax, ds:[6Ch] ; get ticks dword 1845 mov bx, ds:[6Ch+2] 1846 add ax, 1 1847 adc bx, 0 1859 mov dx, ds:[6Ch+2] 1860 inc ax ; inc+jz+inc saves two bytes over add+adc. 1861 jnz int08_compare 1862 inc dx 1863 int08_compare: 1848 1864 endif 1849 1865 … … 1851 1867 if VBOX_BIOS_CPU ge 80386 1852 1868 cmp eax, 1800B0h 1869 jb int08_store_ticks 1853 1870 else 1854 cmp bx, 18h 1855 jb int08_store_ticks 1856 ja int08_rollover 1857 cmp ax, 00B0h 1858 endif 1859 jb int08_store_ticks 1871 cmp dx, 18h 1872 jae int08_maybe_rollover 1873 endif 1874 1875 if VBOX_BIOS_CPU ge 80386 1860 1876 ;; there has been a midnight rollover 1861 int08_rollover:1862 if VBOX_BIOS_CPU ge 803861863 1877 xor eax, eax 1864 else1865 xor ax, ax1866 xor bx, bx1867 endif1868 1878 inc byte ptr ds:[70h] ; increment rollover flag 1869 1879 1870 1880 int08_store_ticks: 1871 if VBOX_BIOS_CPU ge 803861872 1881 mov ds:[6Ch], eax 1873 1882 else 1883 int08_store_ticks: 1874 1884 mov ds:[6Ch], ax 1875 mov ds:[6Ch+2], bx1885 mov ds:[6Ch+2], dx 1876 1886 endif 1877 1887 … … 1900 1910 .286 1901 1911 else 1902 pop bx1903 1912 pop ax 1904 1913 endif … … 1909 1918 ;; Initial interrupt vector offsets for POST 1910 1919 ;; -------------------------------------------------------- 1911 BIOSORG 0FEF3h 1920 BIOSORG 0FEF3h, 0FEF1h 1912 1921 vector_table: 1913 1922 … … 1917 1926 ;; BIOS copyright string 1918 1927 ;; -------------------------------------------------------- 1919 BIOSORG 0FF00h 1928 BIOSORG 0FF00h, 0FEFEh 1920 1929 bios_string: 1921 1930 db BIOS_COPYRIGHT … … 1925 1934 ;; IRET - default interrupt handler 1926 1935 ;; -------------------------------------------------------- 1927 BIOSORG 0FF53h 1936 BIOSORG 0FF53h, 0FF51h 1928 1937 1929 1938 dummy_iret: … … 1944 1953 ;; Processor reset entry point 1945 1954 ;; -------------------------------------------------------- 1946 BIOSORG 0FFF0h 1955 BIOSORG 0FFF0h, 0FFEEh 1947 1956 cpu_reset: 1948 1957 ;; This is where the CPU starts executing after a reset -
trunk/src/VBox/Devices/PC/BIOS/pciutil.c
r56292 r60433 45 45 46 46 47 #if VBOX_BIOS_CPU >= 80386 47 48 /* Warning: Destroys high bits of ECX. */ 48 49 uint16_t pci_find_class(uint16_t op, uint32_t dev_class, uint16_t start_bdf); 49 # pragma aux pci_find_class = \50 # pragma aux pci_find_class = \ 50 51 ".386" \ 51 52 "shl ecx, 16" \ … … 57 58 "found:" \ 58 59 parm [ax] [cx dx] [si] value [bx]; 60 #endif 59 61 60 62 uint16_t pci_find_dev(uint16_t op, uint16_t dev_id, uint16_t ven_id, uint16_t start_bdf); … … 77 79 parm [ax] [bx] [di] value [cx]; 78 80 81 #if VBOX_BIOS_CPU >= 80386 79 82 /* Warning: Destroys high bits of ECX. */ 80 83 uint32_t pci_read_cfgd(uint16_t op, uint16_t bus_dev_fn, uint16_t reg); 81 # pragma aux pci_read_cfgd = \84 # pragma aux pci_read_cfgd = \ 82 85 ".386" \ 83 86 "int 0x1a" \ … … 85 88 "shr ecx, 16" \ 86 89 parm [ax] [bx] [di] value [cx ax]; 90 #endif 87 91 88 92 uint8_t pci_write_cfgb(uint16_t op, uint16_t bus_dev_fn, uint16_t reg, uint8_t val); … … 96 100 parm [ax] [bx] [di] [cx]; 97 101 102 #if VBOX_BIOS_CPU >= 80386 98 103 /* Warning: Destroys high bits of ECX. */ 99 104 uint8_t pci_write_cfgd(uint16_t op, uint16_t bus_dev_fn, uint16_t reg, uint32_t val); 100 # pragma aux pci_write_cfgd = \105 # pragma aux pci_write_cfgd = \ 101 106 ".386" \ 102 107 "xchg cx, dx" \ … … 105 110 "int 0x1a" \ 106 111 parm [ax] [bx] [di] [dx cx]; 112 #endif 107 113 108 114 … … 119 125 uint16_t pci_find_classcode(uint32_t dev_class) 120 126 { 127 #if VBOX_BIOS_CPU >= 80386 121 128 return pci_find_class((PCIBIOS_ID << 8) | PCIBIOS_FIND_CLASS_CODE, dev_class, 0); 129 #else 130 return UINT16_C(0xffff); 131 #endif 122 132 } 123 133 … … 134 144 uint32_t pci_read_config_dword(uint8_t bus, uint8_t dev_fn, uint8_t reg) 135 145 { 146 #if VBOX_BIOS_CPU >= 80386 136 147 return pci_read_cfgd((PCIBIOS_ID << 8) | PCIBIOS_READ_CONFIG_DWORD, (bus << 8) | dev_fn, reg); 148 #else 149 return pci_read_cfgw((PCIBIOS_ID << 8) | PCIBIOS_READ_CONFIG_WORD, (bus << 8) | dev_fn, reg) 150 || ((uint32_t)pci_read_cfgw((PCIBIOS_ID << 8) | PCIBIOS_READ_CONFIG_WORD, (bus << 8) | dev_fn, reg + 2) << 16); 151 #endif 137 152 } 138 153 -
trunk/src/VBox/Devices/PC/DevPcBios.cpp
r60422 r60433 1347 1347 } 1348 1348 1349 /* 1350 * Get the CPU arch so we can load the appropriate ROMs. 1351 */ 1352 PVM pVM = PDMDevHlpGetVM(pDevIns); 1353 CPUMMICROARCH const enmMicroarch = pVM ? pVM->cpum.ro.GuestFeatures.enmMicroarch : kCpumMicroarch_Intel_P6; 1354 1349 1355 if (pThis->pszPcBiosFile) 1350 1356 { … … 1405 1411 * Use one of the embedded BIOS ROM images. 1406 1412 */ 1407 PVM pVM = PDMDevHlpGetVM(pDevIns);1408 CPUMMICROARCH enmMicroarch = pVM ? pVM->cpum.ro.GuestFeatures.enmMicroarch : kCpumMicroarch_Intel_P6;1409 1413 uint8_t const *pbBios; 1410 1414 uint32_t cbBios; … … 1534 1538 } 1535 1539 1536 uint64_t cbFileLanBoot; 1537 const uint8_t *pu8LanBootBinary = NULL; 1538 uint64_t cbLanBootBinary; 1539 1540 /* 1541 * Determine the LAN boot ROM size, open specified ROM file in the process. 1542 */ 1543 RTFILE FileLanBoot = NIL_RTFILE; 1544 if (pThis->pszLanBootFile) 1545 { 1546 rc = RTFileOpen(&FileLanBoot, pThis->pszLanBootFile, 1547 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 1548 if (RT_SUCCESS(rc)) 1549 { 1550 rc = RTFileGetSize(FileLanBoot, &cbFileLanBoot); 1540 /* 1541 * Not loading LAN ROM for old CPUs. 1542 */ 1543 if ( enmMicroarch != kCpumMicroarch_Intel_8086 1544 && enmMicroarch != kCpumMicroarch_Intel_80186 1545 && enmMicroarch != kCpumMicroarch_NEC_V20 1546 && enmMicroarch != kCpumMicroarch_NEC_V30 1547 && enmMicroarch != kCpumMicroarch_Intel_80286) 1548 { 1549 const uint8_t *pu8LanBootBinary = NULL; 1550 uint64_t cbLanBootBinary; 1551 uint64_t cbFileLanBoot; 1552 1553 /* 1554 * Open the LAN boot ROM and figure it size. 1555 * Determine the LAN boot ROM size, open specified ROM file in the process. 1556 */ 1557 if (pThis->pszLanBootFile) 1558 { 1559 RTFILE hFileLanBoot = NIL_RTFILE; 1560 rc = RTFileOpen(&hFileLanBoot, pThis->pszLanBootFile, 1561 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 1551 1562 if (RT_SUCCESS(rc)) 1552 1563 { 1553 if (cbFileLanBoot > _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff)) 1554 rc = VERR_TOO_MUCH_DATA; 1555 } 1556 } 1557 if (RT_FAILURE(rc)) 1558 { 1559 /* 1560 * Ignore failure and fall back to the built-in LAN boot ROM. 1561 */ 1562 LogRel(("PcBios: Failed to open LAN boot ROM file '%s', rc=%Rrc!\n", pThis->pszLanBootFile, rc)); 1563 RTFileClose(FileLanBoot); 1564 FileLanBoot = NIL_RTFILE; 1565 MMR3HeapFree(pThis->pszLanBootFile); 1566 pThis->pszLanBootFile = NULL; 1567 } 1568 } 1569 1570 /* 1571 * Get the LAN boot ROM data. 1572 */ 1573 if (pThis->pszLanBootFile) 1574 { 1575 LogRel(("PcBios: Using LAN ROM '%s' with a size of %#x bytes\n", pThis->pszLanBootFile, cbFileLanBoot)); 1564 rc = RTFileGetSize(hFileLanBoot, &cbFileLanBoot); 1565 if (RT_SUCCESS(rc)) 1566 { 1567 if (cbFileLanBoot <= _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff)) 1568 { 1569 LogRel(("PcBios: Using LAN ROM '%s' with a size of %#x bytes\n", pThis->pszLanBootFile, cbFileLanBoot)); 1570 1571 /* 1572 * Allocate buffer for the LAN boot ROM data and load it. 1573 */ 1574 pThis->pu8LanBoot = (uint8_t *)PDMDevHlpMMHeapAllocZ(pDevIns, cbFileLanBoot); 1575 if (pThis->pu8LanBoot) 1576 { 1577 rc = RTFileRead(hFileLanBoot, pThis->pu8LanBoot, cbFileLanBoot, NULL); 1578 AssertLogRelRCReturnStmt(rc, RTFileClose(hFileLanBoot), rc); 1579 } 1580 else 1581 rc = VERR_NO_MEMORY; 1582 } 1583 else 1584 rc = VERR_TOO_MUCH_DATA; 1585 } 1586 RTFileClose(hFileLanBoot); 1587 } 1588 if (RT_FAILURE(rc)) 1589 { 1590 /* 1591 * Play stupid and ignore failures, falling back to the built-in LAN boot ROM. 1592 */ 1593 /** @todo r=bird: This should have some kind of rational. We don't usually 1594 * ignore the VM configuration. */ 1595 LogRel(("PcBios: Failed to open LAN boot ROM file '%s', rc=%Rrc!\n", pThis->pszLanBootFile, rc)); 1596 MMR3HeapFree(pThis->pszLanBootFile); 1597 pThis->pszLanBootFile = NULL; 1598 } 1599 } 1600 1601 /* If we were unable to get the data from file for whatever reason, fall 1602 * back to the built-in LAN boot ROM image. 1603 */ 1604 if (pThis->pu8LanBoot == NULL) 1605 { 1606 #ifdef VBOX_WITH_PXE_ROM 1607 pu8LanBootBinary = g_abNetBiosBinary; 1608 cbLanBootBinary = g_cbNetBiosBinary; 1609 #endif 1610 } 1611 else 1612 { 1613 pu8LanBootBinary = pThis->pu8LanBoot; 1614 cbLanBootBinary = cbFileLanBoot; 1615 } 1616 1576 1617 /* 1577 * Allocate buffer for the LAN boot ROM data. 1618 * Map the Network Boot ROM into memory. 1619 * 1620 * Currently there is a fixed mapping: 0x000e2000 to 0x000effff contains 1621 * the (up to) 56 kb ROM image. The mapping size is fixed to trouble with 1622 * the saved state (in PGM). 1578 1623 */ 1579 pThis->pu8LanBoot = (uint8_t *)PDMDevHlpMMHeapAllocZ(pDevIns, cbFileLanBoot); 1580 if (pThis->pu8LanBoot) 1581 { 1582 rc = RTFileRead(FileLanBoot, pThis->pu8LanBoot, cbFileLanBoot, NULL); 1583 if (RT_FAILURE(rc)) 1584 { 1585 AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Rrc\n", cbFileLanBoot, rc)); 1586 MMR3HeapFree(pThis->pu8LanBoot); 1587 pThis->pu8LanBoot = NULL; 1588 } 1589 rc = VINF_SUCCESS; 1590 } 1591 else 1592 rc = VERR_NO_MEMORY; 1593 } 1624 if (pu8LanBootBinary) 1625 { 1626 pThis->cbLanBoot = cbLanBootBinary; 1627 1628 rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, 1629 RT_MAX(cbLanBootBinary, _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff)), 1630 pu8LanBootBinary, cbLanBootBinary, 1631 PGMPHYS_ROM_FLAGS_SHADOWED, "Net Boot ROM"); 1632 AssertRCReturn(rc, rc); 1633 } 1634 } 1635 else if (pThis->pszLanBootFile) 1636 LogRel(("PcBios: Skipping LAN ROM '%s' due to ancient target CPU.\n", pThis->pszLanBootFile)); 1637 #ifdef VBOX_WITH_PXE_ROM 1594 1638 else 1595 pThis->pu8LanBoot = NULL; 1596 1597 /* cleanup */ 1598 if (FileLanBoot != NIL_RTFILE) 1599 RTFileClose(FileLanBoot); 1600 1601 /* If we were unable to get the data from file for whatever reason, fall 1602 * back to the built-in LAN boot ROM image. 1603 */ 1604 if (pThis->pu8LanBoot == NULL) 1605 { 1606 #ifdef VBOX_WITH_PXE_ROM 1607 pu8LanBootBinary = g_abNetBiosBinary; 1608 cbLanBootBinary = g_cbNetBiosBinary; 1639 LogRel(("PcBios: Skipping built in ROM due to ancient target CPU.\n")); 1609 1640 #endif 1610 } 1611 else 1612 { 1613 pu8LanBootBinary = pThis->pu8LanBoot; 1614 cbLanBootBinary = cbFileLanBoot; 1615 } 1616 1617 /* 1618 * Map the Network Boot ROM into memory. 1619 * 1620 * Currently there is a fixed mapping: 0x000e2000 to 0x000effff contains 1621 * the (up to) 56 kb ROM image. The mapping size is fixed to trouble with 1622 * the saved state (in PGM). 1623 */ 1624 if (pu8LanBootBinary) 1625 { 1626 pThis->cbLanBoot = cbLanBootBinary; 1627 1628 rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, 1629 RT_MAX(cbLanBootBinary, _64K - (VBOX_LANBOOT_SEG << 4 & 0xffff)), 1630 pu8LanBootBinary, cbLanBootBinary, 1631 PGMPHYS_ROM_FLAGS_SHADOWED, "Net Boot ROM"); 1632 AssertRCReturn(rc, rc); 1633 } 1634 1641 1642 /* 1643 * Configure Boot delay. 1644 */ 1635 1645 rc = CFGMR3QueryU8Def(pCfg, "DelayBoot", &pThis->uBootDelay, 0); 1636 1646 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.