- Timestamp:
- Nov 9, 2021 12:40:13 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/system.c
r92280 r92288 54 54 55 55 56 #include <iprt/cdefs.h> 56 57 #include <stdint.h> 57 58 #include "biosint.h" … … 614 615 } 615 616 617 /** 618 * Reads two adjacent cmos bytes and return their values as a 16-bit word. 619 */ 620 static uint16_t get_cmos_word(uint8_t idxFirst) 621 { 622 return ((uint16_t)inb_cmos(idxFirst + 1) << 8) 623 | inb_cmos(idxFirst); 624 } 625 616 626 void BIOSCALL int15_function32(sys32_regs_t r) 617 627 { … … 644 654 #endif 645 655 646 /** @todo r=bird: I think we can do the first bit here in 16-bit, then decide 647 * whether we need to use 0x31 & 0x30 before blowing it up to 32-bit. Only, I'm 648 * a little bit too tired to think straight... */ 649 extended_memory_size = (uint16_t)inb_cmos(0x35) << 8; 650 extended_memory_size |= inb_cmos(0x34); 651 extended_memory_size *= 64; 652 #ifndef VBOX /* The following excludes 0xf0000000 thru 0xffffffff. Trust DevPcBios.cpp to get this right. */ 653 // greater than EFF00000??? 654 if(extended_memory_size > 0x3bc000) { 655 extended_memory_size = 0x3bc000; // everything after this is reserved memory until we get to 0x100000000 656 /* Go for the amount of memory above 16MB first. */ 657 extended_memory_size = get_cmos_word(0x34 /*+ 0x35*/); 658 if (extended_memory_size > 0) 659 { 660 extended_memory_size += _16M / _64K; 661 extended_memory_size <<= 16; 656 662 } 657 #endif /* !VBOX */ 658 extended_memory_size *= 1024; 659 extended_memory_size += 16L * 1024 * 1024; 660 661 if(extended_memory_size <= (16L * 1024 * 1024)) { 662 extended_memory_size = (uint16_t)inb_cmos(0x31) << 8; 663 extended_memory_size |= inb_cmos(0x30); 664 extended_memory_size *= 1024; 665 extended_memory_size += (1L * 1024 * 1024); 663 else 664 { 665 /* No memory above 16MB, query memory above 1MB ASSUMING we have at least 1MB. */ 666 extended_memory_size = get_cmos_word(0x30 /*+ 0x31*/); 667 extended_memory_size += _1M / _1K; 668 extended_memory_size *= _1K; 666 669 } 667 670 668 /* This is the amount of memory above 4GB measured in 64KB units. */ 669 c64k_above_4G_low = (uint16_t)inb_cmos(0x62) << 8; 670 c64k_above_4G_low |= inb_cmos(0x61); 671 672 c64k_above_4G_high = (uint16_t)inb_cmos(0x64) << 8; 673 c64k_above_4G_high |= inb_cmos(0x63); 674 /* 0x65 can be used if we need to go beyond 255 TiB */ 671 /* This is the amount of memory above 4GB measured in 64KB units. 672 Note! 0x65 can be used when we need to go beyond 255 TiB */ 673 c64k_above_4G_low = get_cmos_word(0x61 /*+ 0x62*/); 674 c64k_above_4G_high = get_cmos_word(0x63 /*+ 0x64*/); 675 675 676 676 #ifdef BIOS_WITH_MCFG_E820 /** @todo Actually implement the mcfg reporting. */
Note:
See TracChangeset
for help on using the changeset viewer.