Commit Graph

2935 Commits

Author SHA1 Message Date
Volker Ruppert
68ff4be0b8 Fixed a memory leak in the slirp code. 2023-11-24 22:35:43 +01:00
Volker Ruppert
a2f7562b30 Fixed two memory leaks in the Voodoo code. 2023-11-24 21:47:41 +01:00
Shwartsman
7f04cfd8df fix for gcc warning 2023-11-24 19:30:00 +02:00
Volker Ruppert
99629f9207 Horizontal pixel panning implemented in VGA graphics mode.
This change should fix issue #114.
Added BX_ERROR for two other unimplemented features.
2023-11-24 16:54:15 +01:00
Volker Ruppert
e9cd258882 Fixed ATAPI device reset.
Clearing 'seek complete' bit makes some MS-DOS work again.
2023-11-24 14:43:52 +01:00
Volker Ruppert
32b8edafc5 Fixed some gcc 13.2 warnings. 2023-11-23 20:06:07 +01:00
Benjamin David Lunt
eae6bf9396
Close cdrom image file on eject (#145)
The WIN32 configuration for the cdrom was not closing the image file on
eject. This left the handle open while Bochs was running, not allowing
the image file to be modified.
2023-11-23 08:40:39 +02:00
Shwartsman
f47ed2a5f7 fixed one more gcc warning 2023-11-21 16:12:53 +02:00
Shwartsman
d39c93a3c6 fixed 'misleading indentation' warning and also make statement more clear 2023-11-21 16:11:48 +02:00
Benjamin David Lunt
01a262306f
Improved and enhanced the floppy emulation (#135)
This improves and enhances the floppy emulation.
This adds the ability to specify a controller type.
This adds all but one, known, controller command.
This fixes the format command. Issue #123 
This fixes the error with older Windows guests.
2023-11-21 09:35:07 +02:00
Benjamin David Lunt
5683da27e8
reset status bar items at reset (#142)
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 https://github.com/bochs-emu/Bochs/issues/136
2023-11-21 08:58:21 +02:00
Volker Ruppert
eec7a55c46 Fixed another gcc 13.2 warning (overloaded virtual). 2023-11-16 19:47:59 +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
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
Stanislav Shwartsman
6655fa9a41 fix assertion I added in virt_timer.cc 2023-11-08 07:10:19 +02:00
Volker Ruppert
fcaccf0585 Fixed two format warnings. 2023-11-07 22:48:33 +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
Shwartsman
7290fb1231 simplify code in bx_virt_timer_c::timer_handler + add assert 2023-11-04 14:50:56 +02: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
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
Stanislav Shwartsman
8cc85b1133 fixed compilation warnings from CI/DI on github 2023-10-29 23:39:32 +02: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
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
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
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
2b873eb665 reapply PR #98 Hid register state fix 2023-10-17 15:10:28 +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
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
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
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
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
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
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
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
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
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