Skip to content

Commit 7e2268f

Browse files
authored
Merge branch 'master' into cpu/fred
2 parents c80d0f0 + d6243e0 commit 7e2268f

38 files changed

+2922
-185
lines changed

.gitattributes

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
* text=auto eol=lf
2-
configure binary
2+
configure binary
3+
4+
# Explicitly enforce LF on frequently-edited generated/interop files.
5+
bochs/iodev/fw_cfg.cc text eol=lf
6+
bochs/iodev/fw_cfg.h text eol=lf
7+
bochs/iodev/acpi_dsdt_aml.h text eol=lf

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ bochs-msvc-src.zip
4747
/bochs/bios/rombios*.txt
4848
/bochs/bios/rombios*.bin
4949
/bochs/bios/rombios32.out
50+
/bochs/bios/acpi-dsdt-preprocessed.*
51+
52+
# ACPI DSDT generation temporary outputs (bochs/tools/gen_acpi_dsdt_aml.py)
53+
/bochs/tools/_acpi_dsdt_aml.*
5054

5155
# /bochs/build/linux/
5256
/bochs/build/linux/DOC-linux.html

bochs/.bochsrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ mouse: enabled=0
490490
# original i440FX doesn't support them. The options 'noacpi' and 'nohpet' make
491491
# it possible to disable them. The option 'noagp' disables the incomplete AGP
492492
# subsystem of the i440BX chipset.
493+
# If PCI is enabled, the 'nofloppy' option disables the FDC if no floppy drive
494+
# is configured.
493495
#
494496
# Example:
495497
# pci: enabled=1, chipset=i440fx, slot1=pcivga, slot2=ne2k, advopts=noacpi
@@ -582,6 +584,7 @@ private_colormap: enabled=0
582584
# floppya: image=path, status=inserted (guess media type from image size)
583585
# floppya: 1_44=vvfat:path, status=inserted (use directory as VFAT media)
584586
# floppya: type=1_44 (1.44M 3.5" floppy drive, no media)
587+
# floppya: type=none (no floppy, to be used with pci: advopts=nofloppy)
585588
#
586589
# The path should be the name of a disk image file. On Unix, you can use a raw
587590
# device name such as /dev/fd0 on Linux. On win32 platforms, use drive letters
@@ -592,6 +595,7 @@ private_colormap: enabled=0
592595
# The optional parameter 'write_protected' can be used to control the media
593596
# write protect switch. By default it is turned off.
594597
#=======================================================================
598+
#floppya: type=none
595599
floppya: 1_44=/dev/fd0, status=inserted
596600
#floppya: image=../1.44, status=inserted
597601
#floppya: 1_44=/dev/fd0H1440, status=inserted
@@ -604,6 +608,7 @@ floppya: 1_44=/dev/fd0, status=inserted
604608
# FLOPPYB:
605609
# See FLOPPYA above for syntax
606610
#=======================================================================
611+
#floppyb: type=none
607612
#floppyb: 1_44=b:, status=inserted
608613
#floppyb: 1_44=b.img, status=inserted
609614

bochs/CHANGES

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,33 @@ Detailed change log :
3434
- Config interface
3535
- On Windows make sure file name parameters use backslash as separator
3636
- Removed backward compatibility mode for USB device options
37+
- Increased maximum host memory size to 8192 MB (was 2048 MB)
3738

3839
- Memory
40+
- PCI hole support for >3GB RAM (NEW)
41+
Added guest physical address translation for systems with more than 3GB RAM.
42+
RAM from 3GB-4GB is remapped above 4GB to make room for PCI MMIO space.
43+
The bx_translate_gpa_to_linear() helper handles the remapping transparently.
44+
Works correctly with 2GB, 4GB, 8GB, 12GB, 16GB, and larger RAM configurations.
45+
3946
- Added support for overlapping r/o memory handlers (used for PCI ROM)
4047
- Added support for mapping PCI ROM to expansion ROM space
4148

4249
- I/O Devices
50+
- fw_cfg (NEW)
51+
Added QEMU-compatible fw_cfg device for UEFI/OVMF firmware support.
52+
Provides system configuration to firmware via I/O ports 0x510-0x51B:
53+
- E820 memory map with PCI hole (3GB-4GB reserved for MMIO)
54+
- ACPI tables (RSDP, XSDT, FADT, FACS, DSDT, MADT, HPET)
55+
- RAM size and CPU count information
56+
- DMA protocol for table loading
57+
This enables booting UEFI operating systems including Windows Server 2025
58+
and modern Linux distributions with OVMF firmware.
59+
- ACPI Tables
60+
Added dynamic ACPI table generation for UEFI firmware compatibility.
61+
Tables are compatible with PIIX4 PM/ACPI and include proper DSDT.
62+
The generated DSDT is aligned with the default PCI/PIIX device model.
63+
4364
- GeForce (NEW)
4465
Added basic support for three GeForce models. Most of the 2D features are present,
4566
but 3D is still WIP. Several Windows versions up to Win 7 have been reported to
@@ -3133,7 +3154,7 @@ Detailed change log :
31333154
[1021758] GNU/k*BSD host support by Robert Millan
31343155
[969967] int 15/ah=87h clearing cr0 by Ben Lunt
31353156
[1048327] Russian Keymap by Dmitry Soshnikov
3136-
[851332] DESTDIR support for install_dlx by Ville Skytt�
3157+
[851332] DESTDIR support for install_dlx by Ville Skytt�
31373158
[970929] gdbstub support for MinGW tool chains by Muranaka Masaki
31383159
[1021740] Turn gdb stub into a runtime option by Charles Duffy
31393160
[1063329] RFB key press/release bug fix by Remko van der Vossen

bochs/build/win32/vs2019-workspace/vs2019-plugins/iodev.vcxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,16 @@
215215
</Bscmake>
216216
</ItemDefinitionGroup>
217217
<ItemGroup>
218+
<ClCompile Include="..\iodev\acpi_tables.cc" />
218219
<ClCompile Include="..\iodev\devices.cc" />
220+
<ClCompile Include="..\iodev\fw_cfg.cc" />
219221
<ClCompile Include="..\iodev\slowdown_timer.cc" />
220222
<ClCompile Include="..\iodev\virt_timer.cc" />
221223
</ItemGroup>
222224
<ItemGroup>
225+
<ClInclude Include="..\iodev\acpi_dsdt_aml.h" />
226+
<ClInclude Include="..\iodev\acpi_tables.h" />
227+
<ClInclude Include="..\iodev\fw_cfg.h" />
223228
<ClInclude Include="..\iodev\iodev.h" />
224229
<ClInclude Include="..\iodev\slowdown_timer.h" />
225230
<ClInclude Include="..\iodev\virt_timer.h" />

bochs/build/win32/vs2019-workspace/vs2019/iodev.vcxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,13 +216,15 @@
216216
</ItemDefinitionGroup>
217217
<ItemGroup>
218218
<ClCompile Include="..\iodev\acpi.cc" />
219+
<ClCompile Include="..\iodev\acpi_tables.cc" />
219220
<ClCompile Include="..\iodev\biosdev.cc" />
220221
<ClCompile Include="..\iodev\busmouse.cc" />
221222
<ClCompile Include="..\iodev\cmos.cc" />
222223
<ClCompile Include="..\iodev\devices.cc" />
223224
<ClCompile Include="..\iodev\dma.cc" />
224225
<ClCompile Include="..\iodev\extfpuirq.cc" />
225226
<ClCompile Include="..\iodev\floppy.cc" />
227+
<ClCompile Include="..\iodev\fw_cfg.cc" />
226228
<ClCompile Include="..\iodev\gameport.cc" />
227229
<ClCompile Include="..\iodev\harddrv.cc" />
228230
<ClCompile Include="..\iodev\hpet.cc" />
@@ -246,12 +248,15 @@
246248
</ItemGroup>
247249
<ItemGroup>
248250
<ClInclude Include="..\iodev\acpi.h" />
251+
<ClInclude Include="..\iodev\acpi_dsdt_aml.h" />
252+
<ClInclude Include="..\iodev\acpi_tables.h" />
249253
<ClInclude Include="..\iodev\biosdev.h" />
250254
<ClInclude Include="..\iodev\busmouse.h" />
251255
<ClInclude Include="..\iodev\cmos.h" />
252256
<ClInclude Include="..\iodev\dma.h" />
253257
<ClInclude Include="..\iodev\extfpuirq.h" />
254258
<ClInclude Include="..\iodev\floppy.h" />
259+
<ClInclude Include="..\iodev\fw_cfg.h" />
255260
<ClInclude Include="..\iodev\gameport.h" />
256261
<ClInclude Include="..\iodev\harddrv.h" />
257262
<ClInclude Include="..\iodev\hpet.h" />

bochs/config.cc

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ void bx_init_options()
519519
bx_param_bool_c *enabled, *readonly;
520520
bx_param_enum_c *mode, *type, *toggle, *status;
521521
bx_param_filename_c *path;
522-
char name[BX_PATHNAME_LEN], descr[512], label[512];
522+
char name[BX_PATHNAME_LEN], descr[512], label[512], bxshare[BX_PATHNAME_LEN];
523523

524524
bx_param_c *root_param = SIM->get_param(".");
525525

@@ -726,7 +726,7 @@ void bx_init_options()
726726
"host",
727727
"Host allocated memory size (megabytes)",
728728
"Amount of host allocated memory in megabytes",
729-
1, 2048,
729+
1, 8192,
730730
BX_DEFAULT_MEM_MEGS);
731731
host_ramsize->set_ask_format("Enter host memory size (MB): [%d] ");
732732
ram->set_options(ram->SERIES_ASK);
@@ -735,8 +735,8 @@ void bx_init_options()
735735
"block_size",
736736
"Memory block granularity (kilobytes)",
737737
"Granularity of host memory allocation",
738-
4, 8192,
739-
128);
738+
0, 8192,
739+
0);
740740
mem_block_size->set_ask_format("Enter memory block size (KB): [%d] ");
741741
ram->set_options(ram->SERIES_ASK);
742742

@@ -746,7 +746,8 @@ void bx_init_options()
746746
"Pathname of ROM image to load",
747747
"", BX_PATHNAME_LEN);
748748
path->set_format("Name of ROM BIOS image: %s");
749-
sprintf(name, "%s" DIRECTORY_SEPARATOR "BIOS-bochs-latest", (char *)get_builtin_variable("BXSHARE"));
749+
get_bxshare_path(bxshare);
750+
sprintf(name, "%s" DIRECTORY_SEPARATOR "BIOS-bochs-latest", bxshare);
750751
path->set_initial_val(name);
751752
bx_param_num_c *romaddr = new bx_param_num_c(rom,
752753
"address",
@@ -775,7 +776,7 @@ void bx_init_options()
775776
"Pathname of VGA ROM image to load",
776777
"", BX_PATHNAME_LEN);
777778
path->set_format("Name of VGA BIOS image: %s");
778-
sprintf(name, "%s" DIRECTORY_SEPARATOR "VGABIOS-lgpl-latest.bin", get_builtin_variable("BXSHARE"));
779+
sprintf(name, "%s" DIRECTORY_SEPARATOR "VGABIOS-lgpl-latest.bin", bxshare);
779780
path->set_initial_val(name);
780781
vgarom->set_options(vgarom->SERIES_ASK);
781782

@@ -1626,6 +1627,14 @@ void bx_init_options()
16261627
"Debug messages written to i/o port 0xE9 from ring3 will be displayed on console",
16271628
0);
16281629

1630+
// fw_cfg device (UEFI/OVMF support)
1631+
bx_list_c *fw_cfg = new bx_list_c(misc, "fw_cfg", "QEMU fw_cfg device (UEFI/OVMF support)");
1632+
new bx_param_bool_c(fw_cfg,
1633+
"enabled",
1634+
"Enable fw_cfg device",
1635+
"Enables the QEMU-compatible fw_cfg device used by UEFI/OVMF firmware",
1636+
0);
1637+
16291638
#if BX_SUPPORT_IODEBUG
16301639
// iodebug all rings
16311640
new bx_param_bool_c(misc,
@@ -3187,6 +3196,12 @@ static int parse_line_formatted(const char *context, int num_params, char *param
31873196
PARSE_ERR(("%s: port_e9_hack directive malformed.", context));
31883197
}
31893198
}
3199+
} else if (!strcmp(params[0], "fw_cfg")) {
3200+
for (i=1; i<num_params; i++) {
3201+
if (bx_parse_param_from_list(context, params[i], (bx_list_c*) SIM->get_param(BXPN_FW_CFG_ROOT)) < 0) {
3202+
PARSE_ERR(("%s: fw_cfg directive malformed.", context));
3203+
}
3204+
}
31903205
} else if (!strcmp(params[0], "iodebug")) {
31913206
#if BX_SUPPORT_IODEBUG
31923207
if (num_params != 2) {
@@ -3582,6 +3597,7 @@ int bx_write_configuration(const char *rc, int overwrite)
35823597
fprintf(fp, "print_timestamps: enabled=%d\n", bx_dbg.print_timestamps);
35833598
bx_write_debugger_options(fp);
35843599
bx_write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_PORT_E9_HACK_ROOT), NULL, 0);
3600+
bx_write_param_list(fp, (bx_list_c*) SIM->get_param(BXPN_FW_CFG_ROOT), NULL, 0);
35853601
#if BX_SUPPORT_IODEBUG
35863602
fprintf(fp, "iodebug: all_rings=%d\n", SIM->get_param_bool(BXPN_IODEBUG_ALL_RINGS)->get());
35873603
#endif

bochs/cpu/cpu.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ bxICacheEntry_c* BX_CPU_C::getICacheEntry(void)
308308
bxInstruction_c *i = entry->i;
309309
if (i->getIaOpcode() != (long64_mode() ? BX_IA_ENDBRANCH64 : BX_IA_ENDBRANCH32) && i->getIaOpcode() != BX_IA_INT3) {
310310
if (LegacyEndbranchTreatment(CPL)) {
311-
BX_ERROR(("Endbranch is expected for CPL=%d", CPL));
311+
BX_ERROR(("#CP(ENDBRANCH): Endbranch is expected for CPL=%d", CPL));
312312
exception(BX_CP_EXCEPTION, BX_CP_ENDBRANCH);
313313
}
314314
}

bochs/cpu/paging.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2617,6 +2617,12 @@ bool BX_CPU_C::check_addr_in_tlb_buffers(const Bit8u *addr, const Bit8u *end)
26172617
}
26182618
#endif
26192619

2620+
if (((const bx_hostpageaddr_t)BX_CPU_THIS_PTR eipFetchPtr >= (const bx_hostpageaddr_t)addr) &&
2621+
((const bx_hostpageaddr_t)BX_CPU_THIS_PTR eipFetchPtr < (const bx_hostpageaddr_t)end)) return true;
2622+
2623+
if (((const bx_hostpageaddr_t)BX_CPU_THIS_PTR espHostPtr >= (const bx_hostpageaddr_t)addr) &&
2624+
((const bx_hostpageaddr_t)BX_CPU_THIS_PTR espHostPtr < (const bx_hostpageaddr_t)end)) return true;
2625+
26202626
for (unsigned tlb_entry_num=0; tlb_entry_num < BX_DTLB_SIZE; tlb_entry_num++) {
26212627
bx_TLB_entry *tlbEntry = &BX_CPU_THIS_PTR DTLB.entry[tlb_entry_num];
26222628
if (tlbEntry->valid()) {

bochs/doc/docbook/user/user.dbk

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3180,7 +3180,29 @@ Bochs must be set up to use system and VGA BIOS like this:
31803180
We recommend to use the ROM images distributed with Bochs or one of the latest
31813181
<ulink url="http://www.seabios.org/">SeaBIOS</ulink> images. BIOS images designed
31823182
for real hardware mostly do not work properly. Please see the <xref linkend="bochsopt-romimage">
3183-
for more information.
3183+
</para>
3184+
3185+
<para>
3186+
<emphasis>UEFI Firmware Support:</emphasis> Bochs supports UEFI boot using OVMF
3187+
(Open Virtual Machine Firmware) from the TianoCore EDK2 project. To use UEFI:
3188+
<screen>
3189+
romimage: file=OVMF.fd, address=0xffc00000
3190+
</screen>
3191+
UEFI boot requires the fw_cfg device which provides system configuration to the
3192+
firmware via I/O ports 0x510-0x51B. This includes the E820 memory map, ACPI tables,
3193+
RAM size, and CPU count. Enable it with:
3194+
<screen>
3195+
fw_cfg: enabled=1
3196+
</screen>
3197+
For best results with OVMF graphics output, configure VGA as a PCI device:
3198+
<screen>
3199+
pci: enabled=1, chipset=i440fx, slot1=pcivga
3200+
</screen>
3201+
The ACPI DSDT AML is built into Bochs and generated from the Bochs DSDT DSL
3202+
source using the ACPICA iasl compiler.
3203+
For developers, bochs/tools/gen_acpi_dsdt_aml.py can regenerate the embedded
3204+
AML header.
3205+
UEFI boot has been tested with Windows Server 2025 and modern Linux distributions.
31843206
</para>
31853207

31863208
<para>
@@ -3923,7 +3945,8 @@ PCI chipset. These options can be specified as comma-separated values.
39233945
By default, the "Bochs i440FX" chipset enables the ACPI and HPET devices, but
39243946
original i440FX doesn't support them. The options 'noacpi' and 'nohpet' make
39253947
it possible to disable them. The option 'noagp' disables the incomplete AGP
3926-
subsystem of the i440BX chipset.
3948+
subsystem of the i440BX chipset. If PCI is enabled, the 'nofloppy' option
3949+
disables the FDC if no floppy drive is configured.
39273950
</para>
39283951
</section>
39293952

0 commit comments

Comments
 (0)