Commit Graph

3120 Commits

Author SHA1 Message Date
Volker Ruppert
63ab5ea24a Align SB16 DMA buffer size to 4 to avoid crash in 16-bit stereo mode. 2023-12-29 19:49:58 +01:00
Volker Ruppert
be1baa295c Implemented secondary VGA charmap support.
All guis with 'new_text_api' and the graphical text snapshot working with it.
2023-12-29 17:47:44 +01:00
Volker Ruppert
a1872535ca Voodoo: fixed randomly missing color palette updates. 2023-12-29 15:18:06 +01:00
Volker Ruppert
157d3a9189 Next attempt to fix the Voodoo hang on exit.
It occurred with the pthreads library only and should be fixed now.
2023-12-29 10:25:38 +01:00
Volker Ruppert
29fbdb48da Set default value for SB16 dmatimer to 1000000 and updated docs. 2023-12-28 20:32:14 +01:00
Volker Ruppert
917ac4c79d Fixed some Voodoo issues.
Temporarily disable fifo_reset() in recompute_video_memory(). FIFO handling must
be observed and a better solution must be found.
Fixed hang after pressing power button: destructor modification was required since
the swapbuffer command can depend on vertical retrace.
2023-12-28 19:04:20 +01:00
Volker Ruppert
9d1df2915c VGA mem_write(): added missing update flag in chain4 mode. 2023-12-27 23:24:46 +01:00
Volker Ruppert
aa23a09afd VGA mem_write(): moved and fixed CGA specific code.
Removed disabled BX_DEBUG code and VGA_TRACE_FEATURE symbol.
Some other small fixes and cleanups.
TODO #1: review MAP13 addressing in case start address > 0.
TODO #2: review chain4 code in medm_write().
2023-12-26 11:16:59 +01:00
Volker Ruppert
de4876e2c4 VGA mem_write(): in text mode don't mark graphics tiles for update.
TODO: Check special cases code in mem_write() for correctness.
2023-12-25 21:03:53 +01:00
Vort
aed0c5e954
Prevent output of fraction of sample (#193)
Fixes #134.
2023-12-25 12:00:31 +02:00
Volker Ruppert
8a4941f670 Some cleanups in the recently fixed code. 2023-12-24 14:41:47 +01:00
Volker Ruppert
e3eb603ad4 Some fixes for the VGA mode 0x13 (issue #188 and discussion #108).
- Shift start address by 2 in update() code and mem_write().
- Added split screen support for this mode.
- Some code cleanups.
2023-12-23 21:37:08 +01:00
Volker Ruppert
b63b1225a8 Fixed backward screen-to-screen copy operation for > 8 bpp modes. 2023-12-21 10:53:13 +01:00
Vort
75ea1c2222
Prevent crash in get_retrace (#185)
Fixes #184.
2023-12-20 13:35:51 +02:00
Vort
ee528baa03
Expand maximum resolution for Banshee and Voodoo 3 from 1600x1280 to 1920x1440 (#175)
Fixes #174.
2023-12-16 16:51:18 +02:00
Shwartsman
cd350d8548 adopting hack listed in https://github.com/bochs-emu/Bochs/issues/147 to solve hang 2023-12-16 08:45:53 +02:00
Vort
02704120a3
Implement Voodoo 3 writes with length 8 (#173)
Fixes #172

Co-authored-by: Stanislav Shwartsman <stlintel@gmail.com>
2023-12-16 08:28:59 +02:00
Shwartsman
0fbf559276 fix bx_banshee_c::mem_read unknown access length warning 2023-12-16 08:24:08 +02:00
Shwartsman
e67fb33443 fix potentially un-initialized value warning 2023-12-15 22:49:34 +02:00
Shwartsman
438fd787c3 attempt to warn (BX_ERROR) for unsupported read/write size 2023-12-15 22:31:49 +02:00
Vort
30db11d271
Fix memory corruption when reading Voodoo ROM (#169)
Fixes #131.
2023-12-15 22:24:57 +02:00
Volker Ruppert
5fec28cb17 Partly fixed display errors found in game Prehistorik 2 (issue #166).
- Fixes in MAP13 disabled mode (VGA mode 6): half dot clock, color support
- Modified method get_vga_pixel(): now using row start address as an argument
2023-12-13 17:15:09 +01:00
Volker Ruppert
7641d13614 E1000: Added support for i/o mapped register access to make DOS driver work. 2023-12-11 21:21:34 +01:00
Volker Ruppert
54aeba83d3 Moved CMOS image runtime options setup to cmos.cc. 2023-12-05 18:16:24 +01:00
Volker Ruppert
7fcf4a419a Added support for saving CMOS image at runtime.
- Added CMOS image options to runtime menu (except RTC init).
- Fixed default size of Bochs CMOS RAM (s.max_reg).
- Fixed bochsrc parse to make 'rtc_init' parameter work.
- In textconfig now using SERIES_ASK for CMOS image options.
2023-12-04 20:39:24 +01:00
Volker Ruppert
c8b370d206 Added split screen support to the 256-color VGA mode called "modeX". 2023-12-03 19:42:05 +01:00
Volker Ruppert
7f420fc260 Added modeless message box in the restore code and some related fixes.
- Show message box while restoring hardware state.
- Set modeless message box handle to NULL after destroying it.
- Reset all config options to default before restoring config.
- Fixed CMOS RTC value after restore if in 12-hour-mode.
- Fixed possible segfault in the plugins code caused by Voodoo plugin in VGA mode
  (found at restore code testing).
2023-12-03 12:34:03 +01:00
Stanislav Shwartsman
fcea81a042 fixed compilation in cmos.cc 2023-12-02 08:43:56 +02:00
Stanislav Shwartsman
ffc722f4e8
Porting #SF patch #565 Real Time Clock /CMOS fix (#4)
by Michele Giacomone

Detailed description:

  -Observed issues

   Due to some limitations only dates between 1980 and 2038 can be
   used in a reliable way.
   Also, bochs incorrectly assumes a linear correspondence between
   the data returned by the <time.h> functions localtime() and
   mktime(), and isn't setting the latter properly.
   Bochs keeps its internal time value dependent to these functions
   after setup, assuming that their internal settings won't change
   on the go - which is not the case.
   In my OS, and in my timezone, this leads to incorrect startup values
   for 5 months each year and unreliable values if the simulation is
   kept going for a long time. (a feedback between localtime() and
   mktime() is created which keeps shifting back the time)
   Also, the RTC simulation is not realistic since the clock fixes
   itself across DST changes, without updating any DST related flag,
   a behavior that no guest OS expects.

  -Proposed fix

   This is implemented in such way that no bochs' previous behavior
   is changed, a part from the broken ones, with legacy in mind
   == the user can keep using bochs exactly as before knowing nothing
      of this patch

   +Make the internal s.timeval variable a Bit64s, so it can fit all
    values that the cmos can correctly represent, reported below:
    MIN     setting  -62167219200 =>  0000/01/01 SAT  0:00:00
    MAX BCD setting  253402300799 =>  9999/12/31 FRI 23:59:59
    MAX BIN setting  745690751999 => 25599/12/31 FRI 23:59:59
    And then fix each reference to these so it can handle such values
    And make bochs correctly wrap around for under/overflows, so that
    only the most significant bits of the century are lost.

   +Do the same thing to the bochs time0 parameter, so all the above
    values can be chosen at startup (despite being now legal values,
    1 and 2 will still be treated as "local" and "utc"). Note that
    normally only BCD settings are valid since bochs' CMOS defaults
    to such operating mode - the only way to use the binary range
    is by loading a cmos memory map.

   +Make the internal s.timeval variable independent from external
    factors. This means providing a small set of time handling
    functions, contained in "iodev/utctime.h", which must work in
    any environment in which bochs compiles, accessing no external
    resource. This also means that after startup, s.timeval will only
    be changed internally, and no call to the OS time functions will
    be made.

   +Make the internal s.timeval variable timezone independent, to
    have a linear correlation between its values and valid CMOS
    settings. To make it easier, s.timeval is gonna be treated as
    if the current timezone was UTC: so,
     - if the user selects UTC as time0, s.timeval will become current
       time(NULL)
     - if the user selects localtime, s.timeval will be computed as
       the value which will display the same broken down time as
       localtime(&now)
     - if the user inputs a time formatted string the proper s.timeval
       to displayed will be easily calculated,
     - if the user inputs a starting time value, s.timeval will be
       computed as the value which will display the same broken down
       time as localtime(&user_input) to ensure the same operation as
       before.
    A "tz=utc" is displayed when bochs prints out the current time
    value, to warn users about the difference in meaning between the
    internally kept time value and the value they can set through
    the "time0=" parameter. This might be changed to communicate
    instead the time value they can input to get the same setting,
    but performing such calculation (except for the startup time)
    suffers from all the mktime()/localtime() problems listed above
    so I did not do it.
    The range of "time0" is automatically adjusted so all users in
    all time zones can set any legal value despite "time0=" having a
    local meaning.

  A thorough explanation of what I did and why can be found in the
  "iodev/utctime.h" library header.

---------

Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
Co-authored-by: Volker Ruppert <Volker.Ruppert@t-online.de>
2023-12-01 22:55:35 +01:00
Shwartsman
4de6c097a4 use true/false instead of 0/1 for boolean variables
cleanups in code
2023-12-01 23:01:11 +02:00
Stanislav Shwartsman
9a5dfb10c1 fixed 'misleading indentation' warning
move variable definitions closer to their use
2023-11-27 19:05:12 +02:00
Volker Ruppert
b319a6cb5d Some more memory leak fixes.
- delete SIM object
- delete i/o port to handler tables
- free plugin tables for enum parameters
2023-11-26 15:44:38 +01:00
Volker Ruppert
ae107f2cb8 Some more memory leak fixes.
- added method for logfunctions cleanup on app exit
- delete default i/o handler names
- delete pluginlog
2023-11-26 13:41:19 +01:00
Volker Ruppert
d63e048ec6 Memleak fix: IRQ handler names were not deleted on simulation exit. 2023-11-26 10:43:15 +01:00
Volker Ruppert
c525d9e5fc Consider half dot clock for h-panning (final fix for issue #114). 2023-11-24 23:08:17 +01:00
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
Benjamin David Lunt
0135a545c0
Updates to USBMSD/SCSI emulation 2023-03-31 18:33:38 -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
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
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
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
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
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
5d81785db6
Add SCSI_CD_EVENT_STATUS 2023-02-01 16:51:16 -07:00
Volker Ruppert
5ebe6b46d0 Removed useless BX_DEBUG messages in devices init 2022-08-29 18:14:59 +02:00
Stanislav Shwartsman
1e4f1624c8 remove trailing whitespace from source files 2022-08-23 21:46:04 +03:00
Stanislav Shwartsman
4d227d15fb remove instrument.h from bochs.h so it won't be included everywhere
include it only where required
move PHY_ADDRESS reserved bits consts to cpu.h
2022-07-30 22:35:43 +03:00
Stanislav Shwartsman
3f65841714
use boolean constants true/false instead of 0/1 (#26)
* use boolean constants true/false instead of 0/1

* fix code comment

Co-authored-by: Stanislav Shwartsman <sshwarts@users.sourceforge.net>
2022-07-30 18:38:22 +03:00
Volker Ruppert
1408de3ad2 Fixed and improved PCI slot config error handling. 2021-10-14 17:59:08 +00:00
Volker Ruppert
52b0000db7 Applied two patches from Debian.
- Apply standard flags from environment everywhere (SF patch #546).
- Allow overriding ld and objcopy for building bios on non-x86 platforms.
2021-09-10 15:33:22 +00:00
Volker Ruppert
412285baed Fixed compilation for big endian architectures (SF patch #563). 2021-08-24 19:06:01 +00:00
Volker Ruppert
a1058990ba Trailing '../\' breaks compilation with MSVC nmake. Regenerated dependencies. 2021-07-27 18:13:26 +00:00
Stanislav Shwartsman
021f3794fa remove cpudb.h from some Makefile dependencies. TODO: it should be only in cpu/init.cc and config.cc 2021-07-25 18:08:54 +00:00
Stanislav Shwartsman
2cb9bb4e44 remove cpudb.h from some Makefile dependencies. TODO: it should be only in cpu/init.cc and config.cc 2021-07-25 18:06:31 +00:00
Volker Ruppert
6b08329fa2 Voodoo 1/2: Always reset 'swaps_pending' counter when switching to Voodoo mode.
This fixes a possible deadlock in accelerated Direct3D test.
2021-07-18 07:25:08 +00:00
Volker Ruppert
e34d017f60 Some fixes for compiling for WIN64 with MSVC.
- Added check in config.h whether or not Bochs is configured and compiled for
  the same target platform (WIN32 / WIN64).
- Fixed some warnings that occur in the MSVC WIN64 case.
2021-07-12 19:05:25 +00:00
Volker Ruppert
7c8b1c5f28 Some small changes in the Voodoo Banshee code.
- Report some more unimplemented bits of the vidProcCfg register.
- Code cleanup in some bitblt methods.
2021-07-08 14:43:18 +00:00
Volker Ruppert
a38f0fdb02 The 2D destination x/y positions are signed values. Modified code to handle
negative values properly.
2021-07-07 06:54:30 +00:00
Volker Ruppert
44288f603d Fixed and cleaned up pattern fill methods. 2021-07-06 12:09:38 +00:00
Volker Ruppert
e17539861c Fixed and simplified setup of source and destination pitch. 2021-07-06 09:08:12 +00:00
Volker Ruppert
4bf3b23983 Added support for drawing polygon with pattern. 2021-07-06 06:40:53 +00:00
Volker Ruppert
0262b100a5 Some Banshee bitblt fixes.
- Fixed screen-to-screen code in the right-to-left case.
- Some pattern handling fixes (pattern origin is always destination x0, y0).
2021-07-05 10:30:04 +00:00
Volker Ruppert
8de6206ab6 Some Banshee bitblt clip code changes.
- Fixed screen-to-screen stretch code using new clip check.
- Simplified line / polygon drawing code using new clip check.
2021-07-04 15:06:50 +00:00
Volker Ruppert
fe9198b5a7 Fixed clipping related issues in host-to-screen methods.
- Added simple clip check method to be called for each destination x / y change.
- Use the new clip check in both host-to-screen methods.
- Some related changes.
- TODO: verify other bitblt methods for clipping correctness.
2021-07-04 08:17:55 +00:00
Volker Ruppert
e0cc76af53 Some changes in the Voodoo Banshee code.
- Calculate host-to-screen data size for "source stride packing" in color mode
  similar to the monochrome mode.
- Set up data swizzle mode for all launch area operations.
- Temporarily draw polygon in normal mode in case the currently unsupported
  pattern mode is selected.
- TODO #1: Rewrite of the clipping code at least for host-to-screen functions.
- TODO #2: Drawing polygon with pattern if requested.
2021-07-03 20:54:38 +00:00
Volker Ruppert
3062a14ef4 The i440BX chipset now reports 66 MHz DRAM clock. 2021-07-03 08:33:09 +00:00
Volker Ruppert
69c4758fbb New attempt to fix the Banshee bitblt issues in host-to-screen mode with
monochrome source and "source stride" packing. Now adding the source stride
converted to pixels to the 5-bit srcX value.
TODO #1: color source needs to be handled in a similar way (no test case yet).
TODO #2: clipping needs to be rewritten at least for host-to-screen blts.
2021-07-02 17:29:22 +00:00
Volker Ruppert
a23db5e82a Small changes in the Voodoo Banshee code.
- Redirect byte and word writes into CMDFIFO space to LFB (FIXME).
- Added stub for the CMDFIFO code #6 (AGP-to-VRAM transfer).
2021-07-01 19:32:28 +00:00
Volker Ruppert
7e75d3d66b Two fixes in the USB code.
- Fixed possible segfault in the EHCI code.
- Fixed and improved backward compatibility code for USB port options.
2021-06-30 15:50:49 +00:00
Volker Ruppert
28b506f2de Small changes in the Voodoo Banshee code.
- Added support for byte and word access to Banshee i/o space.
- Added stub for the CMDFIFO command JMP AGP.
2021-06-30 07:41:21 +00:00
Volker Ruppert
caf52aacac Added advanced PCI option 'noagp' for the i440BX chipset.
Since AGP support is incomplete, it may be useful to disable this subsystem.
2021-06-27 14:50:26 +00:00
Volker Ruppert
d9dd62e42f Improved conversion of old-style USB device options to new format. 2021-06-24 19:45:20 +00:00
Volker Ruppert
3d852a208e Added 'vtimer_running' flag to save/restore list (fixes display flickering
after restore Banshee in 3D mode).
2021-06-22 17:03:05 +00:00
Volker Ruppert
821b42f309 Fixed some MSVC warnings when compiling for WIN64. 2021-06-20 07:30:29 +00:00
Volker Ruppert
56fb9cacc2 Fixed "extended address wrap" mode: setting "plane shift" value not correct in
"chain4" mode (fixes DOS Doom in Win95).
2021-06-18 23:00:40 +00:00
Volker Ruppert
e1265b7536 Fixed special rule for the backward compatible device type selection of card #0.
If at least one ne2k device is assigned to a PCI slot, card #0 defaults to PCI
type, unless type is set up in ne2k line.
2021-06-17 21:04:35 +00:00
Volker Ruppert
277830ca07 Cleaned up method determine_screen_dimensions(): no special cases handling needed. 2021-06-08 19:06:22 +00:00
Volker Ruppert
ad3090ab1a Some small fixes found with original Cirrus VGABIOS at VBE mode testing.
- Setting up bank #0 modifies the external offset for VRAM access in VGA core.
- Added support for interlaced VGA modes.
2021-06-04 12:14:45 +00:00
Volker Ruppert
733e466628 Split the VBE bank into separate read and write apertures. The compatibility
mode sets both banks to the same value. Reading VBE bank register always
returns the write aperture setting. This feature is designed for the scrolling
function of the VBE 'write character' support. VBE code should use compatibility
mode for now.
TODO: update VGABIOS to use this feature.
2021-05-30 16:13:37 +00:00
Volker Ruppert
c78c1a9af9 Enable preferred timing mode as expected by EDID format version 1.3. 2021-05-30 07:28:53 +00:00
Volker Ruppert
8cbf4eff8e Some changes for the Bochs VBE 32k bank granularity feature.
- VBE enable register returns 32k granularity flag if enabled.
- VBE bank register returns 32k granularity flag if VBE_DISPI_GETCAPS is set.
- Defining new DISPI ID not necessary.
- TODO: update VGABIOS to use this feature.
2021-05-23 06:30:51 +00:00
Volker Ruppert
43033b2137 Some changes for the Bochs VBE support.
- Limit VBE bank size to 64k as expected.
- Enabling VBE mode now clears the whole video memory for all bpp modes unless
  "noclear" bit is set.
- Prepared 32k bank granularity mode required for text output functions. Added
  new VBE_DISPI_ID6 to indicate this capability. The default is still 64k.
2021-05-21 20:49:34 +00:00
Volker Ruppert
57ad842568 Some small Cirrus changes.
- Save/restore: fixed number of registers per controller.
- Report interlaced mode on mode switch.
- Added BX_DEBUG message for MCLK setting (unused).
2021-05-16 07:40:46 +00:00
Volker Ruppert
128e54a137 Some small Cirrus Video clock changes.
- Fixed reset values for VCLK and related sequencer registers.
- Added BX_ERROR for unimplemented feature (using MCLK as VCLK).
2021-05-15 16:15:59 +00:00
Volker Ruppert
aa9045b63f Set EDID checksum in constructor. 2021-05-13 17:58:57 +00:00
Volker Ruppert
95dc1b2012 Skip display update if a mode update is in progress. 2021-05-11 15:00:58 +00:00
Volker Ruppert
4db9f76819 Added port 0xE9 hack switch to runtime options. 2021-05-11 14:42:31 +00:00
Volker Ruppert
77cc12cce5 Added support for reading VGA latches using CRTC register 0x22 (undocumented
for original VGA, documented for Cirrus and Voodoo Banshee).
2021-04-23 06:42:52 +00:00
Volker Ruppert
adf209fe9e Fixed some issues reported by valgrind. 2021-04-18 17:20:41 +00:00
Volker Ruppert
b19a7b1042 Added USB packet logging support in PCAP format (patch #560 by Ben Lunt).
- Added new files with small changes, output can be viewed with Wireshark.
- FIXME: Windows ports crash with original Win98 guest and USB disk connected.
- TODO: mention new feature in documentation.
2021-04-17 18:57:05 +00:00
Volker Ruppert
719592e2f3 Fixed device connect failure handling in all HCs (reset port parameters).
The old code has blocked the port after failure.
2021-04-17 17:48:42 +00:00
Volker Ruppert
30e24fa3d5 Prepared USB packet logging support in PCAP format (patch #560 by Ben Lunt).
- DONE: config option handling, usb_dump_packet() changes
- TODO: add new file after compiling and testing new code on Windows
2021-04-17 09:30:58 +00:00
Volker Ruppert
6d5897217c Added missing PEL mask support in the VGA core. 2021-04-17 08:42:03 +00:00
Volker Ruppert
049826aa32 Fixed possible segfault in case of invalid filename based on patch #559.
Since this save/restore list exists in all devices, it's safe to move the new
code to the usb_device_c destructor.
2021-04-13 11:56:41 +00:00
Volker Ruppert
69695bfd67 Prepared the Banshee code for the planned LGPL'd VGABIOS with 3dfx Voodoo
support. The VGABIOS image will be compiled for Banshee PCI and this code
modifies the PCI data for the Voodoo3 and AGP models.
2021-04-11 20:09:43 +00:00
Volker Ruppert
7aa5eb7a51 Some changes for correct vertical frequency reporting on mode switch.
- vgacore: method get_crtc_params() now returns selected video clock value.
- banshee: now using selected video clock instead of hardcoded VCLK #3.
- cirrus: added vertical frequency to mode switch BX_INFO.
2021-04-07 06:31:25 +00:00
Volker Ruppert
7aea547b9f Fixed possible segfault on some platforms. We need 'count + 4' device entries,
one for the "none" entry and a terminating NULL entry.
2021-04-05 11:17:20 +00:00
Volker Ruppert
857c3be2ba Some work on the Voodoo Banshee code.
- Moved setup of default i/o register values to reset().
- Set up strapInfo register bits in init().
- Don't overwrite readonly bits in miscInit1 register.
- Set up subsystem ID in VGABIOS ROM in case it's > 32k (doesn't exist yet).
- Copy subsystem ID from ROM to PCI config registers in reset().
2021-04-04 19:00:29 +00:00
Volker Ruppert
d8b25c5f26 Some more cleanup in the plugins code. 2021-04-03 18:26:03 +00:00
Volker Ruppert
7b355cd399 Get rid of the code duplication in the PIC write handler. 2021-04-03 16:44:19 +00:00
Volker Ruppert
7d104ffceb Fixed setting up advanced PCI options. 2021-04-03 12:54:25 +00:00
Volker Ruppert
e411667942 Started reducing PIC code duplication and some cleanups. 2021-04-02 19:01:37 +00:00
Volker Ruppert
8e8414aae4 Some cleanup in the plugins code and related documentation additions. 2021-04-01 19:36:59 +00:00
Volker Ruppert
e9df9c51c8 Fixed compilation with PCI host device mapping support enabled. Since a plugin
cannot unload itself, BX_UNREGISTER_DEVICE_DEVMODEL() call will fail. Setting
plugin control flag to 0 like other devices do. When starting simulation, all
unused plugins are removed.
NOTE: The pcidev stuff is unmaintained, functionality not tested.
2021-03-26 18:41:28 +00:00
Volker Ruppert
81f7b6d47a Fixed floppy format track handling. After introducing the DMA optimization it
stopped after first sector.
2021-03-21 20:53:48 +00:00
Volker Ruppert
db3a176c84 Fixed issue reported in SF patch #558: deassert INT if IMR change masks active request. 2021-03-19 17:45:49 +00:00
Volker Ruppert
b79b868ff9 Attempt to fix the issue reported in SF patch #558 (fixed spurious interrupt
detection).
2021-03-17 19:42:41 +00:00
Volker Ruppert
5385b2b98b Some textconfig related changes.
- Removed unused method bx_list_c::text_print().
- Fixed default prompt in bx_param_enum_c::text_ask().
- speaker.cc: fixed a typo in ask format.
2021-03-14 09:52:15 +00:00
Volker Ruppert
25e725a23c Makefile dependency updates
- Don't include paramtree.h in siminterface.h to get rid of duplicates
  in a lot of Makefile dependency lines.
- Regenerated Makefile dependencies in iodev and affected subdirectories.
- FIXME #1: including debug.h causes duplicate entries of config.h and osdep.h.
- FIXME #2: cpudb.h appears in most of the iodev* dependencies, but only needed
  by config.cc and the cpu class.
2021-03-13 09:54:06 +00:00
Volker Ruppert
90ac89ea22 After changing network device object pointer to class logfunctions the
networking modules don't need to include iodev.h.
2021-03-12 21:31:51 +00:00
Volker Ruppert
51a9557acf Disk image and sound driver modules don't need to include iodev.h. 2021-03-11 21:46:25 +00:00
Volker Ruppert
a2cf072751 Some cleanups in the plugins code. 2021-03-07 16:01:39 +00:00
Volker Ruppert
0c2a9c69d6 Some config option changes.
- Moved serial and parallel config parameter list creation to the corresponding
  device code.
- Unregister serial and parallel bochsrc options in PLUGIN_FINI mode.
- Moved USB config and runtime parameter list creation to bx_init_usb_options().
- textconfig.cc: Small fixes in the optional plugin control.
2021-03-07 11:54:50 +00:00
Volker Ruppert
27c120154b Fixed a GCC warning and some MSVC warnings. 2021-02-27 20:53:10 +00:00
Volker Ruppert
2aadd3e470 Changed type of the PCI slot option to bx_param_enum_c and build choices list
from plugin devives with PLUGFLAG_PCI set.
2021-02-27 10:23:05 +00:00
Volker Ruppert
4dd5816108 Some changes in the Bochs plugins code.
- Changed variable type of the plugin_t "type" member from enum to Bit16u.
- Added support for returning device flags with the new mode PLUGIN_FLAGS in
  the plugin entry functions. It is currently only used for devices that can
  be connected to a PCI slot.
- Code cleanup in core device plugins: checking type no longer necessary.
- The "non-plugin" mode now also uses the "loadtype" member of plugin_t.

TODO: Change PCI slot options to bx_param_enum_c and build the choices list
using the new capabilities of the plugin API.
2021-02-26 20:37:49 +00:00
Volker Ruppert
8aaf9d858e Changed type of vga and svga_cirrus plugins to PLUGTYPE_VGA. Modified vga
extension option init to make this work correctly. The choices "none" and "vbe"
load the vga plugin, "cirrus" loads svga_cirrus.
2021-02-23 08:12:24 +00:00
Volker Ruppert
b84c6c8526 Some changes in the device config handling in all HCs and external hub.
- Disable port "options" parameter after successful connect. While connected,
  a device may install runtime options to control it's behaviour.
- Added enable handlers for the "options" parameter to ensure an attempt to
  change the device while connected doesn't enable it.
- Some related code cleanups.
2021-02-20 19:58:39 +00:00
Volker Ruppert
2e44a5c8bf Changed type of VGA extension option to bx_param_enum_c. Additional choices are
added from plugins list.
2021-02-19 16:05:56 +00:00
Volker Ruppert
24bccc8efb Changed parameter handler argument "set" type to bool. 2021-02-19 13:13:42 +00:00
Volker Ruppert
67a5487eab Some cleanup in the USB device change code. 2021-02-18 18:10:41 +00:00
Volker Ruppert
d4171cbf31 Renamed usb_cbi plugin to usb_floppy (including changes of source file names
and internal names).
2021-02-18 15:03:05 +00:00
Volker Ruppert
ceb8462cc7 Updated main and usb Makefile dependencies. 2021-02-17 16:53:40 +00:00
Volker Ruppert
dcdceb96f6 Generate USB devices list from available USB plugins list and removed hardcoded
device handling. Added some code to handle plugins that provide more than one
device type (usb_hid, usb_msd) or with different name (usb_cbi). The device
type member is now only used by multi-function devices.
2021-02-17 16:22:55 +00:00
Volker Ruppert
16d79cbf0b Some fixes and cleanups in the USB code.
- USB hub: disable device "options" parameter if device is set to "none".
- USB hub: handle device disconnect in runtime_config().
- Removed handling of USB device type in host controllers and external hub.
2021-02-16 17:04:04 +00:00
Volker Ruppert
368c83127e Some small changes in the USB devices configuration.
- Fixed USB devices list by adding a terminating NULL entry.
- Disable USB device options parameter if device is set to "none".
- Related documentation updates.
2021-02-15 19:55:53 +00:00
Volker Ruppert
919d82b68e Next step of USB devices handling rewrite. Changed type of the device parameter
to bx_param_enum_c. Updated code to provide support for legacy syntax
(portX="device:option").
TODO: generate USB devices list from plugins list.
2021-02-15 16:09:02 +00:00
Volker Ruppert
ebc11b80c8 The variable name "interface" cannot be used if windows.h is included. 2021-02-14 09:59:36 +00:00
Volker Ruppert
e00a5d0761 Started rewrite of the USB devices handling.
- Moved main option from the portX parameter to the optionsX parameter. Added
  new option "path" for the disk, cdrom and floppy devices, "ports" for the
  USB hub and "file" for the USB printer. The legacy syntax is still supported.
- Register USB device state after init() to ensure all options that may have
  effect on the save/restore list are applied.
- Report available devices on top of log file similar to hdimage, network and
  sound modules.
- Changed USB device type variable typein host controllers to int.
- Prepared improved usbdev_ctl init / exit implementation.
- TODO: Create list of USB devices dynamicly from available plugins.
2021-02-14 08:30:49 +00:00
Volker Ruppert
07f32da5a7 Some plugin related fixes.
- Fixed loading of all plugins with one type using wildcard.
- Reduced maximum length of line when listing available modules for hdimage,
  network and sound.
2021-02-14 06:25:01 +00:00
Volker Ruppert
587c7b257b Bugfix: USB descriptors depending on speed must be set up in init(). 2021-02-13 10:22:19 +00:00