VirtualBox

source: vbox/trunk/src/VBox/Devices/PC/BIOS/notes.txt@ 59354

Last change on this file since 59354 was 59354, checked in by vboxsync, 9 years ago

BIOS: Report I/O and local APIC ranges in E820h memory map.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1
2 Notes on BIOS usage
3 -------------------
4
5- DOS (including 6.22/7.1) does not need INT 15h or INT 1Ah. Most other
6 operating systems require INT 15h to detect installed memory.
7
8- OS/2 (WSeB/MCP/ACP) and Windows 98 SE are some of the very few operating
9 systems which use the El Torito floppy emulation.
10
11- NetWare 5.1 is one of the *extremely* few users of El Torito hard disk
12 emulation.
13
14- Keystroke check (INT 16h, fn 01h/10h) always enables interrupts on return.
15 DOS POWER.EXE depends on that in some situations.
16
17- MS-DOS 6.2/V is a rare user of the INT 15h keyboard intercept routines.
18
19- Some software uses the model byte at F000:FFFE to determine the system
20 type (PC-DOS 3.0, Norton Utilities 8). Other software first tries INT 15h,
21 fn C0h instead (PC-DOS 3.1, MSD).
22
23- DOS 4.01 (both IBM and Microsoft) calls INT 13h to read from disk with less
24 than 100 bytes of stack space early in the boot sequence.
25
26- Very few guests use the 32-bit PCI BIOS interface. One is OS/2 (but falls
27 back), another is Etherboot.
28
29- OS/2 is the only known guest which can run the 16-bit PCI BIOS in protected
30 mode (but only if the 32-bit PCI BIOS is unavailable).
31
32- NetWare 6.x is the only known guest which uses the PCI BIOS service to read
33 the IRQ routing table.
34
35- Any disk reads which use bus-master DMA (AHCI, IDE BM) must use VDS
36 (Virtual DMA Services) when present. Otherwise any reads/writes when the
37 real mode addresses don't map directly to physical addresses will fail
38 horribly. DOS 6.x with EMM386 is a good testcase (esp. loading drivers
39 into UMBs).
40
41- Many older OSes (especially UNIX based) require the FDPT to contain
42 physical ATA disk geometry; for that reason, disks smaller than ~500MB are
43 easiest to use. Otherwise a "large" BIOS disk option would be required.
44
45- Some really old OSes (Xenix circa 1986-7) do not understand the EBDA idea
46 and clear the memory. For those, the FDPT must be in the BIOS ROM area, or
47 the OS will destroy it (even when it's at 0:300 in the IVT).
48
49- Windows NT (including XP) uses INT 13h/08h to obtain the DPT for each floppy
50 drive. NT assumes a 13-byte DPT which includes the number of tracks. NT will
51 refuse to read more tracks than the DPT specifies and formats as many tracks
52 as the DPT specifies.
53
54- Windows 98 SE boot CD uses 32-bit registers in real mode and will fail in
55 mysterious ways if BIOS trashes high bits of EAX (and likely others).
56
57- PC DOS 6.x/7.x QCONFIG is a rare user of INT 16h fn 0Ah (read keyboard ID).
58
59- DOS POWER.EXE uses the real mode APM interface, OS/2 APM.SYS uses the 16-bit
60 protected mode APM interface, and Windows 9x uses the 32-bit protected mode
61 APM interface.
62
63- Windows 98 is one of the few APM 1.2 users; Windows 95 uses APM 1.1, while
64 newer systems prefer ACPI.
65
66- QNX4 calls 16-bit protected-mode PCI BIOS in an environment where ESP is
67 16-bit but SS is a 32-bit stack segment. In such environments, using the
68 ENTER/LEAVE sequence is fatal if the high word of EBP is non-zero (which
69 it will be with QNX 4.25). LEAVE propagates the high word of EBP into ESP
70 with fatal consequences.
71
72- Plan 9 also runs 16-bit code with a 32-bit stack segment, except Plan 9
73 thinks it counts as real mode. Same ENTER/LEAVE problem as above.
74
75- AIX 1.3 is a rare user of INT 15h/89h (switch to protected mode) service.
76
77- IBM OS/2 1.0/1.1 (but not other versions!) attempt to execute a 286 LOADALL
78 instruction. LOADALL must be emulated for OS/2 to work properly. HIMEM.SYS
79 version 2.03 and later also contains 286 LOADALL code but this will not be
80 executed on 386+ processors.
81
82- Windows NT 3.5 and 3.51 with MPS HAL requires that INT 15h/E820h return the
83 I/O APIC range as reserved, or not return any ranges at all just below 4GB.
84 Otherwise the NT kernel will crash early during init due to confusion about
85 the top of memory.
86
87
88 Notes on BIOS implementation
89 ----------------------------
90
91- To return values from functions not declared as __interrupt, the arguments
92 may need to be declared volatile (not ideal, but does the job).
93
94- The way the POST code selectively clears or doesn't clear memory
95 is extremely suspect and will need reworking.
96
97- Need to review string routines wrt direction flag (should be OK now).
98
99- Need to review CMOS access wrt interrupts (possible index reg change by
100 an interrupt handler).
101
102- The POST code zeroes the entire BDA, and then various bits zero specific
103 parts of the BDA again. That's a waste of time.
104
105- After a reset, all interrupts are unmasked. Not sure if that's OK.
106
107- BCC mishandles the following (where buf is an uint8_t array):
108 lba=buf[0x2B]*0x1000000+buf[0x2A]*0x10000+buf[0x29]*0x100+buf[0x28];
109 The buf[x]*100 expression should end up being of type signed int, which
110 causes the sign to be incorrectly propagated. BCC incorrectly keeps
111 the type unsigned.
112
113- The PCI BIOS services are implemented in C, compiled twice as 16-bit and
114 32-bit code. This reduces the development effort and significantly lowers
115 the risk of discrepancies between 16-bit and 32-bit implementation. Care
116 must be taken because the 16-bit implementation can be executed in both
117 real and protected mode.
118
119- APM can be in theory implemented only once for real, 16-bit protected and
120 32-bit protected mode. Unfortunately this is very inconvenient in C since
121 the default stack size changes between 16-bit and 32-bit callers. Therefore
122 real mode APM (which supports most functions) is implemented in C and
123 protected-mode APM is written in assembler for both 16-bit and 32-bit calls,
124 with a small 32->16 thunk.
125
126- The -of switch can be used to avoid generating ENTER/LEAVE instructions.
127 This appears to be an undocumented and perhaps unintentional side effect.
128
129
130 Code size notes (code as of 7/6/2011):
131
132 The following values are the size of the _TEXT segment, i.e. only C code;
133data defined in C is not included, neither are assembly modules.
134
135 Options: Size (hex):
136 -------- -----------
137 -0 -zu -s -oas -ecc 631A
138 -3 -zu -s -oas -ecc 5C1E
139 -0 -zu -s -oas 578A
140 -3 -zu -s -oas 5452
141
142 Both generating 386 code and using register-based calling convention for
143internal functions brings significant size savings (15% when combined).
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette