Commit Graph

12569 Commits

Author SHA1 Message Date
Volker Ruppert
6aa399e9eb Added x64 configuration for the VS2019 plugins workspace (fixes issue #8).
Since VS2019 didn't copy all settings from win32, manually editing all files
was necessary (adding OutDir/IntDir stuff).
2023-11-18 17:08:05 +01:00
Stanislav Shwartsman
a0334ef2b2 change some consts back to defines to simplify integration of code to support variable PA length (rest of the code still WIP) 2023-11-18 16:53:44 +02:00
Stanislav Shwartsman
86082838af added missing else which caused redundant memory access for 512-bit loads 2023-11-18 14:52:55 +02:00
Stanislav Shwartsman
054767ff8c enable MOVDIRI for TigerLake 2023-11-18 12:35:28 +02:00
Stanislav Shwartsman
a3fe8c2c8d introduce get_efer_allow_mask function to avoid placing that code directly in init.cc 2023-11-17 23:40:28 +02:00
Stanislav Shwartsman
9bda4eba28 introduce GET64_FROM_HI32_LO32 to form 64-bit integer from 2 32-bit 2023-11-17 23:31:38 +02:00
Stanislav Shwartsman
a9625e949d update crregs.h with all known XSAVE/XRESTOR state information
including not implemented state
2023-11-17 23:24:00 +02:00
Stanislav Shwartsman
0730ff4c4a added a comment for future: some memory operations must be done atomically
these are include LOCKed RMW of course and also a lot of others
in the future it will be very hard to find all the cases that must be atomic so better to start marking them already now
try to mark every RMW case for atomicity requirements
no code changes, only comments
2023-11-17 23:18:43 +02:00
Stanislav Shwartsman
1ad2ee6d4c use isReadOK instead of magic arithmetic for system_read_* methods
introduce system_write_qword as well
2023-11-17 23:14:38 +02:00
Stanislav Shwartsman
db17e4a4e2
Revert "reset status bar items at reset" (#137)
Reverts bochs-emu/Bochs#136
2023-11-17 09:37:46 +02:00
Benjamin David Lunt
c247b43718
reset status bar items at reset (#136)
When the user presses the "Reset" button on the gui ribbon, we need to
clear the active status of all statusbar items or they remain set after
the reset occurs.
This is mentioned in issue #123
2023-11-17 09:36:56 +02:00
Stanislav Shwartsman
447f18e53b Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-11-17 01:35:39 +02:00
Stanislav Shwartsman
01e744b507 bugfix for CET/XSAVE: XSAVE/XRESTOR wrongly determined if CTE.U is in XINIT state 2023-11-17 01:35:32 +02:00
Volker Ruppert
eec7a55c46 Fixed another gcc 13.2 warning (overloaded virtual). 2023-11-16 19:47:59 +01:00
Volker Ruppert
def53a2928 Fixed gui DLL name. 2023-11-15 23:33:27 +01:00
Stanislav Shwartsman
a9d07b5a51 coding style, move variables definition closer to its use, use constants instead of defines 2023-11-14 20:14:38 +02:00
Stanislav Shwartsman
baaaf1b9a7 update CHANGES 2023-11-14 19:31:37 +02:00
Stanislav Shwartsman
4941bb1f07 sync emulated time when linking traces 2023-11-14 19:26:56 +02:00
Stanislav Shwartsman
fde226f31c improve fix for VMCS_GUEST_PENDING_DBG_EXCEPTIONS saved on VMEXIT (should be cleared after most of VMEXITs)
handle some corner cases
2023-11-14 15:59:59 +02:00
Stanislav Shwartsman
60cc8020e8 Fixed VMCS_GUEST_PENDING_DBG_EXCEPTIONS saved on VMEXIT (should be cleared after most of VMEXITs) 2023-11-13 20:02:03 +02:00
Volker Ruppert
413507ee3a Trying to load a 'builtin' plugin twice must cause a BX_PANIC (same as plugin version). 2023-11-12 21:00:14 +01:00
Volker Ruppert
04941fd511 Added support for cross-compiling for win64 with plugins enabled. 2023-11-12 20:15:51 +01:00
Stanislav Shwartsman
b54b135d29 Updated plugins workspace after memory code changes 2023-11-12 20:30:07 +02:00
Stanislav Shwartsman
1401bd50e1 Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-11-12 20:28:26 +02:00
Stanislav Shwartsman
a9457e466c fixed compilation with debugger 2023-11-12 20:28:12 +02:00
Volker Ruppert
654f8796fb Updated standard workspace after memory code changes. 2023-11-12 17:37:03 +01:00
Shwartsman
cc6f8284ff Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-11-12 17:17:01 +02:00
Shwartsman
4f739d7e88 simplification: dbg_show_symbolic with no return value 2023-11-12 13:38:59 +02:00
Shwartsman
f8c94e83ff add missing SVM VMEXIT in case of triple fault shutdown 2023-11-12 13:38:16 +02:00
Volker Ruppert
aa8224b14e Added BX_PANIC in case no plugins are found to avoid segfault. 2023-11-12 00:09:42 +01:00
Stanislav Shwartsman
f5b54a4d33
Implemented MOVDIRI instruction (#129)
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-11-11 20:30:12 +02:00
Stanislav Shwartsman
620d091264 update CHANGES 2023-11-11 18:55:29 +02:00
Stanislav Shwartsman
f85c633d3d
preserve original VMCBPTR after SVM VMLOAD/VMSAVE instructions (#128)
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-11-11 17:52:10 +02:00
Stanislav Shwartsman
154896d923 Revert "fix code duplication"
This reverts commit 29c7a84c08.
2023-11-11 12:44:01 +02:00
Stanislav Shwartsman
29c7a84c08 fix code duplication 2023-11-11 12:19:27 +02:00
Stanislav Shwartsman
32cab8f384
introduce memory stub class which manages *only* RAM related logic of… (#127)
… the memory

it is very useful for CPU unit testing without devices or BIOS

Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-11-11 10:10:50 +02:00
Stanislav Shwartsman
1e92d9ee4e removed unused defines 2023-11-10 19:14:26 +02:00
Stanislav Shwartsman
db88c6c5bf fixed code duplication in debugger code 2023-11-10 19:10:51 +02:00
Stanislav Shwartsman
676da2e587 update CHANGES 2023-11-09 23:14:01 +02:00
Stanislav Shwartsman
913c8a0ac9 Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-11-09 19:15:42 +02:00
Stanislav Shwartsman
8594972389 final resolution for issue #2 : address VEXPAND* and VPSHUFBITQMB instructions 2023-11-09 19:15:32 +02:00
Benjamin David Lunt
a354d9aecc
fix ISO status change events (#125)
This allows you to change the CD-ROM via the Bochs Ribbon, as well as
properly "ejecting" a CD from the guest.
Before the CD path would change, but the guest (tested with WinXP and
DOS as guests) would not see the change.
This fix simulates an open tray and then a closed tray for all CD
changes.
2023-11-08 08:16:52 +02:00
Shwartsman
9f27681b54 fix compilation with CPU LEVEL<6 2023-11-08 07:15:39 +02:00
Stanislav Shwartsman
6655fa9a41 fix assertion I added in virt_timer.cc 2023-11-08 07:10:19 +02:00
Stanislav Shwartsman
b78e93c9e3 optimize handling of allowed_to_run_FPU_MMX instructios common block
now checked at decode and not at every instruction
simpler code and also 1% faster winXP boot time as bonus
other x87 and mmx heavy guests may benefit even more
2023-11-08 06:48:53 +02:00
Volker Ruppert
fcaccf0585 Fixed two format warnings. 2023-11-07 22:48:33 +01:00
Shwartsman
8f30812180 resolve github issue #57 + more clear variable name 2023-11-07 16:10:41 +02:00
Shwartsman
30d285b80f use common method to parse and dump memory params in .bochsrc 2023-11-07 15:40:20 +02:00
Volker Ruppert
75d076b990 Added modeless message box support for the wxWidgets port. 2023-11-05 19:05:24 +01:00
Shwartsman
5bb77620c3 coding style and #define cleanups
avoid using ull modifyer for consts, use BX_CONST64() instead
move definitions from header file to cpp file when possible
add 'const' modifyer for obviosly const methods and pointers
2023-11-05 15:37:39 +02:00
Volker Ruppert
83c71dd7a2 Renaming method fixes gcc 11 warning (overloaded virtual). 2023-11-05 11:01:41 +01:00
Stanislav Shwartsman
7469bcb69a
measure host stack depth during simulation to avoid excessive chainin… (#119)
…g depth

never allow beyong 64K stack
2023-11-05 07:08:36 +02:00
Volker Ruppert
f719dbe6d1 In case of failure restore_config() resets the restore flag. 2023-11-04 15:09:44 +01:00
Shwartsman
7290fb1231 simplify code in bx_virt_timer_c::timer_handler + add assert 2023-11-04 14:50:56 +02:00
Volker Ruppert
e896e71618 Fix for the fix: restore state from config interface works again (really fixes issue #37). 2023-11-03 23:58:40 +01:00
Volker Ruppert
ae31d06147 In restore mode load config earlier to make config interface selection work (fixes issue #37). 2023-11-03 18:19:38 +01:00
Volker Ruppert
2ea60efe00 Added x64 configuration to VS standard workspace (fixes issue #8 / TODO: plugins). 2023-11-03 14:38:34 +01:00
Volker Ruppert
77d7ee7d92 Updated MSVC plugins workspace (ZIP -> folder). 2023-11-01 17:18:34 +01:00
Volker Ruppert
7619ccb25d Fixed VS workspace files (TODO: plugins, WIN64 support). 2023-11-01 14:37:01 +01:00
Volker Ruppert
828da97aa5 Attempt to fix issue #40 using calculated size for 'first_sectors' buffer insted of hardcoded value. 2023-11-01 09:38:05 +01:00
Shwartsman
fb6dae6846 add block_size size param to saved .bochsrc 2023-10-31 15:36:46 +02:00
Benjamin David Lunt
586443f1ea
usb_ehci log fix (#116)
Simply change two BX_INFOs to BX_DEBUGs to keep from over populating the
log file.
2023-10-31 06:33:14 +02:00
Volker Ruppert
f4af2d4e24 Added modeless message box support for the x gui. 2023-10-30 21:27:37 +01:00
Stanislav Shwartsman
975c11fe09 fix canonical address calculation broken with LASS merge 2023-10-30 07:08:44 +02:00
Stanislav Shwartsman
18deee022f
make CPU to use C++ template for implementation of CPU methods (#115)
this allow to remove a lot of code from CPU common methods
2023-10-30 06:57:16 +02:00
Stanislav Shwartsman
2b439ea29e Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-10-29 23:39:46 +02:00
Stanislav Shwartsman
8cc85b1133 fixed compilation warnings from CI/DI on github 2023-10-29 23:39:32 +02:00
Volker Ruppert
cc16aea6fb Added modeless message box stub for textconfig. 2023-10-29 21:59:18 +01:00
Benjamin David Lunt
1519076597
Add Modeless MessageBox capabilities (#109)
As an example, when saving the state of an emulation, especially one
that has large image files and a large memory setting, there is a pause
between the time you choose a directory to save to, and the MessageBox
that states that the state was saved. During this time, there is no
indication that Bochs is doing anything. As far as the user is
concerned, Bochs froze.

So, this PR adds the capability to display a _Modeless_ message box. To
do so, at any point you need a message box shown, allowing other things
to continue to happen (SYNCHRONOUS), simply call the following line:
`void *hwnd = SIM->ml_message_box("Message Box Title", "Message Box
Text");`
Then after the task has been performed, remove the message box:
`SIM->ml_message_box_kill(hwnd);`

The function is implemented in all configurations via virtual calls,
however, the creation of the message box is currently only implemented
in the Win32 configuration. Other configurations will need this
implemented, though I do not have those configurations to test with,
except the text only config. I may get around to it :-).

This also currently only displays as the state is being saved. To
display when the state is being restored should now be a simple task by
adding the two lines shown above to the associated function.

The only drawback with this is that if the state is considerably small,
the save will take just a second or less. If so, this window will show
and then instantly be removed, possibly confusing the user. _What was
that!!_
2023-10-29 21:47:12 +01:00
Stanislav Shwartsman
96b887a9bb
code refactor towards fixing issue #2 (#112)
next step new methods for VEXPANDPS_MASK_VpsWpsR and
VEXPANDPD_MASK_VpdWpdR with mask and memory operand will be introduced
with fault suppression support
legacy load methods aren't good because the loads here actually read
POPCNT(mask) elements from memory src
2023-10-28 22:21:42 +03:00
Volker Ruppert
1a420ddf8b Added SB16 option again (removed by a previous commit 2023-10-28 17:43:15 +02:00
Shwartsman
325fb4bfe0 Change current directory before restoring from path bugfix 2023-10-28 11:35:49 +03:00
Benjamin David Lunt
ba9ed5d4d0
Add DIAG command and change to enum (#113)
This adds support for the UFI_SEND_DIAGNOSTIC command in USB_FLOPPY.CC
  and
This changes the list of defines to enum to match the current changes
made to recent files.
2023-10-27 08:24:41 +03:00
Benjamin David Lunt
5e87c5a8cf
add ehci and xchi parameters to suspend config (#111)
This changes the recent PR to use get_selected() instead of hard coding
the "uhci" and "ohci".
This also adds the xHCI options.
2023-10-23 17:01:45 +03:00
Stanislav Shwartsman
c48a50141b remove unused variable 2023-10-23 09:55:42 +03:00
Stanislav Shwartsman
78acf5ba76 Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-10-23 09:32:33 +03:00
Stanislav Shwartsman
9981f76ef9 correctly advance to next instruction for MONITOR with non-WB memory type 2023-10-23 09:32:25 +03:00
Benjamin David Lunt
b7f2aee9fd
write companion to save file (#110)
This fix adds the `companion=uhci\ohci` parameter to the saved config
file on suspend.
2023-10-23 07:53:22 +03:00
Stanislav Shwartsman
49a6d5bf0c coding style, initialize variables right before their use
remove redunant const in function params
2023-10-22 22:14:52 +03:00
Shwartsman
7568149dd8 fix compilation without EVEX 2023-10-22 15:58:28 +03:00
Shwartsman
f455fa87e4 update CHANGES with CD-ROM fix 2023-10-22 11:55:26 +03:00
Benjamin David Lunt
bfba29385f
A small fix and addition for a TEAC CD-ROM driver (#105)
This fixes the CD-ROM hardware by making sure the `drive_ready` flag is
zero after an `ATAPI_DEVICE_RESET` command. As far as I know, no other
Guest needed this fix except for the TEAC-CDI driver referred to below.

This also adds an assumption fix so that the TEAC_CDI driver will work.
The TEAC_CDI driver relies on the fact that the TEAC drive it is
designed for, sets the `interrupt reason` register (`sector count`
register) after the `ATAPI_IDENTIFY` command is issued. It uses this
`i_o` bit of this register to determine the direction of transfer for
the 0xA1 command, even though this is a read-only direction command.

Through other tests, I see no other Guests effected by this addition.

I also added a few minor syntax modifications, tab spacing, and
comments. The DEBUG out string will display the ATAPI command as well as
the 0xA0 command.
2023-10-22 11:52:53 +03:00
Shwartsman
ab1e94b13c convert define to enum
add const to some function methods
tab2space
2023-10-20 22:34:37 +03:00
Stanislav Shwartsman
873f62e298 update CHANGES 2023-10-20 21:03:04 +03:00
Benjamin David Lunt
0d1d6c671a
Ehci companion (#104)
This PR adds the ability to choose which companion controller the EHCI
uses.
`#usb_ehci: enabled=1, companion=uhci`
`#usb_ehci: enabled=1, companion=ohci`

UHCI is enabled by default:
`#usb_ehci: enabled=1`

This breaks up `usb_ohci.cc/h` into `usb_ohci.cc/h` and `ohci_core.cc/h`
to be like the existing `usb_uhci.cc/h` and `uhci_core.cc/h`.
This adds the ability to define a Port Routing string in the
`HcspPortRoute` register, and is optional via the `EHCI_PORT_ROUTE`
define.

Currently `EHCI_N_CC` and `EHCI_N_PCC` must remain as currently set (3
and 2 respectively), however with a little more work, I think these can
be modified and have up to 7 companion controllers with more ports per
companion, as long as the combined total is <= 15 total ports.

Please verify the `Makefile.in` changes. I do not use GCC and can not
verify it is correct.
2023-10-20 21:00:59 +03:00
Shwartsman
02c4f85a89 implemented proper masked load for VPMOVSX/ZX instructions + bugfix 2023-10-20 20:13:29 +03:00
Shwartsman
5103d97ece mask use of CUT_OPMASK_TO macro instead of magic arithmetic 2023-10-19 16:59:32 +03:00
Shwartsman
63286528b5 take axv512 masted read/write helpers to separate file 2023-10-19 16:52:55 +03:00
Stanislav Shwartsman
e0cc12471c
fixed issue #95 port_e9_hack (#101)
refactoring of port_e9_hack configuration options
do not allow port e9 access for all rings if port_e9_hack is not enabled

Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-10-18 08:19:33 +03:00
Shwartsman
2b873eb665 reapply PR #98 Hid register state fix 2023-10-17 15:10:28 +03:00
Shwartsman
f605dba487 remove duplicate option from configure scripts 2023-10-17 09:42:35 +03:00
Shwartsman
133144ae41 update include dependencies for CPU, MEMORY and BX_DBG folders 2023-10-16 19:42:44 +03:00
Shwartsman
d6c3ac641e fix compilation with mingw which has READLINE but doesn't have READLINE_HISTORY 2023-10-16 17:13:17 +03:00
Shwartsman
daa0e4506d add more features to configure scripts in repo (they are used for building release)
add SVM, EVEX, CET

reduce compilation dependencies
remove paramtree.h from bochs.h so many modules won't include it anymore

indentation fixes
2023-10-16 16:40:05 +03:00
Shwartsman
221cac7972 fixed compilation with no EVEX 2023-10-16 08:14:03 +03:00
Stanislav Shwartsman
a3d2fec111 Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-10-16 00:19:45 +03:00
Stanislav Shwartsman
035695f73c define CPU feature's enum together with feature name in one place 2023-10-15 23:56:11 +03:00
Stanislav Shwartsman
8e6bdcb4d9 define CPU feature's enum together with feature name in one place 2023-10-15 23:43:14 +03:00
Benjamin David Lunt
e7910a30a0
Xhci options (#92)
This adds a "hint" to the xHCI port configuration "option" entries,
hinting that the port number must or must not be super-speed.
2023-10-15 21:47:24 +03:00
Stanislav Shwartsman
8316d7698f
implemented Linear Address Separation extension (LASS) (#90)
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-10-15 14:32:01 +03:00
Benjamin David Lunt
b0dbbe884a
Misc uasp (#93)
Update the CHANGES file.
Syntax changes in uasp as requested a while back.
2023-10-15 10:26:43 +03:00
Stanislav Shwartsman
08d44208fc update and reorg CHANGES 2023-10-15 08:02:06 +03:00
Benjamin David Lunt
bcbe5da030
Usb compliance (#91)
Made all devices pass USB 2.0 Compliance on WinXP (old version of the
compliance test).
USB Hub still needs a little work to be in complete compliance.
Fixed potential bug in EHCI to UHCI hand-off.
Fixed compilation error with Floppy CB/CBI emulation.
Minor syntax fixes (tabulation, old irrelevant comments)
MSD serial numbers must be 12 chars.
Added to CHANGES file
2023-10-15 07:23:18 +03:00
Stanislav Shwartsman
ffa64461ab
implementation of AVX-NE-CONVERT ISA (#89)
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-10-14 14:55:12 +03:00
Stanislav Shwartsman
52d57a422c add VMEXIT reasons to enum, they not supported by Bochs but better to be listed for completion 2023-10-13 21:04:43 +03:00
Stanislav Shwartsman
9917227a56 enable CPUID reporting for recently added ISA extensions
more steps towards more generic CPUID code
2023-10-12 21:48:09 +03:00
Stanislav Shwartsman
dd7d4dbd82 implement SERIALIZE instruction
enable CPUID reporting for all recently added ISA extensions
2023-10-12 14:46:27 +03:00
Stanislav Shwartsman
4a309478f9
SHA512 instructions implemented (#88)
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-10-10 21:33:16 +03:00
Stanislav Shwartsman
3234e9b88e
implemented AVX VNNI INT16 ISA extension (#87)
Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-10-10 20:22:07 +03:00
Stanislav Shwartsman
32b3f65d34 update CHANGES 2023-10-10 20:06:48 +03:00
Stanislav Shwartsman
3a21782840 fix copy/paste induced bug in ROR64 2023-10-08 08:10:54 +03:00
Stanislav Shwartsman
44eea71f37
implemented SM3 instructions (#84)
add rol/ror methods to scalar_arith.h and use in more places

---------

Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2023-10-07 21:34:04 +03:00
Stanislav Shwartsman
841bc5a543 cleanup generic_cpuid.* 2023-10-07 18:24:47 +03:00
Stanislav Shwartsman
7e909a6fa5 rename CPUID flags to match leaf numbers 2023-10-07 18:10:20 +03:00
Stanislav Shwartsman
d4eea1d130 Remerge Fix OHCI Toggle function (#82)
This fixes the toggle bit check in the OHCI.
Tested Guests: WinXP, Win7
Tested devices: HID, HUB, DISK, CD-ROM
2023-10-07 10:15:18 +03:00
Shwartsman
6307786ded automatically determine MCE/MCA CPUID flags 2023-10-07 01:51:18 +03:00
Shwartsman
6d83b5239e another code duplication fix in CPUDB code 2023-10-07 01:36:05 +03:00
Shwartsman
20dfe7c7d0 improve comment 2023-10-07 01:09:22 +03:00
Shwartsman
672c93c7c4 reduce code duplication using new CPUID methods 2023-10-07 01:02:39 +03:00
Shwartsman
5fc6302b1b add one more CPUID method for future use + fix compilation after prev commit 2023-10-07 00:10:18 +03:00
Shwartsman
f50419429d Fix code duplication for CPUID ECX leaf 0x1, implement with common function for all CPUs 2023-10-06 22:53:30 +03:00
Shwartsman
c043d0ce0f initialize boolean with true/false instead of '0' or '1' 2023-10-01 13:23:53 +03:00
Benjamin David Lunt
7abed66ae5
Add minimal support for MMC command 0xAC (#80)
This changes a BX_INFO to a BX_DEBUG. It does not needed to be a
BX_INFO.

Second, this adds (very) minimal support for SCSI command 0xAC.
When emulating a .iso image via USB CD-ROM on Win10, without this
command, the emulation freezes when trying to access the CD-ROM. I don't
know if it is Bochs or Win10. I think Win10 expects the command to work,
or Bochs is not failing correctly.

This PR simply adds code to acknowledge the command and returns a zero
length report. This SCSI (MMC) specification states that a zero length
report is allowed.
The 8 byte header is returned, but the header indicates a zero byte
return: No report segments returned.
This seems to keep Win10 from freezing at USB CD-ROM device access time.

The code also BX_DEBUG's the command sent to the "controller", for
future use when adding the actual support of the command.
2023-09-26 07:55:29 +03:00
Benjamin David Lunt
74ed550334
Allow large VHD files (#79)
This PR allows larger VHD image files. The size in question doesn't
necessarily mean the size of the VHD file on disk. The size is the total
size of the image emulated. This total size is in question.

Without this patch, the total size allowed is 65535 * 16 * 255, or
roughly 32gig.
With this patch, the total size is calculated by who the creator of the
image is, what the CHS values are, and possibly a total size of up to a
limit of 2TB.

Since the original code was ported from QEMU, I ported an updated QEMU
code snippet.

https://gitlab.com/qemu-project/qemu/-/blob/master/block/vpc.c?ref_type=heads#L305

This PR now allows VHD image files with a total size emulated less than
or equal to 2TB.
2023-09-19 08:04:32 +03:00
Benjamin David Lunt
b46fc681d2
Improve default device detection (#77)
This improves the detection of the default speed of a device when given
in bochsrc.

It will first get the max speed of the port given. For example, uhci and
ohci will return FULL, ehci will return HIGH.
xHCI will return SUPER if the port is a super-speed port, else it will
return HIGH.

Then it will compare this with the max speed allowed for that device,
returning the highest common speed.

Of course, if the speed option is given, the above is overwritten by the
specified speed.

Both checks are still performed on the result.
1) does device allow the result speed?
2) does the controller allow the result speed?
2023-09-14 07:30:26 +03:00
Benjamin David Lunt
fae8e698c7
Usb common (#75)
This catches (possible) errors in the Bochrc file when declaring USB
port options.
The first catches when the user defines a port twice.  This will PANIC.
```
usb_ohci: port1=mouse, options1="speed:low, model:m228"
usb_ohci: port1=keyboard, options1="speed:low"
```
The second catches a possible error if the user copy/pastes a line and
forgets to update the options# part as in the example below.
```
usb_ohci: port1=tablet, options1="speed:low"
usb_ohci: port2=disk, options1="speed:full, path:hdd.img"
```
However, this will not PANIC since the following is completely legal:
```
usb_ohci: port2=disk
usb_ohci: options2="speed:full"
usb_ohci: options2="path:hdd.img"
```
This will simply display an error on the Bochs console window.
2023-09-09 07:46:43 +03:00
Benjamin David Lunt
b2a44e2284
Additional controller checks (#74)
This adds three additional checks to make sure the Guest is working
correctly.
- checks that the guest allocated the Scratchpad Area. If left zero
(NULL) the controller may access low memory.
- checks that the guest uses correct segment sizes in the interrupter
ring(s)
- checks the burst size value given to be within normal range

This also adds an internal register value for the HcCrcr (Command Ring
Control) register. Since this register reads zero by the Guest, we keep
an internal value so that the emulation can read the value, internally.
This is for features soon to be released.

Minor other syntax/comment changes (misspelled word, etc)

Checked with WinXP, Win7, and Win10
2023-09-08 08:44:56 +03:00
Benjamin David Lunt
43dd4164fe
Fix zero length packet handling (#73)
This fixes zero length packet handling.
See the following example that requests 128 bytes:

```
SETUP(8)
IN(64)
IN(64)
STATUS(0)
```

The current code erroneously assumes that there are no more IN packets
after the first two 64-byte packets.

However, what happens with the following:

```
SETUP(8)
IN(64)
IN(64)
IN(64)    <--- current code assumes this will be, and expects a STATUS packet
STATUS(0)
```

Currently, the third IN(64) above will result in a coding error because
the code is expecting the STATUS packet, not another IN packet.

The "controller" must allow for more packets than expected, returning a
short packet detect on the third IN(64) packet shown above, actually
returning zero bytes, hence the Short Packet Detect.

This patch was tested on WinXP, Win7, and Win10.
2023-09-07 08:04:10 +03:00
Benjamin David Lunt
0d48349a60
fixed bandwidth overage detection (#71)
The check for the amount of byte transferred in one frame time was done
before the update of the vertical pointer in the current Queue of the
last executed TD. Therefore, on the next frame time, the last executed
TD was being "executed" again. The check has now been moved to the top
of the loop.
2023-09-05 08:12:42 +03:00
Stanislav Shwartsman
fe53752ddf
rename USE_RAW_SERIAL -> BX_USE_RAW_SERIAL (#70) 2023-09-04 20:21:37 +03:00
Shwartsman
46f435e3f5 fixes for compilation without BX_LARGE_RAMFILE 2023-09-04 20:01:49 +03:00
Dreg
86eff7597d
add iodebug support for all rings complement #64 (#66)
This PR is for "I/O Interface to Bochs Debugger" from ring3 (port range:
**0x8A00 - 0x8A01**)

PR #64 was for E9 HACK (port **0xE9**)

By enabling the iodebug's 'all_rings' option, you can utilize the port
I/O Interface to Bochs Debugger from ring3. This PR allows the code
running inside Bochs (ring3) to monitor memory ranges, trace individual
instructions, and observe register values during execution.


https://bochs.sourceforge.io/doc/docbook/development/debugger-advanced.html

IMO very useful for:

- user-mode sandbox (ex Cuckoo)
- malware analysis
- API/SYSCALL hook/monitor from ring3
- automation + instrumentation from user mode code
...

A complement for PR #64

**This PR is 100% backward compatibility**

![IODEBUG ALL
RINGS](https://github.com/bochs-emu/Bochs/assets/9882181/6308ad0f-c189-43f3-a92b-dccde3542ad6)

btw, @stlintel I'm not certain about:
- if misc is the ideal location for this.. should I create a new
iodebug-option for this?
- should I remove the #if in 'new bx_param_bool_c'?
- the new .bochsrc entry makes sense for you?
2023-08-27 18:34:01 +02:00
Dreg
da43cc4580
add port e9 hack support for all rings (#64)
By enabling the 'all_rings' option, you can utilize the port e9 hack
from ring3

IMO very useful for:
- user-mode sandbox (ex Cuckoo)
- malware analysis
- API/SYSCALL logger with a simple hook from ring3
- automation + instrumentation from user mode code
- ...

So yes, from this PR a user-mode-sandbox can display on the console of
the system running Bochs anything that is written to 0xE9 port


![porte9hackallrings](https://github.com/bochs-emu/Bochs/assets/9882181/ddbca3fa-729b-4a3e-95ad-078e44c7a17a)

**This PR is 100% backward compatibility**

btw, @stlintel I'm not certain if **bochs/config.cc** is the ideal
location to define **bool port_e9_hack_all_rings** (unmapped io/dev is
better?)
2023-08-26 18:37:55 +03:00
Stanislav Shwartsman
253882589d extend cpuid enums with new bits announced in Intel SDM 2023-08-20 20:30:01 +03:00
Stanislav Shwartsman
1dcae848d7 change nullptr to NULL to help some old hosts not supporting C++ standard 2023-08-20 19:40:08 +03:00
Stanislav Shwartsman
6481d24e06 Another cleaner way to implemented fix by rei141
from Fixes in VM Entry Checks for Guest Segment Registers #51

Correction in checks for Code Segment (CS):
Previously, the DPL of CS was incorrectly compared with its own RPL.
According to Intel SDM, Vol. 3C, Chapter 27.3.1.2, for non-conforming code segments (type 9 or 11), the DPL of CS should be equal to the DPL of SS.
And for conforming code segments (type 13 or 15), the DPL of CS cannot be greater than the DPL of SS.

This way VMCS is not accessed multiple times which is important for some usages
2023-08-20 19:33:37 +03:00
Stanislav Shwartsman
58c047c6d6 Merge part of PR by rei141
Fixes in VM Entry Checks for Guest Segment Registers #51

Correction in Type range checks for DS, ES, FS, GS:
The original code erroneously applied the check for types less than 11, excluding types equal to 11.
This is not in accordance with Intel SDM, Vol. 3C, Chapter 27.3.1.2, which states that the check should include types equal to or less than 11.
This fix corrects this by including types equal to or less than 11 in the check.
2023-08-20 18:52:53 +03:00
Stanislav Shwartsman
4b7e61d985 add updated lex and yacc scripts 2023-08-20 18:35:19 +03:00
Dreg
244033e234
improvement of the magic breakpoints fix #55 (#58) 2023-08-20 18:21:16 +03:00
Stanislav Shwartsman
b7d4445d34
Merge pull request #52 from disba1ancer/gdbstub-x86-64-eip-patch
Fix for gdbstub with x86-64 that truncates instruction pointer while breakpoint check
2023-08-19 10:50:52 +03:00
Dreg
81b4bdba7b add symbol info to info idt on protected 32 2023-07-23 16:12:44 +02:00
disba1ancer
c11006ad51 Fixed instruction pointer truncation in gdbstub 2023-05-25 00:00:24 +03:00
Vort
ace4a4dfa9 Use correct directory separator in Windows builds 2023-04-16 12:22:45 +03:00
Benjamin David Lunt
8272ee3f6c
Include cstddef 2023-04-09 10:54:08 -07:00
Benjamin David Lunt
0985f9bfec
hid mouse improvements 2023-04-09 10:44:00 -07:00
Benjamin David Lunt
fd02efa536
hid mouse improvements 2023-04-09 10:43:18 -07:00
Shwartsman
bd51ec5f83 fixed SF #1456 Bochs does not handle NMI blocking correctly when running virtual machines 2023-04-08 08:36:28 +03:00
Stanislav Shwartsman
e2f4eff91a fixed compilation of instrumentation examples with debugger OFF 2023-04-06 22:18:01 +03:00
Stanislav Shwartsman
caf80c29bf Merge branch 'master' of https://github.com/bochs-emu/Bochs 2023-04-06 22:04:04 +03:00
Stanislav Shwartsman
c10268f5b5 fixed compilation warnings in usb code 2023-04-06 22:03:36 +03:00
Volker Ruppert
bee4b45ad7 usb_uasp is not a separate plugin device 2023-04-06 20:59:14 +02:00
Stanislav Shwartsman
8d35b84a61 fixed potentially non-initialized var warning 2023-04-06 21:37:22 +03:00
Volker Ruppert
545a73ad56 Fixed generation of user documentation 2023-04-06 20:20:20 +02:00
Stanislav Shwartsman
55e66d4d6f
Merge pull request #42 from fysnet/master
Updates to USBMSD/SCSI emulation
2023-04-01 10:44:27 +03:00
Benjamin David Lunt
b20ddc75ff
Updates to USBMSD/SCSI emulation 2023-03-31 19:05:59 -07:00
Benjamin David Lunt
45469a7929
Updates to USBMSD/SCSI emulation 2023-03-31 18:55:05 -07:00
Benjamin David Lunt
df257317f3
Updates to USBMSD/SCSI emulation 2023-03-31 18:35:28 -07:00
Benjamin David Lunt
0135a545c0
Updates to USBMSD/SCSI emulation 2023-03-31 18:33:38 -07:00
Benjamin David Lunt
3cf9aa2ace
Updates to USBMSD/SCSI emulation 2023-03-31 18:30:11 -07:00
Stanislav Shwartsman
8eee519f4e
Merge pull request #39 from fysnet/master
Add over-current signaling
2023-03-23 07:22:46 +02:00
Benjamin David Lunt
64bb47b283
Add over-current signaling
This adds over-current signaling to the USBs four host controllers.
To signal an OC, use the runtime configuration and set the checkbox (GUI) or text config's parameter to 1.
This pull request also adds USB documentation to user.dbk.
2023-03-22 16:13:25 -07:00
Benjamin David Lunt
a0e4106f4a
Add over-current signaling
This adds over-current signaling to the USBs four host controllers.
To signal an OC, use the runtime configuration and set the checkbox (GUI) or text config's parameter to 1.
This pull request also adds USB documentation to user.dbk.
2023-03-22 16:12:08 -07:00
Benjamin David Lunt
dacc965593
Add over-current signaling
This adds over-current signaling to the USBs four host controllers.
To signal an OC, use the runtime configuration and set the checkbox (GUI) or text config's parameter to 1.
This pull request also adds USB documentation to user.dbk.
2023-03-22 16:05:44 -07:00
Stanislav Shwartsman
45ed74dc1b
Merge pull request #38 from fysnet/master
Forgot to add SPD action to UHCI
2023-03-22 06:54:26 +02:00
Benjamin David Lunt
d01e0f6cf8
Forgot to add SPD action to UHCI 2023-03-21 18:40:11 -07:00
Stanislav Shwartsman
5b45a2e985
Merge pull request #36 from fysnet/master
Fix issue #25
2023-03-18 07:44:19 +02:00
Benjamin David Lunt
64009cb067
Fix issue #25
The 'd.pcap_image_t pcapture' in usb_common.h called its constructor and set 'fd' to -1. However, in the usb_device_c() constructor, we then cleared all of 'd', resetting pcapture.fd back to zero. Then on Bochs exit, the pcap_image_t destructor tried to close the file since 'fd' was zero instead of -1. To fix this, I removed the pcap_image_t constructor and now call pcap_image_init() within the usb_device_c constructor.
2023-03-17 17:30:10 -07:00
Stanislav Shwartsman
a34bc01592
Merge pull request #35 from fysnet/master
USB emulation update
2023-03-13 16:07:47 +02:00
Benjamin David Lunt
6a0e7a5306
Allow a usb port number to be more than one digit
Also fixed an error with xhci and the save/restore Bochs environment
2023-03-12 16:40:02 -07:00
Benjamin David Lunt
8ef4dcc7d1
Allow a usb port number to be more than one digit 2023-03-12 16:36:22 -07:00
Benjamin David Lunt
280fbf1929
Added info about the USB disk/cdrom options 2023-03-12 14:58:12 -07:00
Benjamin David Lunt
3c6a97c676
add dependencies 2023-03-11 17:37:27 -07:00
Benjamin David Lunt
7e046f5a27
indentation corrections 2023-03-11 17:28:59 -07:00
Benjamin David Lunt
418ef4e1ca
USB emulation update
add usb_uasp to the build
2023-03-10 12:56:32 -07:00
Benjamin David Lunt
9075864647
USB emulation update
change to 'public'
2023-03-10 12:30:03 -07:00
Benjamin David Lunt
5b6ed6274b
USB emulation update
Add protected declaration
2023-03-10 12:22:13 -07:00
Benjamin David Lunt
884d4c272e
USB emulation update
fix two comments
2023-03-10 11:56:12 -07:00
Benjamin David Lunt
7041926aac
USB emulation update
Added examples for new options.
 - xhci: model= option
 - xhci: allow the user to select number of ports
 - usb disk: proto= option (bbb or uasp)
Added xhci primary stream support.
 (Secondary stream support is not included)
Added (experimental) usb disk protocol UASP for super- and high-speed usb disk devices.
  (high-speed uasp support is not thoroughly tested)
xhci: fixed "change event" function
scsi: fixed bug in command 0x25
scsi: added command 9E/10
2023-03-10 11:37:08 -07:00
Benjamin David Lunt
86b50988be
USB emulation update
Added examples for new options.
xhci: model= option
usb disk: proto= option
2023-03-10 11:29:06 -07:00
Benjamin David Lunt
8a1f8cf545
USB emulation update
Added examples for new options.
xhci: model= option
usb disk: proto= option
2023-03-10 11:27:12 -07:00
Stanislav Shwartsman
43f18a1e2e
Merge pull request #34 from fysnet/master
minor error in validation of slot and ep fixed
2023-02-25 19:49:23 +02:00
Benjamin David Lunt
8078e5f85f
removed unprintable characters 2023-02-25 08:15:17 -07:00
Benjamin David Lunt
db49706bbd
minor error in validation of slot and ep fixed 2023-02-24 17:19:11 -07:00
Stanislav Shwartsman
9edcaf8697
Merge pull request #32 from julienfreche/jfreche/cpudb_string_size
cpudb: extend strings that are too small
2023-02-23 06:38:29 +02:00
Julien Freche
29f3e4a455 cpudb: extend strings that are too small 2023-02-22 12:03:02 -08:00
Stanislav Shwartsman
a11b4e1c20
Merge pull request #31 from fysnet/master
Minor:

Check speed indicator in the Transfer Descriptor matching the device speed.
Max packet size check, checking that the amount requested/sent is within limits.
Checking that the first packet sent is the GetDescriptor Request with a length equal to or less than the max packet size.
Checking the command length in the USB SCSI emulation.
Checking command parameters within various emulations (SCSI (BBB), etc.)
Implemented "Boot Protocol" for the (HID) Mouse emulation.
Fixed wheel mouse HID report (along with the other HID reports)
Added the Over Current bits to the UHCI code
Added the monitoring of the toggle bit in the TDs

Major:

Re-wrote the UHCI stack processing so that control and bulk reclamation can be used.
(This made it so Windows 7 now works)
Adding function to the USB SCSI emulation.
Enhanced the xHCI emulation to further check for errors in a driver.
2023-02-20 20:34:00 +02:00
Benjamin David Lunt
a098f5f153
Use defines instead of bits 2023-02-18 12:36:25 -07:00
Benjamin David Lunt
497683a2d0
Win32: Make panic dialog a little wider
This makes the Win32 Panic Dialog a little wider so the error string isn't truncated
2023-02-18 12:29:45 -07:00
Benjamin David Lunt
71694e34cd
Error fix for compiler 2023-02-16 17:58:06 -07:00
Benjamin David Lunt
996d081d4c
Minor fix for compiler error 2023-02-16 17:52:29 -07:00
Benjamin David Lunt
a4492a9179
USB Enhancement (minor addition) 2023-02-16 17:38:41 -07:00
Benjamin David Lunt
a996807435
Enhanced the USB emulation
The enhancements include fixes and error checks targeting hobbyists who are writing USB drivers.
2023-02-16 17:24:13 -07:00
ImWuX
a83e275382
forgot to update header :D 2023-02-16 14:17:24 +02:00
ImWuX
9d65d5e261
patched an issue with the HPET where writing an u64 with HPET_TN_SETVAL set, would only write the lower 32bits into the comparator. 2023-02-16 14:11:43 +02:00
Benjamin David Lunt
cc6ac48d6c
Wider statusbar elements
With newer wider screens, we can now have wider statusbar elements so that an element such as "USB-HD" isn't clipped on both sides.
2023-02-10 21:17:21 -07:00
Benjamin David Lunt
5d81785db6
Add SCSI_CD_EVENT_STATUS 2023-02-01 16:51:16 -07:00
Florian Weimer
10c5ff3f82 configure: Improve compatibility with strict(er) C99 compilers
C99 removed implicit function declarations from the language.  All
functions must be declared before they can be called.  There are a
few places in the configure script where the exit function is called
without including <stdlib.h>.  Instead, return from the main
function, avoiding the exit declaration issue.
2022-11-27 23:12:58 +01:00
quirck
bee4cefb9e Check breakpoints before icount guard 2022-11-13 22:24:37 +03:00
Satoshi Tanda
d773b5b0a7 Fix windows build 2022-10-30 14:48:57 -07:00
Anders
f4dfeb260e
Register Windows silent uninstall command
Added silent uninstall command for use by WinGet and other packaging tools.

I also made the strings non-expandable because $InstDir will never contain %ProgramFiles% etc.
2022-10-12 04:07:42 +02:00