Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <wchar.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#ifndef INFINITY
|
2022-11-19 10:40:32 -05:00
|
|
|
# define INFINITY (__builtin_inff())
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#endif
|
|
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#include "cpu.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/timer.h>
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#include "x86.h"
|
2023-08-21 02:56:33 +02:00
|
|
|
#include "x86seg_common.h"
|
2024-06-10 00:08:48 +02:00
|
|
|
#include "x87_sf.h"
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#include "x87.h"
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/nmi.h>
|
|
|
|
|
#include <86box/mem.h>
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
#include <86box/smram.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/pic.h>
|
|
|
|
|
#include <86box/pit.h>
|
|
|
|
|
#include <86box/fdd.h>
|
|
|
|
|
#include <86box/fdc.h>
|
2020-04-10 01:08:52 +02:00
|
|
|
#include <86box/keyboard.h>
|
2022-07-16 03:12:24 +02:00
|
|
|
#include <86box/timer.h>
|
2023-08-21 02:56:33 +02:00
|
|
|
|
|
|
|
|
#include "x86seg.h"
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#include "386_common.h"
|
|
|
|
|
#include "x86_flags.h"
|
2023-08-10 15:43:16 -04:00
|
|
|
#include <86box/plat_unused.h>
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2020-06-13 12:32:09 +02:00
|
|
|
#ifdef USE_DYNAREC
|
2022-11-19 10:40:32 -05:00
|
|
|
# include "codegen.h"
|
|
|
|
|
# define CPU_BLOCK_END() cpu_block_end = 1
|
2020-06-13 12:32:09 +02:00
|
|
|
#else
|
2022-11-19 10:40:32 -05:00
|
|
|
# define CPU_BLOCK_END()
|
2020-06-13 12:32:09 +02:00
|
|
|
#endif
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
x86seg gdt;
|
|
|
|
|
x86seg ldt;
|
|
|
|
|
x86seg idt;
|
|
|
|
|
x86seg tr;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
uint32_t cr2;
|
|
|
|
|
uint32_t cr3;
|
|
|
|
|
uint32_t cr4;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
uint32_t dr[8];
|
|
|
|
|
|
|
|
|
|
uint32_t use32;
|
2022-11-19 10:40:32 -05:00
|
|
|
int stack32;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2024-06-12 20:46:27 +02:00
|
|
|
int cpu_init = 0;
|
|
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
uint32_t *eal_r;
|
|
|
|
|
uint32_t *eal_w;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
|
|
|
|
int nmi_enable = 1;
|
|
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
int alt_access;
|
|
|
|
|
int cpl_override = 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2020-02-29 19:12:23 +01:00
|
|
|
#ifdef USE_NEW_DYNAREC
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
uint16_t cpu_cur_status = 0;
|
2020-02-29 19:12:23 +01:00
|
|
|
#else
|
|
|
|
|
uint32_t cpu_cur_status = 0;
|
|
|
|
|
#endif
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2020-05-12 13:36:47 +02:00
|
|
|
extern uint8_t *pccache2;
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
extern int optype;
|
2020-05-12 13:36:47 +02:00
|
|
|
extern uint32_t pccache;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2025-01-19 09:06:39 +01:00
|
|
|
int new_ne = 0;
|
2023-08-10 15:43:16 -04:00
|
|
|
int in_sys = 0;
|
|
|
|
|
int unmask_a20_in_smm = 0;
|
|
|
|
|
uint32_t old_rammask = 0xffffffff;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
int soft_reset_mask = 0;
|
2020-06-14 14:50:30 +02:00
|
|
|
|
2021-08-27 13:31:47 +02:00
|
|
|
int smi_latched = 0;
|
2023-08-10 15:43:16 -04:00
|
|
|
int smm_in_hlt = 0;
|
|
|
|
|
int smi_block = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-08-08 19:39:52 +02:00
|
|
|
int prefetch_prefixes = 0;
|
2024-01-14 15:26:40 +06:00
|
|
|
int rf_flag_no_clear = 0;
|
2023-08-08 19:39:52 +02:00
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
int tempc;
|
|
|
|
|
int oldcpl;
|
|
|
|
|
int optype;
|
|
|
|
|
int inttype;
|
|
|
|
|
int oddeven = 0;
|
2023-08-08 19:39:52 +02:00
|
|
|
int timetolive;
|
|
|
|
|
|
|
|
|
|
uint16_t oldcs;
|
|
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
uint32_t oldds;
|
|
|
|
|
uint32_t oldss;
|
|
|
|
|
uint32_t olddslimit;
|
|
|
|
|
uint32_t oldsslimit;
|
|
|
|
|
uint32_t olddslimitw;
|
|
|
|
|
uint32_t oldsslimitw;
|
2023-08-08 19:39:52 +02:00
|
|
|
uint32_t oxpc;
|
|
|
|
|
uint32_t rmdat32;
|
|
|
|
|
uint32_t backupregs[16];
|
|
|
|
|
|
|
|
|
|
x86seg _oldds;
|
|
|
|
|
|
2025-03-17 03:40:52 +01:00
|
|
|
uint8_t rep_op = 0x00;
|
|
|
|
|
uint8_t is_smint = 0;
|
|
|
|
|
|
|
|
|
|
uint16_t io_port = 0x0000;
|
|
|
|
|
uint32_t io_val = 0x00000000;
|
|
|
|
|
|
2025-04-22 09:46:58 +02:00
|
|
|
uint32_t x87_op = 0x00000000;
|
2025-04-22 09:13:38 +02:00
|
|
|
|
2024-06-23 02:28:22 +02:00
|
|
|
int opcode_has_modrm[256] = {
|
|
|
|
|
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*00*/
|
|
|
|
|
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*10*/
|
|
|
|
|
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*20*/
|
|
|
|
|
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, /*30*/
|
|
|
|
|
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*40*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*50*/
|
|
|
|
|
0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, /*60*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*70*/
|
|
|
|
|
|
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*90*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*a0*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*b0*/
|
|
|
|
|
|
|
|
|
|
1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /*c0*/
|
|
|
|
|
1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, /*d0*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*e0*/
|
|
|
|
|
0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, /*f0*/
|
|
|
|
|
};
|
|
|
|
|
|
2023-08-11 13:00:04 -04:00
|
|
|
int opcode_length[256] = { 3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 3, /* 0x0x */
|
|
|
|
|
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x1x */
|
|
|
|
|
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x2x */
|
|
|
|
|
3, 3, 3, 3, 3, 3, 1, 1, 3, 3, 3, 3, 3, 3, 1, 1, /* 0x3x */
|
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x4x */
|
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x5x */
|
|
|
|
|
1, 1, 3, 3, 1, 1, 1, 1, 3, 3, 2, 3, 1, 1, 1, 1, /* 0x6x */
|
|
|
|
|
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x7x */
|
|
|
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x8x */
|
|
|
|
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, /* 0x9x */
|
|
|
|
|
3, 3, 3, 3, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, /* 0xax */
|
|
|
|
|
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xbx */
|
|
|
|
|
3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 1, 1, 2, 1, 1, /* 0xcx */
|
|
|
|
|
3, 3, 3, 3, 2, 2, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xdx */
|
|
|
|
|
2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 2, 1, 1, 1, 1, /* 0xex */
|
|
|
|
|
1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 3, 3 }; /* 0xfx */
|
2023-08-08 19:39:52 +02:00
|
|
|
|
2024-02-10 03:05:56 +01:00
|
|
|
/* 0 = no, 1 = always, 2 = depends on second opcode, 3 = depends on mod/rm */
|
|
|
|
|
int lock_legal[256] = { 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 2, /* 0x0x */
|
|
|
|
|
1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, /* 0x1x */
|
2024-02-23 07:10:15 +01:00
|
|
|
1, 1, 1, 1, 1, 1, 4, 0, 1, 1, 1, 1, 1, 1, 4, 0, /* 0x2x */
|
|
|
|
|
1, 1, 1, 1, 1, 1, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, /* 0x3x */
|
2024-02-10 03:05:56 +01:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x4x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x5x */
|
2024-02-23 07:10:15 +01:00
|
|
|
0, 0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x6x */
|
2024-02-10 03:05:56 +01:00
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x7x */
|
|
|
|
|
3, 3, 3, 3, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x8x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xax */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xbx */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xcx */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xdx */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xex */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 3, 3 }; /* 0xfx */
|
|
|
|
|
|
|
|
|
|
int lock_legal_0f[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x1x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x2x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x3x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x4x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x5x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x6x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x7x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x8x */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x9x */
|
|
|
|
|
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, /* 0xax */
|
|
|
|
|
0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, /* 0xbx */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xcx */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xdx */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xex */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* 0xfx */
|
|
|
|
|
|
|
|
|
|
/* (modrm >> 3) & 0x07 */
|
|
|
|
|
int lock_legal_ba[8] = { 0, 0, 0, 0, 1, 1, 1, 1 };
|
|
|
|
|
|
|
|
|
|
/* Also applies to 81, 82, and 83 */
|
|
|
|
|
int lock_legal_80[8] = { 1, 1, 1, 1, 1, 1, 1, 0 };
|
|
|
|
|
|
|
|
|
|
/* Also applies to F7 */
|
|
|
|
|
int lock_legal_f6[8] = { 0, 0, 1, 1, 0, 0, 0, 0 };
|
|
|
|
|
|
|
|
|
|
/* Also applies to FF */
|
|
|
|
|
int lock_legal_fe[8] = { 1, 1, 0, 0, 0, 0, 0, 0 };
|
|
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
uint32_t addr64;
|
|
|
|
|
uint32_t addr64_2;
|
|
|
|
|
uint32_t addr64a[8];
|
|
|
|
|
uint32_t addr64a_2[8];
|
2021-04-10 07:18:47 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
static pc_timer_t *cpu_fast_off_timer = NULL;
|
|
|
|
|
static double cpu_fast_off_period = 0.0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2024-02-01 18:34:58 +05:00
|
|
|
#define AMD_SYSCALL_EIP (msr.amd_star & 0xFFFFFFFF)
|
|
|
|
|
#define AMD_SYSCALL_SB ((msr.amd_star >> 32) & 0xFFFF)
|
|
|
|
|
#define AMD_SYSRET_SB ((msr.amd_star >> 48) & 0xFFFF)
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* These #define's and enum have been borrowed from Bochs. */
|
|
|
|
|
/* SMM feature masks */
|
2022-11-19 10:40:32 -05:00
|
|
|
#define SMM_IO_INSTRUCTION_RESTART (0x00010000)
|
|
|
|
|
#define SMM_SMBASE_RELOCATION (0x00020000)
|
|
|
|
|
#define SMM_REVISION (0x20000000)
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* TODO: Which CPU added SMBASE relocation? */
|
2022-11-19 10:40:32 -05:00
|
|
|
#define SMM_REVISION_ID (SMM_SMBASE_RELOCATION | SMM_IO_INSTRUCTION_RESTART | SMM_REVISION)
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
#define SMM_SAVE_STATE_MAP_SIZE 128
|
|
|
|
|
|
|
|
|
|
enum SMMRAM_Fields_386_To_P5 {
|
2022-11-19 10:40:32 -05:00
|
|
|
SMRAM_FIELD_P5_CR0 = 0, /* 1FC */
|
|
|
|
|
SMRAM_FIELD_P5_CR3, /* 1F8 */
|
|
|
|
|
SMRAM_FIELD_P5_EFLAGS, /* 1F4 */
|
|
|
|
|
SMRAM_FIELD_P5_EIP, /* 1F0 */
|
|
|
|
|
SMRAM_FIELD_P5_EDI, /* 1EC */
|
|
|
|
|
SMRAM_FIELD_P5_ESI, /* 1E8 */
|
|
|
|
|
SMRAM_FIELD_P5_EBP, /* 1E4 */
|
|
|
|
|
SMRAM_FIELD_P5_ESP, /* 1E0 */
|
|
|
|
|
SMRAM_FIELD_P5_EBX, /* 1DC */
|
|
|
|
|
SMRAM_FIELD_P5_EDX, /* 1D8 */
|
|
|
|
|
SMRAM_FIELD_P5_ECX, /* 1D4 */
|
|
|
|
|
SMRAM_FIELD_P5_EAX, /* 1D0 */
|
|
|
|
|
SMRAM_FIELD_P5_DR6, /* 1CC */
|
|
|
|
|
SMRAM_FIELD_P5_DR7, /* 1C8 */
|
|
|
|
|
SMRAM_FIELD_P5_TR_SELECTOR, /* 1C4 */
|
|
|
|
|
SMRAM_FIELD_P5_LDTR_SELECTOR, /* 1C0 */
|
|
|
|
|
SMRAM_FIELD_P5_GS_SELECTOR, /* 1BC */
|
|
|
|
|
SMRAM_FIELD_P5_FS_SELECTOR, /* 1B8 */
|
|
|
|
|
SMRAM_FIELD_P5_DS_SELECTOR, /* 1B4 */
|
|
|
|
|
SMRAM_FIELD_P5_SS_SELECTOR, /* 1B0 */
|
|
|
|
|
SMRAM_FIELD_P5_CS_SELECTOR, /* 1AC */
|
|
|
|
|
SMRAM_FIELD_P5_ES_SELECTOR, /* 1A8 */
|
|
|
|
|
SMRAM_FIELD_P5_TR_ACCESS, /* 1A4 */
|
|
|
|
|
SMRAM_FIELD_P5_TR_BASE, /* 1A0 */
|
|
|
|
|
SMRAM_FIELD_P5_TR_LIMIT, /* 19C */
|
|
|
|
|
SMRAM_FIELD_P5_IDTR_ACCESS, /* 198 */
|
|
|
|
|
SMRAM_FIELD_P5_IDTR_BASE, /* 194 */
|
|
|
|
|
SMRAM_FIELD_P5_IDTR_LIMIT, /* 190 */
|
|
|
|
|
SMRAM_FIELD_P5_GDTR_ACCESS, /* 18C */
|
|
|
|
|
SMRAM_FIELD_P5_GDTR_BASE, /* 188 */
|
|
|
|
|
SMRAM_FIELD_P5_GDTR_LIMIT, /* 184 */
|
|
|
|
|
SMRAM_FIELD_P5_LDTR_ACCESS, /* 180 */
|
|
|
|
|
SMRAM_FIELD_P5_LDTR_BASE, /* 17C */
|
|
|
|
|
SMRAM_FIELD_P5_LDTR_LIMIT, /* 178 */
|
|
|
|
|
SMRAM_FIELD_P5_GS_ACCESS, /* 174 */
|
|
|
|
|
SMRAM_FIELD_P5_GS_BASE, /* 170 */
|
|
|
|
|
SMRAM_FIELD_P5_GS_LIMIT, /* 16C */
|
|
|
|
|
SMRAM_FIELD_P5_FS_ACCESS, /* 168 */
|
|
|
|
|
SMRAM_FIELD_P5_FS_BASE, /* 164 */
|
|
|
|
|
SMRAM_FIELD_P5_FS_LIMIT, /* 160 */
|
|
|
|
|
SMRAM_FIELD_P5_DS_ACCESS, /* 15C */
|
|
|
|
|
SMRAM_FIELD_P5_DS_BASE, /* 158 */
|
|
|
|
|
SMRAM_FIELD_P5_DS_LIMIT, /* 154 */
|
|
|
|
|
SMRAM_FIELD_P5_SS_ACCESS, /* 150 */
|
|
|
|
|
SMRAM_FIELD_P5_SS_BASE, /* 14C */
|
|
|
|
|
SMRAM_FIELD_P5_SS_LIMIT, /* 148 */
|
|
|
|
|
SMRAM_FIELD_P5_CS_ACCESS, /* 144 */
|
|
|
|
|
SMRAM_FIELD_P5_CS_BASE, /* 140 */
|
|
|
|
|
SMRAM_FIELD_P5_CS_LIMIT, /* 13C */
|
|
|
|
|
SMRAM_FIELD_P5_ES_ACCESS, /* 138 */
|
|
|
|
|
SMRAM_FIELD_P5_ES_BASE, /* 134 */
|
|
|
|
|
SMRAM_FIELD_P5_ES_LIMIT, /* 130 */
|
|
|
|
|
SMRAM_FIELD_P5_UNWRITTEN_1, /* 12C */
|
|
|
|
|
SMRAM_FIELD_P5_CR4, /* 128 */
|
|
|
|
|
SMRAM_FIELD_P5_ALTERNATE_DR6, /* 124 */
|
|
|
|
|
SMRAM_FIELD_P5_RESERVED_1, /* 120 */
|
|
|
|
|
SMRAM_FIELD_P5_RESERVED_2, /* 11C */
|
|
|
|
|
SMRAM_FIELD_P5_RESERVED_3, /* 118 */
|
|
|
|
|
SMRAM_FIELD_P5_RESERVED_4, /* 114 */
|
|
|
|
|
SMRAM_FIELD_P5_IO_RESTART_EIP, /* 110 */
|
|
|
|
|
SMRAM_FIELD_P5_IO_RESTART_ESI, /* 10C */
|
|
|
|
|
SMRAM_FIELD_P5_IO_RESTART_ECX, /* 108 */
|
|
|
|
|
SMRAM_FIELD_P5_IO_RESTART_EDI, /* 104 */
|
|
|
|
|
SMRAM_FIELD_P5_AUTOHALT_RESTART, /* 100 */
|
|
|
|
|
SMRAM_FIELD_P5_SMM_REVISION_ID, /* 0FC */
|
|
|
|
|
SMRAM_FIELD_P5_SMBASE_OFFSET, /* 0F8 */
|
|
|
|
|
SMRAM_FIELD_AM486_CR2, /* 0F4 */
|
|
|
|
|
SMRAM_FIELD_AM486_DR0, /* 0F0 */
|
|
|
|
|
SMRAM_FIELD_AM486_DR1, /* 0EC */
|
|
|
|
|
SMRAM_FIELD_AM486_DR2, /* 0E8 */
|
|
|
|
|
SMRAM_FIELD_AM486_DR3, /* 0E4 */
|
2020-04-10 01:08:52 +02:00
|
|
|
SMRAM_FIELD_P5_LAST
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum SMMRAM_Fields_P6 {
|
2022-11-19 10:40:32 -05:00
|
|
|
SMRAM_FIELD_P6_CR0 = 0, /* 1FC */
|
|
|
|
|
SMRAM_FIELD_P6_CR3, /* 1F8 */
|
|
|
|
|
SMRAM_FIELD_P6_EFLAGS, /* 1F4 */
|
|
|
|
|
SMRAM_FIELD_P6_EIP, /* 1F0 */
|
|
|
|
|
SMRAM_FIELD_P6_EDI, /* 1EC */
|
|
|
|
|
SMRAM_FIELD_P6_ESI, /* 1E8 */
|
|
|
|
|
SMRAM_FIELD_P6_EBP, /* 1E4 */
|
|
|
|
|
SMRAM_FIELD_P6_ESP, /* 1E0 */
|
|
|
|
|
SMRAM_FIELD_P6_EBX, /* 1DC */
|
|
|
|
|
SMRAM_FIELD_P6_EDX, /* 1D8 */
|
|
|
|
|
SMRAM_FIELD_P6_ECX, /* 1D4 */
|
|
|
|
|
SMRAM_FIELD_P6_EAX, /* 1D0 */
|
|
|
|
|
SMRAM_FIELD_P6_DR6, /* 1CC */
|
|
|
|
|
SMRAM_FIELD_P6_DR7, /* 1C8 */
|
|
|
|
|
SMRAM_FIELD_P6_TR_SELECTOR, /* 1C4 */
|
|
|
|
|
SMRAM_FIELD_P6_LDTR_SELECTOR, /* 1C0 */
|
|
|
|
|
SMRAM_FIELD_P6_GS_SELECTOR, /* 1BC */
|
|
|
|
|
SMRAM_FIELD_P6_FS_SELECTOR, /* 1B8 */
|
|
|
|
|
SMRAM_FIELD_P6_DS_SELECTOR, /* 1B4 */
|
|
|
|
|
SMRAM_FIELD_P6_SS_SELECTOR, /* 1B0 */
|
|
|
|
|
SMRAM_FIELD_P6_CS_SELECTOR, /* 1AC */
|
|
|
|
|
SMRAM_FIELD_P6_ES_SELECTOR, /* 1A8 */
|
|
|
|
|
SMRAM_FIELD_P6_SS_BASE, /* 1A4 */
|
|
|
|
|
SMRAM_FIELD_P6_SS_LIMIT, /* 1A0 */
|
|
|
|
|
SMRAM_FIELD_P6_SS_SELECTOR_AR, /* 19C */
|
|
|
|
|
SMRAM_FIELD_P6_CS_BASE, /* 198 */
|
|
|
|
|
SMRAM_FIELD_P6_CS_LIMIT, /* 194 */
|
|
|
|
|
SMRAM_FIELD_P6_CS_SELECTOR_AR, /* 190 */
|
|
|
|
|
SMRAM_FIELD_P6_ES_BASE, /* 18C */
|
|
|
|
|
SMRAM_FIELD_P6_ES_LIMIT, /* 188 */
|
|
|
|
|
SMRAM_FIELD_P6_ES_SELECTOR_AR, /* 184 */
|
|
|
|
|
SMRAM_FIELD_P6_LDTR_BASE, /* 180 */
|
|
|
|
|
SMRAM_FIELD_P6_LDTR_LIMIT, /* 17C */
|
|
|
|
|
SMRAM_FIELD_P6_LDTR_SELECTOR_AR, /* 178 */
|
|
|
|
|
SMRAM_FIELD_P6_GDTR_BASE, /* 174 */
|
|
|
|
|
SMRAM_FIELD_P6_GDTR_LIMIT, /* 170 */
|
|
|
|
|
SMRAM_FIELD_P6_GDTR_SELECTOR_AR, /* 16C */
|
|
|
|
|
SMRAM_FIELD_P6_SREG_STATUS1, /* 168 */
|
|
|
|
|
SMRAM_FIELD_P6_TR_BASE, /* 164 */
|
|
|
|
|
SMRAM_FIELD_P6_TR_LIMIT, /* 160 */
|
|
|
|
|
SMRAM_FIELD_P6_TR_SELECTOR_AR, /* 15C */
|
|
|
|
|
SMRAM_FIELD_P6_IDTR_BASE, /* 158 */
|
|
|
|
|
SMRAM_FIELD_P6_IDTR_LIMIT, /* 154 */
|
|
|
|
|
SMRAM_FIELD_P6_IDTR_SELECTOR_AR, /* 150 */
|
|
|
|
|
SMRAM_FIELD_P6_GS_BASE, /* 14C */
|
|
|
|
|
SMRAM_FIELD_P6_GS_LIMIT, /* 148 */
|
|
|
|
|
SMRAM_FIELD_P6_GS_SELECTOR_AR, /* 144 */
|
|
|
|
|
SMRAM_FIELD_P6_FS_BASE, /* 140 */
|
|
|
|
|
SMRAM_FIELD_P6_FS_LIMIT, /* 13C */
|
|
|
|
|
SMRAM_FIELD_P6_FS_SELECTOR_AR, /* 138 */
|
|
|
|
|
SMRAM_FIELD_P6_DS_BASE, /* 134 */
|
|
|
|
|
SMRAM_FIELD_P6_DS_LIMIT, /* 130 */
|
|
|
|
|
SMRAM_FIELD_P6_DS_SELECTOR_AR, /* 12C */
|
|
|
|
|
SMRAM_FIELD_P6_SREG_STATUS0, /* 128 */
|
|
|
|
|
SMRAM_FIELD_P6_ALTERNATIVE_DR6, /* 124 */
|
|
|
|
|
SMRAM_FIELD_P6_CPL, /* 120 */
|
|
|
|
|
SMRAM_FIELD_P6_SMM_STATUS, /* 11C */
|
|
|
|
|
SMRAM_FIELD_P6_A20M, /* 118 */
|
|
|
|
|
SMRAM_FIELD_P6_CR4, /* 114 */
|
|
|
|
|
SMRAM_FIELD_P6_IO_RESTART_EIP, /* 110 */
|
|
|
|
|
SMRAM_FIELD_P6_IO_RESTART_ESI, /* 10C */
|
|
|
|
|
SMRAM_FIELD_P6_IO_RESTART_ECX, /* 108 */
|
|
|
|
|
SMRAM_FIELD_P6_IO_RESTART_EDI, /* 104 */
|
|
|
|
|
SMRAM_FIELD_P6_AUTOHALT_RESTART, /* 100 */
|
|
|
|
|
SMRAM_FIELD_P6_SMM_REVISION_ID, /* 0FC */
|
|
|
|
|
SMRAM_FIELD_P6_SMBASE_OFFSET, /* 0F8 */
|
2020-04-10 01:08:52 +02:00
|
|
|
SMRAM_FIELD_P6_LAST
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum SMMRAM_Fields_AMD_K {
|
2022-11-19 10:40:32 -05:00
|
|
|
SMRAM_FIELD_AMD_K_CR0 = 0, /* 1FC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CR3, /* 1F8 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EFLAGS, /* 1F4 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EIP, /* 1F0 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EDI, /* 1EC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ESI, /* 1E8 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EBP, /* 1E4 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ESP, /* 1E0 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EBX, /* 1DC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EDX, /* 1D8 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ECX, /* 1D4 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_EAX, /* 1D0 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_DR6, /* 1CC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_DR7, /* 1C8 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_TR_SELECTOR, /* 1C4 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_LDTR_SELECTOR, /* 1C0 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_GS_SELECTOR, /* 1BC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_FS_SELECTOR, /* 1B8 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_DS_SELECTOR, /* 1B4 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_SS_SELECTOR, /* 1B0 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CS_SELECTOR, /* 1AC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ES_SELECTOR, /* 1A8 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IO_RESTART_DWORD, /* 1A4 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_RESERVED_1, /* 1A0 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IO_RESTART_EIP, /* 19C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_RESERVED_2, /* 198 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_RESERVED_3, /* 194 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IDTR_BASE, /* 190 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IDTR_LIMIT, /* 18C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_GDTR_BASE, /* 188 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_GDTR_LIMIT, /* 184 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_TR_ACCESS, /* 180 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_TR_BASE, /* 17C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_TR_LIMIT, /* 178 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_LDTR_ACCESS, /* 174 - reserved on K6 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_LDTR_BASE, /* 170 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_LDTR_LIMIT, /* 16C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_GS_ACCESS, /* 168 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_GS_BASE, /* 164 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_GS_LIMIT, /* 160 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_FS_ACCESS, /* 15C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_FS_BASE, /* 158 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_FS_LIMIT, /* 154 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_DS_ACCESS, /* 150 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_DS_BASE, /* 14C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_DS_LIMIT, /* 148 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_SS_ACCESS, /* 144 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_SS_BASE, /* 140 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_SS_LIMIT, /* 13C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CS_ACCESS, /* 138 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CS_BASE, /* 134 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CS_LIMIT, /* 130 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ES_ACCESS, /* 12C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ES_BASE, /* 128 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_ES_LIMIT, /* 124 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_RESERVED_4, /* 120 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_RESERVED_5, /* 11C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_RESERVED_6, /* 118 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CR2, /* 114 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_CR4, /* 110 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IO_RESTART_ESI, /* 10C */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IO_RESTART_ECX, /* 108 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_IO_RESTART_EDI, /* 104 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_AUTOHALT_RESTART, /* 100 */
|
|
|
|
|
SMRAM_FIELD_AMD_K_SMM_REVISION_ID, /* 0FC */
|
|
|
|
|
SMRAM_FIELD_AMD_K_SMBASE_OFFSET, /* 0F8 */
|
2020-04-10 01:08:52 +02:00
|
|
|
SMRAM_FIELD_AMD_K_LAST
|
|
|
|
|
};
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
int x386_common_do_log = ENABLE_386_COMMON_LOG;
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
x386_common_log(const char *fmt, ...)
|
|
|
|
|
{
|
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
|
|
if (x386_common_do_log) {
|
2022-11-19 10:40:32 -05:00
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
|
|
|
|
va_end(ap);
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else
|
2022-11-19 10:40:32 -05:00
|
|
|
# define x386_common_log(fmt, ...)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#endif
|
|
|
|
|
|
2024-02-23 07:10:15 +01:00
|
|
|
int
|
|
|
|
|
is_lock_legal(uint32_t fetchdat)
|
|
|
|
|
{
|
2024-06-09 19:58:16 +02:00
|
|
|
int legal = 1;
|
2024-02-23 07:10:15 +01:00
|
|
|
|
2024-06-09 19:58:16 +02:00
|
|
|
if (is386) {
|
|
|
|
|
fetch_dat_t fetch_dat;
|
|
|
|
|
fetch_dat.fd = fetchdat;
|
2024-02-23 07:10:15 +01:00
|
|
|
|
2024-06-09 19:58:16 +02:00
|
|
|
legal = lock_legal[fetch_dat.b[0]];
|
2024-02-23 07:10:15 +01:00
|
|
|
if (legal == 1)
|
2024-06-09 19:58:16 +02:00
|
|
|
legal = 1; // ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
|
|
|
|
|
else if (legal == 2) {
|
|
|
|
|
legal = lock_legal_0f[fetch_dat.b[1]];
|
2024-02-23 07:10:15 +01:00
|
|
|
if (legal == 1)
|
2024-06-09 19:58:16 +02:00
|
|
|
legal = ((fetch_dat.b[2] >> 6) != 0x03); /* reg,reg is illegal */
|
|
|
|
|
else if (legal == 3) {
|
|
|
|
|
legal = lock_legal_ba[(fetch_dat.b[2] >> 3) & 0x07];
|
|
|
|
|
if (legal == 1)
|
|
|
|
|
legal = ((fetch_dat.b[2] >> 6) != 0x03); /* reg,imm is illegal */
|
|
|
|
|
}
|
|
|
|
|
} else if (legal == 3) switch(fetch_dat.b[0]) {
|
|
|
|
|
case 0x80 ... 0x83:
|
|
|
|
|
legal = lock_legal_80[(fetch_dat.b[1] >> 3) & 0x07];
|
2024-02-23 07:10:15 +01:00
|
|
|
if (legal == 1)
|
|
|
|
|
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
|
|
|
|
|
break;
|
2024-06-09 19:58:16 +02:00
|
|
|
case 0xf6 ... 0xf7:
|
|
|
|
|
legal = lock_legal_f6[(fetch_dat.b[1] >> 3) & 0x07];
|
2024-02-23 07:10:15 +01:00
|
|
|
if (legal == 1)
|
|
|
|
|
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
|
|
|
|
|
break;
|
2024-06-09 19:58:16 +02:00
|
|
|
case 0xfe ... 0xff:
|
|
|
|
|
legal = lock_legal_fe[(fetch_dat.b[1] >> 3) & 0x07];
|
2024-02-23 07:10:15 +01:00
|
|
|
if (legal == 1)
|
|
|
|
|
legal = ((fetch_dat.b[1] >> 6) != 0x03); /* reg is illegal */
|
|
|
|
|
break;
|
2024-06-09 19:58:16 +02:00
|
|
|
default:
|
|
|
|
|
legal = 0;
|
2024-02-23 07:10:15 +01:00
|
|
|
break;
|
2024-06-09 19:58:16 +02:00
|
|
|
}
|
2024-02-23 07:10:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return legal;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-08 19:39:52 +02:00
|
|
|
/*Prefetch emulation is a fairly simplistic model:
|
|
|
|
|
- All instruction bytes must be fetched before it starts.
|
|
|
|
|
- Cycles used for non-instruction memory accesses are counted and subtracted
|
|
|
|
|
from the total cycles taken
|
|
|
|
|
- Any remaining cycles are used to refill the prefetch queue.
|
|
|
|
|
|
|
|
|
|
Note that this is only used for 286 / 386 systems. It is disabled when the
|
|
|
|
|
internal cache on 486+ CPUs is enabled.
|
|
|
|
|
*/
|
2023-08-11 13:00:04 -04:00
|
|
|
static int prefetch_bytes = 0;
|
2023-08-08 19:39:52 +02:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
prefetch_run(int instr_cycles, int bytes, int modrm, int reads, int reads_l, int writes, int writes_l, int ea32)
|
|
|
|
|
{
|
|
|
|
|
int mem_cycles = reads * cpu_cycles_read + reads_l * cpu_cycles_read_l + writes * cpu_cycles_write + writes_l * cpu_cycles_write_l;
|
|
|
|
|
|
|
|
|
|
if (instr_cycles < mem_cycles)
|
|
|
|
|
instr_cycles = mem_cycles;
|
|
|
|
|
|
|
|
|
|
prefetch_bytes -= prefetch_prefixes;
|
|
|
|
|
prefetch_bytes -= bytes;
|
|
|
|
|
if (modrm != -1) {
|
|
|
|
|
if (ea32) {
|
|
|
|
|
if ((modrm & 7) == 4) {
|
|
|
|
|
if ((modrm & 0x700) == 0x500)
|
|
|
|
|
prefetch_bytes -= 5;
|
|
|
|
|
else if ((modrm & 0xc0) == 0x40)
|
|
|
|
|
prefetch_bytes -= 2;
|
|
|
|
|
else if ((modrm & 0xc0) == 0x80)
|
|
|
|
|
prefetch_bytes -= 5;
|
|
|
|
|
} else {
|
|
|
|
|
if ((modrm & 0xc7) == 0x05)
|
|
|
|
|
prefetch_bytes -= 4;
|
|
|
|
|
else if ((modrm & 0xc0) == 0x40)
|
|
|
|
|
prefetch_bytes--;
|
|
|
|
|
else if ((modrm & 0xc0) == 0x80)
|
|
|
|
|
prefetch_bytes -= 4;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ((modrm & 0xc7) == 0x06)
|
|
|
|
|
prefetch_bytes -= 2;
|
|
|
|
|
else if ((modrm & 0xc0) != 0xc0)
|
|
|
|
|
prefetch_bytes -= ((modrm & 0xc0) >> 6);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fill up prefetch queue */
|
|
|
|
|
while (prefetch_bytes < 0) {
|
|
|
|
|
prefetch_bytes += cpu_prefetch_width;
|
|
|
|
|
cycles -= cpu_prefetch_cycles;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Subtract cycles used for memory access by instruction */
|
|
|
|
|
instr_cycles -= mem_cycles;
|
|
|
|
|
|
|
|
|
|
while (instr_cycles >= cpu_prefetch_cycles) {
|
|
|
|
|
prefetch_bytes += cpu_prefetch_width;
|
|
|
|
|
instr_cycles -= cpu_prefetch_cycles;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prefetch_prefixes = 0;
|
|
|
|
|
if (prefetch_bytes > 16)
|
|
|
|
|
prefetch_bytes = 16;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
prefetch_flush(void)
|
|
|
|
|
{
|
|
|
|
|
prefetch_bytes = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
static __inline void
|
|
|
|
|
set_stack32(int s)
|
|
|
|
|
{
|
2022-11-19 10:40:32 -05:00
|
|
|
if ((cr0 & 1) && !(cpu_state.eflags & VM_FLAG))
|
|
|
|
|
stack32 = s;
|
2020-11-16 00:01:21 +01:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
stack32 = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (stack32)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status |= CPU_STATUS_STACK32;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status &= ~CPU_STATUS_STACK32;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static __inline void
|
|
|
|
|
set_use32(int u)
|
|
|
|
|
{
|
2022-11-19 10:40:32 -05:00
|
|
|
if ((cr0 & 1) && !(cpu_state.eflags & VM_FLAG))
|
|
|
|
|
use32 = u ? 0x300 : 0;
|
2020-11-16 00:01:21 +01:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
use32 = 0;
|
2020-11-16 00:01:21 +01:00
|
|
|
|
|
|
|
|
if (use32)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status |= CPU_STATUS_USE32;
|
2020-11-16 00:01:21 +01:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status &= ~CPU_STATUS_USE32;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smm_seg_load(x86seg *s)
|
|
|
|
|
{
|
|
|
|
|
if (!is386)
|
2022-11-19 10:40:32 -05:00
|
|
|
s->base &= 0x00ffffff;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if ((s->access & 0x18) != 0x10 || !(s->access & (1 << 2))) {
|
2022-11-19 10:40:32 -05:00
|
|
|
/* Expand down. */
|
|
|
|
|
s->limit_high = s->limit;
|
|
|
|
|
s->limit_low = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
} else {
|
2022-11-19 10:40:32 -05:00
|
|
|
s->limit_high = (s->ar_high & 0x40) ? 0xffffffff : 0xffff;
|
|
|
|
|
s->limit_low = s->limit + 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((cr0 & 1) && !(cpu_state.eflags & VM_FLAG))
|
2022-11-19 10:40:32 -05:00
|
|
|
s->checked = s->seg ? 1 : 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
s->checked = 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (s == &cpu_state.seg_cs)
|
2022-11-19 10:40:32 -05:00
|
|
|
set_use32(s->ar_high & 0x40);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (s == &cpu_state.seg_ds) {
|
2022-11-19 10:40:32 -05:00
|
|
|
if (s->base == 0 && s->limit_low == 0 && s->limit_high == 0xffffffff)
|
|
|
|
|
cpu_cur_status &= ~CPU_STATUS_NOTFLATDS;
|
|
|
|
|
else
|
|
|
|
|
cpu_cur_status |= CPU_STATUS_NOTFLATDS;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (s == &cpu_state.seg_ss) {
|
2022-11-19 10:40:32 -05:00
|
|
|
if (s->base == 0 && s->limit_low == 0 && s->limit_high == 0xffffffff)
|
|
|
|
|
cpu_cur_status &= ~CPU_STATUS_NOTFLATSS;
|
|
|
|
|
else
|
|
|
|
|
cpu_cur_status |= CPU_STATUS_NOTFLATSS;
|
|
|
|
|
set_stack32((s->ar_high & 0x40) ? 1 : 0);
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_save_state_p5(uint32_t *saved_state, int in_hlt)
|
|
|
|
|
{
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_SMM_REVISION_ID] = SMM_REVISION_ID;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_SMBASE_OFFSET] = smbase;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < 8; n++)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_EAX - n] = cpu_state.regs[n].l;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (in_hlt)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_AUTOHALT_RESTART] = 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_AUTOHALT_RESTART] = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_EIP] = cpu_state.pc;
|
|
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_EFLAGS] = (cpu_state.eflags << 16) | (cpu_state.flags);
|
|
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_CR0] = cr0;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_CR3] = cr3;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_CR4] = cr4;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_DR6] = dr[6];
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_DR7] = dr[7];
|
|
|
|
|
|
|
|
|
|
/* TR */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_TR_SELECTOR] = tr.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_TR_BASE] = tr.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_TR_LIMIT] = tr.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_TR_ACCESS] = (tr.ar_high << 16) | (tr.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* LDTR */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_LDTR_SELECTOR] = ldt.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_LDTR_BASE] = ldt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_LDTR_LIMIT] = ldt.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_LDTR_ACCESS] = (ldt.ar_high << 16) | (ldt.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* IDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_IDTR_BASE] = idt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_IDTR_LIMIT] = idt.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P5_IDTR_ACCESS] = (idt.ar_high << 16) | (idt.access << 8);
|
|
|
|
|
|
|
|
|
|
/* GDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_GDTR_BASE] = gdt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_GDTR_LIMIT] = gdt.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P5_GDTR_ACCESS] = (gdt.ar_high << 16) | (gdt.access << 8);
|
|
|
|
|
|
|
|
|
|
/* ES */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_ES_SELECTOR] = cpu_state.seg_es.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_ES_BASE] = cpu_state.seg_es.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_ES_LIMIT] = cpu_state.seg_es.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_ES_ACCESS] = (cpu_state.seg_es.ar_high << 16) | (cpu_state.seg_es.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* CS */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_CS_SELECTOR] = cpu_state.seg_cs.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_CS_BASE] = cpu_state.seg_cs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_CS_LIMIT] = cpu_state.seg_cs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_CS_ACCESS] = (cpu_state.seg_cs.ar_high << 16) | (cpu_state.seg_cs.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* DS */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_DS_SELECTOR] = cpu_state.seg_ds.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_DS_BASE] = cpu_state.seg_ds.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_DS_LIMIT] = cpu_state.seg_ds.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_DS_ACCESS] = (cpu_state.seg_ds.ar_high << 16) | (cpu_state.seg_ds.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* SS */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_SS_SELECTOR] = cpu_state.seg_ss.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_SS_BASE] = cpu_state.seg_ss.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_SS_LIMIT] = cpu_state.seg_ss.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_SS_ACCESS] = (cpu_state.seg_ss.ar_high << 16) | (cpu_state.seg_ss.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* FS */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_FS_SELECTOR] = cpu_state.seg_fs.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_FS_BASE] = cpu_state.seg_fs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_FS_LIMIT] = cpu_state.seg_fs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_FS_ACCESS] = (cpu_state.seg_fs.ar_high << 16) | (cpu_state.seg_fs.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* GS */
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_GS_SELECTOR] = cpu_state.seg_gs.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P5_GS_BASE] = cpu_state.seg_gs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_GS_LIMIT] = cpu_state.seg_gs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P5_GS_ACCESS] = (cpu_state.seg_gs.ar_high << 16) | (cpu_state.seg_gs.access << 8);
|
2020-04-16 21:56:19 +02:00
|
|
|
|
|
|
|
|
/* Am486/5x86 stuff */
|
|
|
|
|
if (!is_pentium) {
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AM486_CR2] = cr2;
|
|
|
|
|
saved_state[SMRAM_FIELD_AM486_DR0] = dr[0];
|
|
|
|
|
saved_state[SMRAM_FIELD_AM486_DR1] = dr[1];
|
|
|
|
|
saved_state[SMRAM_FIELD_AM486_DR2] = dr[2];
|
|
|
|
|
saved_state[SMRAM_FIELD_AM486_DR3] = dr[3];
|
2020-04-16 21:56:19 +02:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_restore_state_p5(uint32_t *saved_state)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < 8; n++)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.regs[n].l = saved_state[SMRAM_FIELD_P5_EAX - n];
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (saved_state[SMRAM_FIELD_P5_AUTOHALT_RESTART] & 0xffff)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = saved_state[SMRAM_FIELD_P5_EIP] - 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = saved_state[SMRAM_FIELD_P5_EIP];
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
cpu_state.eflags = saved_state[SMRAM_FIELD_P5_EFLAGS] >> 16;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.flags = saved_state[SMRAM_FIELD_P5_EFLAGS] & 0xffff;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cr0 = saved_state[SMRAM_FIELD_P5_CR0];
|
|
|
|
|
cr3 = saved_state[SMRAM_FIELD_P5_CR3];
|
|
|
|
|
cr4 = saved_state[SMRAM_FIELD_P5_CR4];
|
2020-04-10 01:08:52 +02:00
|
|
|
dr[6] = saved_state[SMRAM_FIELD_P5_DR6];
|
|
|
|
|
dr[7] = saved_state[SMRAM_FIELD_P5_DR7];
|
|
|
|
|
|
|
|
|
|
/* TR */
|
2022-11-19 10:40:32 -05:00
|
|
|
tr.seg = saved_state[SMRAM_FIELD_P5_TR_SELECTOR];
|
|
|
|
|
tr.base = saved_state[SMRAM_FIELD_P5_TR_BASE];
|
|
|
|
|
tr.limit = saved_state[SMRAM_FIELD_P5_TR_LIMIT];
|
|
|
|
|
tr.access = (saved_state[SMRAM_FIELD_P5_TR_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
tr.ar_high = (saved_state[SMRAM_FIELD_P5_TR_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&tr);
|
|
|
|
|
|
|
|
|
|
/* LDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
ldt.seg = saved_state[SMRAM_FIELD_P5_LDTR_SELECTOR];
|
|
|
|
|
ldt.base = saved_state[SMRAM_FIELD_P5_LDTR_BASE];
|
|
|
|
|
ldt.limit = saved_state[SMRAM_FIELD_P5_LDTR_LIMIT];
|
|
|
|
|
ldt.access = (saved_state[SMRAM_FIELD_P5_LDTR_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
ldt.ar_high = (saved_state[SMRAM_FIELD_P5_LDTR_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&ldt);
|
|
|
|
|
|
|
|
|
|
/* IDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
idt.base = saved_state[SMRAM_FIELD_P5_IDTR_BASE];
|
|
|
|
|
idt.limit = saved_state[SMRAM_FIELD_P5_IDTR_LIMIT];
|
|
|
|
|
idt.access = (saved_state[SMRAM_FIELD_P5_IDTR_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
idt.ar_high = (saved_state[SMRAM_FIELD_P5_IDTR_ACCESS] >> 16) & 0xff;
|
|
|
|
|
|
|
|
|
|
/* GDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
gdt.base = saved_state[SMRAM_FIELD_P5_GDTR_BASE];
|
|
|
|
|
gdt.limit = saved_state[SMRAM_FIELD_P5_GDTR_LIMIT];
|
|
|
|
|
gdt.access = (saved_state[SMRAM_FIELD_P5_GDTR_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
gdt.ar_high = (saved_state[SMRAM_FIELD_P5_GDTR_ACCESS] >> 16) & 0xff;
|
|
|
|
|
|
|
|
|
|
/* ES */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_es.seg = saved_state[SMRAM_FIELD_P5_ES_SELECTOR];
|
|
|
|
|
cpu_state.seg_es.base = saved_state[SMRAM_FIELD_P5_ES_BASE];
|
|
|
|
|
cpu_state.seg_es.limit = saved_state[SMRAM_FIELD_P5_ES_LIMIT];
|
|
|
|
|
cpu_state.seg_es.access = (saved_state[SMRAM_FIELD_P5_ES_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_es.ar_high = (saved_state[SMRAM_FIELD_P5_ES_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_es);
|
|
|
|
|
|
|
|
|
|
/* CS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg = saved_state[SMRAM_FIELD_P5_CS_SELECTOR];
|
|
|
|
|
cpu_state.seg_cs.base = saved_state[SMRAM_FIELD_P5_CS_BASE];
|
|
|
|
|
cpu_state.seg_cs.limit = saved_state[SMRAM_FIELD_P5_CS_LIMIT];
|
|
|
|
|
cpu_state.seg_cs.access = (saved_state[SMRAM_FIELD_P5_CS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_cs.ar_high = (saved_state[SMRAM_FIELD_P5_CS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_cs);
|
|
|
|
|
|
|
|
|
|
/* DS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ds.seg = saved_state[SMRAM_FIELD_P5_DS_SELECTOR];
|
|
|
|
|
cpu_state.seg_ds.base = saved_state[SMRAM_FIELD_P5_DS_BASE];
|
|
|
|
|
cpu_state.seg_ds.limit = saved_state[SMRAM_FIELD_P5_DS_LIMIT];
|
|
|
|
|
cpu_state.seg_ds.access = (saved_state[SMRAM_FIELD_P5_DS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ds.ar_high = (saved_state[SMRAM_FIELD_P5_DS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ds);
|
|
|
|
|
|
|
|
|
|
/* SS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.seg = saved_state[SMRAM_FIELD_P5_SS_SELECTOR];
|
|
|
|
|
cpu_state.seg_ss.base = saved_state[SMRAM_FIELD_P5_SS_BASE];
|
|
|
|
|
cpu_state.seg_ss.limit = saved_state[SMRAM_FIELD_P5_SS_LIMIT];
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ss.access = (saved_state[SMRAM_FIELD_P5_SS_ACCESS] >> 8) & 0xff;
|
|
|
|
|
/* The actual CPL (DPL of CS) is overwritten with DPL of SS. */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x60) | (cpu_state.seg_ss.access & 0x60);
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ss.ar_high = (saved_state[SMRAM_FIELD_P5_SS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ss);
|
|
|
|
|
|
|
|
|
|
/* FS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_fs.seg = saved_state[SMRAM_FIELD_P5_FS_SELECTOR];
|
|
|
|
|
cpu_state.seg_fs.base = saved_state[SMRAM_FIELD_P5_FS_BASE];
|
|
|
|
|
cpu_state.seg_fs.limit = saved_state[SMRAM_FIELD_P5_FS_LIMIT];
|
|
|
|
|
cpu_state.seg_fs.access = (saved_state[SMRAM_FIELD_P5_FS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_fs.ar_high = (saved_state[SMRAM_FIELD_P5_FS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_fs);
|
|
|
|
|
|
|
|
|
|
/* GS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_gs.seg = saved_state[SMRAM_FIELD_P5_GS_SELECTOR];
|
|
|
|
|
cpu_state.seg_gs.base = saved_state[SMRAM_FIELD_P5_GS_BASE];
|
|
|
|
|
cpu_state.seg_gs.limit = saved_state[SMRAM_FIELD_P5_GS_LIMIT];
|
|
|
|
|
cpu_state.seg_gs.access = (saved_state[SMRAM_FIELD_P5_GS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_gs.ar_high = (saved_state[SMRAM_FIELD_P5_GS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_gs);
|
|
|
|
|
|
|
|
|
|
if (SMM_REVISION_ID & SMM_SMBASE_RELOCATION)
|
2022-11-19 10:40:32 -05:00
|
|
|
smbase = saved_state[SMRAM_FIELD_P5_SMBASE_OFFSET];
|
2020-04-16 21:56:19 +02:00
|
|
|
|
|
|
|
|
/* Am486/5x86 stuff */
|
|
|
|
|
if (!is_pentium) {
|
2022-11-19 10:40:32 -05:00
|
|
|
cr2 = saved_state[SMRAM_FIELD_AM486_CR2];
|
|
|
|
|
dr[0] = saved_state[SMRAM_FIELD_AM486_DR0];
|
|
|
|
|
dr[1] = saved_state[SMRAM_FIELD_AM486_DR1];
|
|
|
|
|
dr[2] = saved_state[SMRAM_FIELD_AM486_DR2];
|
|
|
|
|
dr[3] = saved_state[SMRAM_FIELD_AM486_DR3];
|
2020-04-16 21:56:19 +02:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_save_state_p6(uint32_t *saved_state, int in_hlt)
|
|
|
|
|
{
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_SMM_REVISION_ID] = SMM_REVISION_ID;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_SMBASE_OFFSET] = smbase;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < 8; n++)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_EAX - n] = cpu_state.regs[n].l;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (in_hlt)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_AUTOHALT_RESTART] = 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_AUTOHALT_RESTART] = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P6_EIP] = cpu_state.pc;
|
|
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_EFLAGS] = (cpu_state.eflags << 16) | (cpu_state.flags);
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_CR0] = cr0;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_CR3] = cr3;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_CR4] = cr4;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_DR6] = dr[6];
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_DR7] = dr[7];
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_CPL] = CPL;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P6_A20M] = !mem_a20_state;
|
|
|
|
|
|
|
|
|
|
/* TR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_TR_SELECTOR] = tr.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_TR_BASE] = tr.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_TR_LIMIT] = tr.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P6_TR_SELECTOR_AR] = (tr.ar_high << 24) | (tr.access << 16) | tr.seg;
|
|
|
|
|
|
|
|
|
|
/* LDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_LDTR_SELECTOR] = ldt.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_LDTR_BASE] = ldt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_LDTR_LIMIT] = ldt.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P6_LDTR_SELECTOR_AR] = (ldt.ar_high << 24) | (ldt.access << 16) | ldt.seg;
|
|
|
|
|
|
|
|
|
|
/* IDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_IDTR_BASE] = idt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_IDTR_LIMIT] = idt.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P6_IDTR_SELECTOR_AR] = (idt.ar_high << 24) | (idt.access << 16) | idt.seg;
|
|
|
|
|
|
|
|
|
|
/* GDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_GDTR_BASE] = gdt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_GDTR_LIMIT] = gdt.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_P6_GDTR_SELECTOR_AR] = (gdt.ar_high << 24) | (gdt.access << 16) | gdt.seg;
|
|
|
|
|
|
|
|
|
|
/* ES */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_ES_SELECTOR] = cpu_state.seg_es.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_ES_BASE] = cpu_state.seg_es.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_ES_LIMIT] = cpu_state.seg_es.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_ES_SELECTOR_AR] = (cpu_state.seg_es.ar_high << 24) | (cpu_state.seg_es.access << 16) | cpu_state.seg_es.seg;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* CS */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_CS_SELECTOR] = cpu_state.seg_cs.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_CS_BASE] = cpu_state.seg_cs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_CS_LIMIT] = cpu_state.seg_cs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_CS_SELECTOR_AR] = (cpu_state.seg_cs.ar_high << 24) | (cpu_state.seg_cs.access << 16) | cpu_state.seg_cs.seg;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* DS */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_DS_SELECTOR] = cpu_state.seg_ds.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_DS_BASE] = cpu_state.seg_ds.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_DS_LIMIT] = cpu_state.seg_ds.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_DS_SELECTOR_AR] = (cpu_state.seg_ds.ar_high << 24) | (cpu_state.seg_ds.access << 16) | cpu_state.seg_ds.seg;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* SS */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_SS_SELECTOR] = cpu_state.seg_ss.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_SS_BASE] = cpu_state.seg_ss.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_SS_LIMIT] = cpu_state.seg_ss.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_SS_SELECTOR_AR] = (cpu_state.seg_ss.ar_high << 24) | (cpu_state.seg_ss.access << 16) | cpu_state.seg_ss.seg;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* FS */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_FS_SELECTOR] = cpu_state.seg_fs.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_FS_BASE] = cpu_state.seg_fs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_FS_LIMIT] = cpu_state.seg_fs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_FS_SELECTOR_AR] = (cpu_state.seg_fs.ar_high << 24) | (cpu_state.seg_fs.access << 16) | cpu_state.seg_fs.seg;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* GS */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_P6_GS_SELECTOR] = cpu_state.seg_gs.seg;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_GS_BASE] = cpu_state.seg_gs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_GS_LIMIT] = cpu_state.seg_gs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_P6_GS_SELECTOR_AR] = (cpu_state.seg_gs.ar_high << 24) | (cpu_state.seg_gs.access << 16) | cpu_state.seg_gs.seg;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_restore_state_p6(uint32_t *saved_state)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < 8; n++)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.regs[n].l = saved_state[SMRAM_FIELD_P6_EAX - n];
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (saved_state[SMRAM_FIELD_P6_AUTOHALT_RESTART] & 0xffff)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = saved_state[SMRAM_FIELD_P6_EIP] - 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = saved_state[SMRAM_FIELD_P6_EIP];
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
cpu_state.eflags = saved_state[SMRAM_FIELD_P6_EFLAGS] >> 16;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.flags = saved_state[SMRAM_FIELD_P6_EFLAGS] & 0xffff;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cr0 = saved_state[SMRAM_FIELD_P6_CR0];
|
|
|
|
|
cr3 = saved_state[SMRAM_FIELD_P6_CR3];
|
|
|
|
|
cr4 = saved_state[SMRAM_FIELD_P6_CR4];
|
2020-04-10 01:08:52 +02:00
|
|
|
dr[6] = saved_state[SMRAM_FIELD_P6_DR6];
|
|
|
|
|
dr[7] = saved_state[SMRAM_FIELD_P6_DR7];
|
|
|
|
|
|
|
|
|
|
/* TR */
|
2022-11-19 10:40:32 -05:00
|
|
|
tr.seg = saved_state[SMRAM_FIELD_P6_TR_SELECTOR];
|
|
|
|
|
tr.base = saved_state[SMRAM_FIELD_P6_TR_BASE];
|
|
|
|
|
tr.limit = saved_state[SMRAM_FIELD_P6_TR_LIMIT];
|
|
|
|
|
tr.access = (saved_state[SMRAM_FIELD_P6_TR_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
tr.ar_high = (saved_state[SMRAM_FIELD_P6_TR_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&tr);
|
|
|
|
|
|
|
|
|
|
/* LDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
ldt.seg = saved_state[SMRAM_FIELD_P6_LDTR_SELECTOR];
|
|
|
|
|
ldt.base = saved_state[SMRAM_FIELD_P6_LDTR_BASE];
|
|
|
|
|
ldt.limit = saved_state[SMRAM_FIELD_P6_LDTR_LIMIT];
|
|
|
|
|
ldt.access = (saved_state[SMRAM_FIELD_P6_LDTR_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
ldt.ar_high = (saved_state[SMRAM_FIELD_P6_LDTR_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&ldt);
|
|
|
|
|
|
|
|
|
|
/* IDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
idt.base = saved_state[SMRAM_FIELD_P6_IDTR_BASE];
|
|
|
|
|
idt.limit = saved_state[SMRAM_FIELD_P6_IDTR_LIMIT];
|
|
|
|
|
idt.access = (saved_state[SMRAM_FIELD_P6_IDTR_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
idt.ar_high = (saved_state[SMRAM_FIELD_P6_IDTR_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
|
|
|
|
|
/* GDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
gdt.base = saved_state[SMRAM_FIELD_P6_GDTR_BASE];
|
|
|
|
|
gdt.limit = saved_state[SMRAM_FIELD_P6_GDTR_LIMIT];
|
|
|
|
|
gdt.access = (saved_state[SMRAM_FIELD_P6_GDTR_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
gdt.ar_high = (saved_state[SMRAM_FIELD_P6_GDTR_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
|
|
|
|
|
/* ES */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_es.seg = saved_state[SMRAM_FIELD_P6_ES_SELECTOR];
|
|
|
|
|
cpu_state.seg_es.base = saved_state[SMRAM_FIELD_P6_ES_BASE];
|
|
|
|
|
cpu_state.seg_es.limit = saved_state[SMRAM_FIELD_P6_ES_LIMIT];
|
|
|
|
|
cpu_state.seg_es.access = (saved_state[SMRAM_FIELD_P6_ES_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_es.ar_high = (saved_state[SMRAM_FIELD_P6_ES_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_es);
|
|
|
|
|
|
|
|
|
|
/* CS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg = saved_state[SMRAM_FIELD_P6_CS_SELECTOR];
|
|
|
|
|
cpu_state.seg_cs.base = saved_state[SMRAM_FIELD_P6_CS_BASE];
|
|
|
|
|
cpu_state.seg_cs.limit = saved_state[SMRAM_FIELD_P6_CS_LIMIT];
|
|
|
|
|
cpu_state.seg_cs.access = (saved_state[SMRAM_FIELD_P6_CS_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_cs.ar_high = (saved_state[SMRAM_FIELD_P6_CS_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_cs);
|
|
|
|
|
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x60) | ((saved_state[SMRAM_FIELD_P6_CPL] & 0x03) << 5);
|
|
|
|
|
|
|
|
|
|
/* DS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ds.seg = saved_state[SMRAM_FIELD_P6_DS_SELECTOR];
|
|
|
|
|
cpu_state.seg_ds.base = saved_state[SMRAM_FIELD_P6_DS_BASE];
|
|
|
|
|
cpu_state.seg_ds.limit = saved_state[SMRAM_FIELD_P6_DS_LIMIT];
|
|
|
|
|
cpu_state.seg_ds.access = (saved_state[SMRAM_FIELD_P6_DS_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ds.ar_high = (saved_state[SMRAM_FIELD_P6_DS_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ds);
|
|
|
|
|
|
|
|
|
|
/* SS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.seg = saved_state[SMRAM_FIELD_P6_SS_SELECTOR];
|
|
|
|
|
cpu_state.seg_ss.base = saved_state[SMRAM_FIELD_P6_SS_BASE];
|
|
|
|
|
cpu_state.seg_ss.limit = saved_state[SMRAM_FIELD_P6_SS_LIMIT];
|
|
|
|
|
cpu_state.seg_ss.access = (saved_state[SMRAM_FIELD_P6_SS_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ss.ar_high = (saved_state[SMRAM_FIELD_P6_SS_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ss);
|
|
|
|
|
|
|
|
|
|
/* FS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_fs.seg = saved_state[SMRAM_FIELD_P6_FS_SELECTOR];
|
|
|
|
|
cpu_state.seg_fs.base = saved_state[SMRAM_FIELD_P6_FS_BASE];
|
|
|
|
|
cpu_state.seg_fs.limit = saved_state[SMRAM_FIELD_P6_FS_LIMIT];
|
|
|
|
|
cpu_state.seg_fs.access = (saved_state[SMRAM_FIELD_P6_FS_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_fs.ar_high = (saved_state[SMRAM_FIELD_P6_FS_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_fs);
|
|
|
|
|
|
|
|
|
|
/* GS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_gs.seg = saved_state[SMRAM_FIELD_P6_GS_SELECTOR];
|
|
|
|
|
cpu_state.seg_gs.base = saved_state[SMRAM_FIELD_P6_GS_BASE];
|
|
|
|
|
cpu_state.seg_gs.limit = saved_state[SMRAM_FIELD_P6_GS_LIMIT];
|
|
|
|
|
cpu_state.seg_gs.access = (saved_state[SMRAM_FIELD_P6_GS_SELECTOR_AR] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_gs.ar_high = (saved_state[SMRAM_FIELD_P6_GS_SELECTOR_AR] >> 24) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_gs);
|
|
|
|
|
|
2024-08-30 05:18:34 +02:00
|
|
|
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
|
|
|
|
if (is6117)
|
|
|
|
|
rammask |= 0x3000000;
|
|
|
|
|
|
2024-08-30 05:32:26 +02:00
|
|
|
if (saved_state[SMRAM_FIELD_P6_A20M] & 0x01)
|
2024-08-30 17:44:47 +02:00
|
|
|
rammask &= 0xffefffff;
|
2024-08-30 05:18:34 +02:00
|
|
|
|
|
|
|
|
flushmmucache();
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (SMM_REVISION_ID & SMM_SMBASE_RELOCATION)
|
2022-11-19 10:40:32 -05:00
|
|
|
smbase = saved_state[SMRAM_FIELD_P6_SMBASE_OFFSET];
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_save_state_amd_k(uint32_t *saved_state, int in_hlt)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_SMM_REVISION_ID] = SMM_REVISION_ID;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_SMBASE_OFFSET] = smbase;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < 8; n++)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_EAX - n] = cpu_state.regs[n].l;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (in_hlt)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_AUTOHALT_RESTART] = 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_AUTOHALT_RESTART] = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_EIP] = cpu_state.pc;
|
|
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_EFLAGS] = (cpu_state.eflags << 16) | (cpu_state.flags);
|
|
|
|
|
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CR0] = cr0;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CR2] = cr2;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CR3] = cr3;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CR4] = cr4;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_DR6] = dr[6];
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_DR7] = dr[7];
|
|
|
|
|
|
|
|
|
|
/* TR */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_TR_SELECTOR] = tr.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_TR_BASE] = tr.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_TR_LIMIT] = tr.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_TR_ACCESS] = (tr.ar_high << 16) | (tr.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* LDTR */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_LDTR_SELECTOR] = ldt.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_LDTR_BASE] = ldt.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_LDTR_LIMIT] = ldt.limit;
|
2020-04-10 01:08:52 +02:00
|
|
|
if (!is_k6)
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_LDTR_ACCESS] = (ldt.ar_high << 16) | (ldt.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* IDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_IDTR_BASE] = idt.base;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_IDTR_LIMIT] = idt.limit;
|
|
|
|
|
|
|
|
|
|
/* GDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_GDTR_BASE] = gdt.base;
|
2020-04-10 01:08:52 +02:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_GDTR_LIMIT] = gdt.limit;
|
|
|
|
|
|
|
|
|
|
/* ES */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_ES_SELECTOR] = cpu_state.seg_es.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_ES_BASE] = cpu_state.seg_es.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_ES_LIMIT] = cpu_state.seg_es.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_ES_ACCESS] = (cpu_state.seg_es.ar_high << 16) | (cpu_state.seg_es.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* CS */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CS_SELECTOR] = cpu_state.seg_cs.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CS_BASE] = cpu_state.seg_cs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CS_LIMIT] = cpu_state.seg_cs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_CS_ACCESS] = (cpu_state.seg_cs.ar_high << 16) | (cpu_state.seg_cs.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* DS */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_DS_SELECTOR] = cpu_state.seg_ds.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_DS_BASE] = cpu_state.seg_ds.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_DS_LIMIT] = cpu_state.seg_ds.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_DS_ACCESS] = (cpu_state.seg_ds.ar_high << 16) | (cpu_state.seg_ds.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* SS */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_SS_SELECTOR] = cpu_state.seg_ss.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_SS_BASE] = cpu_state.seg_ss.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_SS_LIMIT] = cpu_state.seg_ss.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_SS_ACCESS] = (cpu_state.seg_ss.ar_high << 16) | (cpu_state.seg_ss.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* FS */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_FS_SELECTOR] = cpu_state.seg_fs.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_FS_BASE] = cpu_state.seg_fs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_FS_LIMIT] = cpu_state.seg_fs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_FS_ACCESS] = (cpu_state.seg_fs.ar_high << 16) | (cpu_state.seg_fs.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* GS */
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_GS_SELECTOR] = cpu_state.seg_gs.seg;
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[SMRAM_FIELD_AMD_K_GS_BASE] = cpu_state.seg_gs.base;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_GS_LIMIT] = cpu_state.seg_gs.limit;
|
|
|
|
|
saved_state[SMRAM_FIELD_AMD_K_GS_ACCESS] = (cpu_state.seg_gs.ar_high << 16) | (cpu_state.seg_gs.access << 8);
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_restore_state_amd_k(uint32_t *saved_state)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < 8; n++)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.regs[n].l = saved_state[SMRAM_FIELD_AMD_K_EAX - n];
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (saved_state[SMRAM_FIELD_AMD_K_AUTOHALT_RESTART] & 0xffff)
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = saved_state[SMRAM_FIELD_AMD_K_EIP] - 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
else
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = saved_state[SMRAM_FIELD_AMD_K_EIP];
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
cpu_state.eflags = saved_state[SMRAM_FIELD_AMD_K_EFLAGS] >> 16;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.flags = saved_state[SMRAM_FIELD_AMD_K_EFLAGS] & 0xffff;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cr0 = saved_state[SMRAM_FIELD_AMD_K_CR0];
|
|
|
|
|
cr2 = saved_state[SMRAM_FIELD_AMD_K_CR2];
|
|
|
|
|
cr3 = saved_state[SMRAM_FIELD_AMD_K_CR3];
|
|
|
|
|
cr4 = saved_state[SMRAM_FIELD_AMD_K_CR4];
|
2020-04-10 01:08:52 +02:00
|
|
|
dr[6] = saved_state[SMRAM_FIELD_AMD_K_DR6];
|
|
|
|
|
dr[7] = saved_state[SMRAM_FIELD_AMD_K_DR7];
|
|
|
|
|
|
|
|
|
|
/* TR */
|
2022-11-19 10:40:32 -05:00
|
|
|
tr.seg = saved_state[SMRAM_FIELD_AMD_K_TR_SELECTOR];
|
|
|
|
|
tr.base = saved_state[SMRAM_FIELD_AMD_K_TR_BASE];
|
|
|
|
|
tr.limit = saved_state[SMRAM_FIELD_AMD_K_TR_LIMIT];
|
|
|
|
|
tr.access = (saved_state[SMRAM_FIELD_AMD_K_TR_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
tr.ar_high = (saved_state[SMRAM_FIELD_AMD_K_TR_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&tr);
|
|
|
|
|
|
|
|
|
|
/* LDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
ldt.seg = saved_state[SMRAM_FIELD_AMD_K_LDTR_SELECTOR];
|
|
|
|
|
ldt.base = saved_state[SMRAM_FIELD_AMD_K_LDTR_BASE];
|
2020-04-10 01:08:52 +02:00
|
|
|
ldt.limit = saved_state[SMRAM_FIELD_AMD_K_LDTR_LIMIT];
|
|
|
|
|
if (!is_k6) {
|
2022-11-19 10:40:32 -05:00
|
|
|
ldt.access = (saved_state[SMRAM_FIELD_AMD_K_LDTR_ACCESS] >> 8) & 0xff;
|
|
|
|
|
ldt.ar_high = (saved_state[SMRAM_FIELD_AMD_K_LDTR_ACCESS] >> 16) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
smm_seg_load(&ldt);
|
|
|
|
|
|
|
|
|
|
/* IDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
idt.base = saved_state[SMRAM_FIELD_AMD_K_IDTR_BASE];
|
2020-04-10 01:08:52 +02:00
|
|
|
idt.limit = saved_state[SMRAM_FIELD_AMD_K_IDTR_LIMIT];
|
|
|
|
|
|
|
|
|
|
/* GDTR */
|
2022-11-19 10:40:32 -05:00
|
|
|
gdt.base = saved_state[SMRAM_FIELD_AMD_K_GDTR_BASE];
|
2020-04-10 01:08:52 +02:00
|
|
|
gdt.limit = saved_state[SMRAM_FIELD_AMD_K_GDTR_LIMIT];
|
|
|
|
|
|
|
|
|
|
/* ES */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_es.seg = saved_state[SMRAM_FIELD_AMD_K_ES_SELECTOR];
|
|
|
|
|
cpu_state.seg_es.base = saved_state[SMRAM_FIELD_AMD_K_ES_BASE];
|
|
|
|
|
cpu_state.seg_es.limit = saved_state[SMRAM_FIELD_AMD_K_ES_LIMIT];
|
|
|
|
|
cpu_state.seg_es.access = (saved_state[SMRAM_FIELD_AMD_K_ES_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_es.ar_high = (saved_state[SMRAM_FIELD_AMD_K_ES_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_es);
|
|
|
|
|
|
|
|
|
|
/* CS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg = saved_state[SMRAM_FIELD_AMD_K_CS_SELECTOR];
|
|
|
|
|
cpu_state.seg_cs.base = saved_state[SMRAM_FIELD_AMD_K_CS_BASE];
|
|
|
|
|
cpu_state.seg_cs.limit = saved_state[SMRAM_FIELD_AMD_K_CS_LIMIT];
|
|
|
|
|
cpu_state.seg_cs.access = (saved_state[SMRAM_FIELD_AMD_K_CS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_cs.ar_high = (saved_state[SMRAM_FIELD_AMD_K_CS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_cs);
|
|
|
|
|
|
|
|
|
|
/* DS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ds.seg = saved_state[SMRAM_FIELD_AMD_K_DS_SELECTOR];
|
|
|
|
|
cpu_state.seg_ds.base = saved_state[SMRAM_FIELD_AMD_K_DS_BASE];
|
|
|
|
|
cpu_state.seg_ds.limit = saved_state[SMRAM_FIELD_AMD_K_DS_LIMIT];
|
|
|
|
|
cpu_state.seg_ds.access = (saved_state[SMRAM_FIELD_AMD_K_DS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ds.ar_high = (saved_state[SMRAM_FIELD_AMD_K_DS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ds);
|
|
|
|
|
|
|
|
|
|
/* SS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.seg = saved_state[SMRAM_FIELD_AMD_K_SS_SELECTOR];
|
|
|
|
|
cpu_state.seg_ss.base = saved_state[SMRAM_FIELD_AMD_K_SS_BASE];
|
|
|
|
|
cpu_state.seg_ss.limit = saved_state[SMRAM_FIELD_AMD_K_SS_LIMIT];
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ss.access = (saved_state[SMRAM_FIELD_AMD_K_SS_ACCESS] >> 8) & 0xff;
|
|
|
|
|
/* The actual CPL (DPL of CS) is overwritten with DPL of SS. */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x60) | (cpu_state.seg_ss.access & 0x60);
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_ss.ar_high = (saved_state[SMRAM_FIELD_AMD_K_SS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ss);
|
|
|
|
|
|
|
|
|
|
/* FS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_fs.seg = saved_state[SMRAM_FIELD_AMD_K_FS_SELECTOR];
|
|
|
|
|
cpu_state.seg_fs.base = saved_state[SMRAM_FIELD_AMD_K_FS_BASE];
|
|
|
|
|
cpu_state.seg_fs.limit = saved_state[SMRAM_FIELD_AMD_K_FS_LIMIT];
|
|
|
|
|
cpu_state.seg_fs.access = (saved_state[SMRAM_FIELD_AMD_K_FS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_fs.ar_high = (saved_state[SMRAM_FIELD_AMD_K_FS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_fs);
|
|
|
|
|
|
|
|
|
|
/* GS */
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_gs.seg = saved_state[SMRAM_FIELD_AMD_K_GS_SELECTOR];
|
|
|
|
|
cpu_state.seg_gs.base = saved_state[SMRAM_FIELD_AMD_K_GS_BASE];
|
|
|
|
|
cpu_state.seg_gs.limit = saved_state[SMRAM_FIELD_AMD_K_GS_LIMIT];
|
|
|
|
|
cpu_state.seg_gs.access = (saved_state[SMRAM_FIELD_AMD_K_GS_ACCESS] >> 8) & 0xff;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.seg_gs.ar_high = (saved_state[SMRAM_FIELD_AMD_K_GS_ACCESS] >> 16) & 0xff;
|
|
|
|
|
smm_seg_load(&cpu_state.seg_gs);
|
|
|
|
|
|
|
|
|
|
if (SMM_REVISION_ID & SMM_SMBASE_RELOCATION)
|
2022-11-19 10:40:32 -05:00
|
|
|
smbase = saved_state[SMRAM_FIELD_AMD_K_SMBASE_OFFSET];
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-16 00:01:21 +01:00
|
|
|
static void
|
2025-03-17 03:40:52 +01:00
|
|
|
smram_save_state_cyrix(uint32_t *saved_state, int in_hlt)
|
2020-11-16 00:01:21 +01:00
|
|
|
{
|
|
|
|
|
saved_state[0] = dr[7];
|
|
|
|
|
saved_state[1] = cpu_state.flags | (cpu_state.eflags << 16);
|
|
|
|
|
saved_state[2] = cr0;
|
|
|
|
|
saved_state[3] = cpu_state.oldpc;
|
|
|
|
|
saved_state[4] = cpu_state.pc;
|
|
|
|
|
saved_state[5] = CS | (CPL << 21);
|
|
|
|
|
saved_state[6] = 0x00000000;
|
2025-03-17 03:40:52 +01:00
|
|
|
saved_state[7] = 0x00010000;
|
|
|
|
|
|
|
|
|
|
if (((opcode >= 0x6e) && (opcode <= 0x6f)) || ((opcode >= 0xe6) && (opcode <= 0xe7)) ||
|
|
|
|
|
((opcode >= 0xee) && (opcode <= 0xef))) {
|
|
|
|
|
saved_state[6] |= 0x00000002;
|
|
|
|
|
saved_state[7] = (opcode & 0x01) ? (cpu_state.op32 ? 0x000f0000 : 0x00030000) : 0x00010000;
|
|
|
|
|
} else if (((opcode == 0xf2) || (opcode == 0xf3)) && (rep_op >= 0x6e) && (rep_op <= 0x6f)) {
|
|
|
|
|
saved_state[6] |= 0x00000006;
|
|
|
|
|
saved_state[7] = (rep_op & 0x01) ? (cpu_state.op32 ? 0x000f0000 : 0x00030000) : 0x00010000;
|
|
|
|
|
} else if (((opcode == 0xf2) || (opcode == 0xf3)) && (rep_op >= 0x6e) && (rep_op <= 0x6f)) {
|
|
|
|
|
saved_state[6] |= 0x00000004;
|
|
|
|
|
saved_state[7] = (rep_op & 0x01) ? (cpu_state.op32 ? 0x000f0000 : 0x00030000) : 0x00010000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_smint) {
|
|
|
|
|
saved_state[6] |= 0x00000008;
|
|
|
|
|
is_smint = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (in_hlt)
|
|
|
|
|
saved_state[6] |= 0x00000010;
|
|
|
|
|
|
|
|
|
|
saved_state[7] |= io_port;
|
|
|
|
|
saved_state[8] = io_val;
|
|
|
|
|
|
|
|
|
|
if (saved_state[6] & 0x00000002)
|
|
|
|
|
saved_state[9] = ESI;
|
|
|
|
|
else
|
|
|
|
|
saved_state[9] = EDI;
|
2020-11-16 00:01:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
smram_restore_state_cyrix(uint32_t *saved_state)
|
|
|
|
|
{
|
2022-11-19 10:40:32 -05:00
|
|
|
dr[7] = saved_state[0];
|
|
|
|
|
cpu_state.flags = saved_state[1] & 0xffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.eflags = saved_state[1] >> 16;
|
2022-11-19 10:40:32 -05:00
|
|
|
cr0 = saved_state[2];
|
|
|
|
|
cpu_state.pc = saved_state[4];
|
2025-03-17 03:40:52 +01:00
|
|
|
/* Restore CPL. */
|
|
|
|
|
cpu_state.seg_cs.access = (cpu_state.seg_cs.access & ~0x9f) | (((saved_state[5] >> 21) & 0x03) << 5);
|
|
|
|
|
|
|
|
|
|
if (saved_state[6] & 0x00000002)
|
|
|
|
|
ESI = saved_state[9];
|
|
|
|
|
else
|
|
|
|
|
EDI = saved_state[9];
|
2020-11-16 00:01:21 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
void
|
|
|
|
|
enter_smm(int in_hlt)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
uint32_t saved_state[SMM_SAVE_STATE_MAP_SIZE];
|
2020-04-10 01:08:52 +02:00
|
|
|
uint32_t smram_state = smbase + 0x10000;
|
|
|
|
|
|
2020-11-16 17:47:05 +01:00
|
|
|
/* If it's a CPU on which SMM is not supported, do nothing. */
|
2021-04-11 07:25:08 +02:00
|
|
|
if (!is_am486 && !is_pentium && !is_k5 && !is_k6 && !is_p6 && !is_cxsmm)
|
2022-11-19 10:40:32 -05:00
|
|
|
return;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
x386_common_log("enter_smm(): smbase = %08X\n", smbase);
|
|
|
|
|
x386_common_log("CS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low,
|
|
|
|
|
cpu_state.seg_cs.limit_high, cpu_state.seg_cs.access, cpu_state.seg_cs.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("DS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ds.seg, cpu_state.seg_ds.base, cpu_state.seg_ds.limit, cpu_state.seg_ds.limit_low,
|
|
|
|
|
cpu_state.seg_ds.limit_high, cpu_state.seg_ds.access, cpu_state.seg_ds.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("ES : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_es.seg, cpu_state.seg_es.base, cpu_state.seg_es.limit, cpu_state.seg_es.limit_low,
|
|
|
|
|
cpu_state.seg_es.limit_high, cpu_state.seg_es.access, cpu_state.seg_es.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("FS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_fs.seg, cpu_state.seg_fs.base, cpu_state.seg_fs.limit, cpu_state.seg_fs.limit_low,
|
|
|
|
|
cpu_state.seg_fs.limit_high, cpu_state.seg_fs.access, cpu_state.seg_fs.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("GS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_gs.seg, cpu_state.seg_gs.base, cpu_state.seg_gs.limit, cpu_state.seg_gs.limit_low,
|
|
|
|
|
cpu_state.seg_gs.limit_high, cpu_state.seg_gs.access, cpu_state.seg_gs.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("SS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.seg, cpu_state.seg_ss.base, cpu_state.seg_ss.limit, cpu_state.seg_ss.limit_low,
|
|
|
|
|
cpu_state.seg_ss.limit_high, cpu_state.seg_ss.access, cpu_state.seg_ss.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("TR : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
tr.seg, tr.base, tr.limit, tr.limit_low, tr.limit_high, tr.access, tr.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("LDT: seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
ldt.seg, ldt.base, ldt.limit, ldt.limit_low, ldt.limit_high, ldt.access, ldt.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("GDT: seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
gdt.seg, gdt.base, gdt.limit, gdt.limit_low, gdt.limit_high, gdt.access, gdt.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("IDT: seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
idt.seg, idt.base, idt.limit, idt.limit_low, idt.limit_high, idt.access, idt.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("CR0 = %08X, CR3 = %08X, CR4 = %08X, DR6 = %08X, DR7 = %08X\n", cr0, cr3, cr4, dr[6], dr[7]);
|
|
|
|
|
x386_common_log("EIP = %08X, EFLAGS = %04X%04X\n", cpu_state.pc, cpu_state.eflags, cpu_state.flags);
|
|
|
|
|
x386_common_log("EAX = %08X, EBX = %08X, ECX = %08X, EDX = %08X, ESI = %08X, EDI = %08X, ESP = %08X, EBP = %08X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2021-04-21 01:09:48 +02:00
|
|
|
flags_rebuild();
|
2020-04-10 01:08:52 +02:00
|
|
|
in_smm = 1;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
smram_backup_all();
|
|
|
|
|
smram_recalc_all(0);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2021-04-11 07:25:08 +02:00
|
|
|
if (is_cxsmm) {
|
2022-11-19 10:40:32 -05:00
|
|
|
if (!(cyrix.smhr & SMHR_VALID))
|
|
|
|
|
cyrix.smhr = (cyrix.arr[3].base + cyrix.arr[3].size) | SMHR_VALID;
|
|
|
|
|
smram_state = cyrix.smhr & SMHR_ADDR_MASK;
|
2020-11-16 00:01:21 +01:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
memset(saved_state, 0x00, SMM_SAVE_STATE_MAP_SIZE * sizeof(uint32_t));
|
|
|
|
|
|
2023-08-11 13:00:04 -04:00
|
|
|
if (is_cxsmm) /* Cx6x86 */
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_save_state_cyrix(saved_state, in_hlt);
|
|
|
|
|
else if (is_pentium || is_am486) /* Am486 / 5x86 / Intel P5 (Pentium) */
|
|
|
|
|
smram_save_state_p5(saved_state, in_hlt);
|
2023-08-11 13:00:04 -04:00
|
|
|
else if (is_k5 || is_k6) /* AMD K5 and K6 */
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_save_state_amd_k(saved_state, in_hlt);
|
2023-08-11 13:00:04 -04:00
|
|
|
else if (is_p6) /* Intel P6 (Pentium Pro, Pentium II, Celeron) */
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_save_state_p6(saved_state, in_hlt);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
cr0 &= ~0x8000000d;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.flags = 2;
|
2020-04-10 01:08:52 +02:00
|
|
|
cpu_state.eflags = 0;
|
|
|
|
|
|
|
|
|
|
cr4 = 0;
|
2020-04-28 01:01:39 +02:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
dr[7] = 0x400;
|
|
|
|
|
|
2021-04-11 07:25:08 +02:00
|
|
|
if (is_cxsmm) {
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = 0x0000;
|
|
|
|
|
cpl_override = 1;
|
2023-08-21 02:56:33 +02:00
|
|
|
if (is486)
|
|
|
|
|
cyrix_write_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs);
|
|
|
|
|
else
|
|
|
|
|
cyrix_write_seg_descriptor_2386(smram_state - 0x20, &cpu_state.seg_cs);
|
2022-11-19 10:40:32 -05:00
|
|
|
cpl_override = 0;
|
|
|
|
|
cpu_state.seg_cs.seg = (cyrix.arr[3].base >> 4);
|
|
|
|
|
cpu_state.seg_cs.base = cyrix.arr[3].base;
|
|
|
|
|
cpu_state.seg_cs.limit = 0xffffffff;
|
|
|
|
|
cpu_state.seg_cs.access = 0x93;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0x80;
|
|
|
|
|
cpu_state.seg_cs.checked = 1;
|
|
|
|
|
|
|
|
|
|
smm_seg_load(&cpu_state.seg_cs);
|
2020-11-16 00:01:21 +01:00
|
|
|
} else {
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = 0x8000;
|
|
|
|
|
cpu_state.seg_ds.seg = 0x00000000;
|
|
|
|
|
cpu_state.seg_ds.base = 0x00000000;
|
|
|
|
|
cpu_state.seg_ds.limit = 0xffffffff;
|
|
|
|
|
cpu_state.seg_ds.access = 0x93;
|
|
|
|
|
cpu_state.seg_ds.ar_high = 0x80;
|
|
|
|
|
|
|
|
|
|
memcpy(&cpu_state.seg_es, &cpu_state.seg_ds, sizeof(x86seg));
|
|
|
|
|
memcpy(&cpu_state.seg_ss, &cpu_state.seg_ds, sizeof(x86seg));
|
|
|
|
|
memcpy(&cpu_state.seg_fs, &cpu_state.seg_ds, sizeof(x86seg));
|
|
|
|
|
memcpy(&cpu_state.seg_gs, &cpu_state.seg_ds, sizeof(x86seg));
|
|
|
|
|
|
|
|
|
|
if (is_p6)
|
|
|
|
|
cpu_state.seg_cs.seg = (smbase >> 4);
|
|
|
|
|
else
|
|
|
|
|
cpu_state.seg_cs.seg = 0x3000;
|
|
|
|
|
|
|
|
|
|
/* On Pentium, CS selector in SMM is always 3000, regardless of SMBASE. */
|
|
|
|
|
cpu_state.seg_cs.base = smbase;
|
|
|
|
|
cpu_state.seg_cs.limit = 0xffffffff;
|
|
|
|
|
cpu_state.seg_cs.access = 0x93;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0x80;
|
|
|
|
|
cpu_state.seg_cs.checked = 1;
|
|
|
|
|
|
|
|
|
|
smm_seg_load(&cpu_state.seg_es);
|
|
|
|
|
smm_seg_load(&cpu_state.seg_cs);
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ds);
|
|
|
|
|
smm_seg_load(&cpu_state.seg_ss);
|
|
|
|
|
smm_seg_load(&cpu_state.seg_fs);
|
|
|
|
|
smm_seg_load(&cpu_state.seg_gs);
|
2020-11-16 00:01:21 +01:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
cpu_state.op32 = use32;
|
|
|
|
|
|
2020-11-16 00:01:21 +01:00
|
|
|
cpl_override = 1;
|
2021-04-11 07:25:08 +02:00
|
|
|
if (is_cxsmm) {
|
2022-11-19 10:40:32 -05:00
|
|
|
writememl(0, smram_state - 0x04, saved_state[0]);
|
|
|
|
|
writememl(0, smram_state - 0x08, saved_state[1]);
|
|
|
|
|
writememl(0, smram_state - 0x0c, saved_state[2]);
|
|
|
|
|
writememl(0, smram_state - 0x10, saved_state[3]);
|
|
|
|
|
writememl(0, smram_state - 0x14, saved_state[4]);
|
|
|
|
|
writememl(0, smram_state - 0x18, saved_state[5]);
|
|
|
|
|
writememl(0, smram_state - 0x24, saved_state[6]);
|
2025-03-17 03:40:52 +01:00
|
|
|
writememl(0, smram_state - 0x28, saved_state[7]);
|
|
|
|
|
writememl(0, smram_state - 0x2c, saved_state[8]);
|
|
|
|
|
writememl(0, smram_state - 0x30, saved_state[9]);
|
2020-11-16 00:01:21 +01:00
|
|
|
} else {
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) {
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_state -= 4;
|
|
|
|
|
writememl(0, smram_state, saved_state[n]);
|
|
|
|
|
}
|
2020-04-28 01:01:39 +02:00
|
|
|
}
|
2020-11-16 00:01:21 +01:00
|
|
|
cpl_override = 0;
|
2020-04-28 01:01:39 +02:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
nmi_mask = 0;
|
|
|
|
|
|
|
|
|
|
if (smi_latched) {
|
2022-11-19 10:40:32 -05:00
|
|
|
in_smm = 2;
|
|
|
|
|
smi_latched = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
} else
|
2022-11-19 10:40:32 -05:00
|
|
|
in_smm = 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
smm_in_hlt = in_hlt;
|
|
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
if (unmask_a20_in_smm) {
|
2022-11-19 10:40:32 -05:00
|
|
|
old_rammask = rammask;
|
|
|
|
|
rammask = cpu_16bitbus ? 0xFFFFFF : 0xFFFFFFFF;
|
|
|
|
|
if (is6117)
|
|
|
|
|
rammask |= 0x3000000;
|
2020-06-29 01:10:20 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
flushmmucache();
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
2022-02-20 02:26:27 -05:00
|
|
|
|
2020-12-01 21:06:01 +01:00
|
|
|
oldcpl = 0;
|
2020-06-29 01:10:20 +02:00
|
|
|
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_cur_status &= ~(CPU_STATUS_PMODE | CPU_STATUS_V86);
|
2020-04-10 01:08:52 +02:00
|
|
|
CPU_BLOCK_END();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
enter_smm_check(int in_hlt)
|
|
|
|
|
{
|
2025-03-19 03:12:36 +01:00
|
|
|
uint8_t ccr1_check = ((ccr1 & (CCR1_USE_SMI | CCR1_SMAC | CCR1_SM3)) ==
|
|
|
|
|
(CCR1_USE_SMI | CCR1_SM3)) && (cyrix.arr[3].size > 0);
|
|
|
|
|
|
|
|
|
|
if (smi_line) {
|
|
|
|
|
if (!is_cxsmm || ccr1_check) switch (in_smm) {
|
|
|
|
|
default:
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2025-03-19 03:12:36 +01:00
|
|
|
fatal("SMI while in_smm = %i\n", in_smm);
|
|
|
|
|
break;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
#endif
|
2025-03-19 03:12:36 +01:00
|
|
|
case 0:
|
2020-04-10 01:08:52 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2025-03-19 03:12:36 +01:00
|
|
|
x386_common_log("SMI while not in SMM\n");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2025-03-19 03:12:36 +01:00
|
|
|
enter_smm(in_hlt);
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
/* Mark this so that we don't latch more than one SMI. */
|
2020-04-10 01:08:52 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2025-03-19 03:12:36 +01:00
|
|
|
x386_common_log("SMI while in unlatched SMM\n");
|
|
|
|
|
#endif
|
|
|
|
|
smi_latched = 1;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SMI while in latched SMM\n");
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
else {
|
|
|
|
|
x386_common_log("SMI while in Cyrix disabled mode\n");
|
|
|
|
|
x386_common_log("lol\n");
|
|
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
smi_line = 0;
|
2025-03-19 03:12:36 +01:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
leave_smm(void)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
uint32_t saved_state[SMM_SAVE_STATE_MAP_SIZE];
|
2020-04-10 01:08:52 +02:00
|
|
|
uint32_t smram_state = smbase + 0x10000;
|
|
|
|
|
|
|
|
|
|
/* If it's a CPU on which SMM is not supported (or not implemented in 86Box), do nothing. */
|
2021-04-11 07:25:08 +02:00
|
|
|
if (!is_am486 && !is_pentium && !is_k5 && !is_k6 && !is_p6 && !is_cxsmm)
|
2022-11-19 10:40:32 -05:00
|
|
|
return;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
memset(saved_state, 0x00, SMM_SAVE_STATE_MAP_SIZE * sizeof(uint32_t));
|
|
|
|
|
|
2020-11-16 00:01:21 +01:00
|
|
|
cpl_override = 1;
|
2021-04-11 07:25:08 +02:00
|
|
|
if (is_cxsmm) {
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_state = cyrix.smhr & SMHR_ADDR_MASK;
|
|
|
|
|
saved_state[0] = readmeml(0, smram_state - 0x04);
|
|
|
|
|
saved_state[1] = readmeml(0, smram_state - 0x08);
|
|
|
|
|
saved_state[2] = readmeml(0, smram_state - 0x0c);
|
|
|
|
|
saved_state[3] = readmeml(0, smram_state - 0x10);
|
|
|
|
|
saved_state[4] = readmeml(0, smram_state - 0x14);
|
|
|
|
|
saved_state[5] = readmeml(0, smram_state - 0x18);
|
2023-08-21 02:56:33 +02:00
|
|
|
if (is486)
|
|
|
|
|
cyrix_load_seg_descriptor(smram_state - 0x20, &cpu_state.seg_cs);
|
|
|
|
|
else
|
|
|
|
|
cyrix_load_seg_descriptor_2386(smram_state - 0x20, &cpu_state.seg_cs);
|
2022-11-19 10:40:32 -05:00
|
|
|
saved_state[6] = readmeml(0, smram_state - 0x24);
|
2025-03-17 03:40:52 +01:00
|
|
|
saved_state[7] = readmeml(0, smram_state - 0x28);
|
|
|
|
|
saved_state[8] = readmeml(0, smram_state - 0x2c);
|
|
|
|
|
saved_state[9] = readmeml(0, smram_state - 0x30);
|
2020-11-16 00:01:21 +01:00
|
|
|
} else {
|
2023-08-10 15:43:16 -04:00
|
|
|
for (uint8_t n = 0; n < SMM_SAVE_STATE_MAP_SIZE; n++) {
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_state -= 4;
|
|
|
|
|
saved_state[n] = readmeml(0, smram_state);
|
|
|
|
|
x386_common_log("Reading %08X from memory at %08X to array element %i\n", saved_state[n], smram_state, n);
|
|
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
2020-11-16 00:01:21 +01:00
|
|
|
cpl_override = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2020-06-29 01:10:20 +02:00
|
|
|
if (unmask_a20_in_smm) {
|
2022-11-19 10:40:32 -05:00
|
|
|
rammask = old_rammask;
|
2020-06-29 01:10:20 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
flushmmucache();
|
2020-06-29 01:10:20 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("New SMBASE: %08X (%08X)\n", saved_state[SMRAM_FIELD_P5_SMBASE_OFFSET], saved_state[66]);
|
2023-08-11 13:00:04 -04:00
|
|
|
if (is_cxsmm) /* Cx6x86 */
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_restore_state_cyrix(saved_state);
|
|
|
|
|
else if (is_pentium || is_am486) /* Am486 / 5x86 / Intel P5 (Pentium) */
|
|
|
|
|
smram_restore_state_p5(saved_state);
|
2023-08-11 13:00:04 -04:00
|
|
|
else if (is_k5 || is_k6) /* AMD K5 and K6 */
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_restore_state_amd_k(saved_state);
|
2023-08-11 13:00:04 -04:00
|
|
|
else if (is_p6) /* Intel P6 (Pentium Pro, Pentium II, Celeron) */
|
2022-11-19 10:40:32 -05:00
|
|
|
smram_restore_state_p6(saved_state);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
in_smm = 0;
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
smram_recalc_all(1);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_386_flags_extract();
|
|
|
|
|
cpu_cur_status &= ~(CPU_STATUS_PMODE | CPU_STATUS_V86);
|
|
|
|
|
if (cr0 & 1) {
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status |= CPU_STATUS_PMODE;
|
|
|
|
|
if (cpu_state.eflags & VM_FLAG)
|
|
|
|
|
cpu_cur_status |= CPU_STATUS_V86;
|
2020-11-16 00:01:21 +01:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
nmi_mask = 1;
|
|
|
|
|
|
2020-12-01 21:06:01 +01:00
|
|
|
oldcpl = CPL;
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
CPU_BLOCK_END();
|
|
|
|
|
|
|
|
|
|
x386_common_log("CS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low,
|
|
|
|
|
cpu_state.seg_cs.limit_high, cpu_state.seg_cs.access, cpu_state.seg_cs.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("DS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ds.seg, cpu_state.seg_ds.base, cpu_state.seg_ds.limit, cpu_state.seg_ds.limit_low,
|
|
|
|
|
cpu_state.seg_ds.limit_high, cpu_state.seg_ds.access, cpu_state.seg_ds.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("ES : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_es.seg, cpu_state.seg_es.base, cpu_state.seg_es.limit, cpu_state.seg_es.limit_low,
|
|
|
|
|
cpu_state.seg_es.limit_high, cpu_state.seg_es.access, cpu_state.seg_es.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("FS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_fs.seg, cpu_state.seg_fs.base, cpu_state.seg_fs.limit, cpu_state.seg_fs.limit_low,
|
|
|
|
|
cpu_state.seg_fs.limit_high, cpu_state.seg_fs.access, cpu_state.seg_fs.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("GS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_gs.seg, cpu_state.seg_gs.base, cpu_state.seg_gs.limit, cpu_state.seg_gs.limit_low,
|
|
|
|
|
cpu_state.seg_gs.limit_high, cpu_state.seg_gs.access, cpu_state.seg_gs.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("SS : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.seg, cpu_state.seg_ss.base, cpu_state.seg_ss.limit, cpu_state.seg_ss.limit_low,
|
|
|
|
|
cpu_state.seg_ss.limit_high, cpu_state.seg_ss.access, cpu_state.seg_ss.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("TR : seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
tr.seg, tr.base, tr.limit, tr.limit_low, tr.limit_high, tr.access, tr.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("LDT: seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
ldt.seg, ldt.base, ldt.limit, ldt.limit_low, ldt.limit_high, ldt.access, ldt.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("GDT: seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
gdt.seg, gdt.base, gdt.limit, gdt.limit_low, gdt.limit_high, gdt.access, gdt.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("IDT: seg = %04X, base = %08X, limit = %08X, limit_low = %08X, limit_high = %08X, access = %02X, ar_high = %02X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
idt.seg, idt.base, idt.limit, idt.limit_low, idt.limit_high, idt.access, idt.ar_high);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("CR0 = %08X, CR3 = %08X, CR4 = %08X, DR6 = %08X, DR7 = %08X\n", cr0, cr3, cr4, dr[6], dr[7]);
|
|
|
|
|
x386_common_log("EIP = %08X, EFLAGS = %04X%04X\n", cpu_state.pc, cpu_state.eflags, cpu_state.flags);
|
|
|
|
|
x386_common_log("EAX = %08X, EBX = %08X, ECX = %08X, EDX = %08X, ESI = %08X, EDI = %08X, ESP = %08X, EBP = %08X\n",
|
2022-11-19 10:40:32 -05:00
|
|
|
EAX, EBX, ECX, EDX, ESI, EDI, ESP, EBP);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log("leave_smm()\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
x86_int(int num)
|
|
|
|
|
{
|
|
|
|
|
uint32_t addr;
|
|
|
|
|
|
|
|
|
|
flags_rebuild();
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = cpu_state.oldpc;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
if (msw & 1)
|
2024-02-09 12:14:35 +01:00
|
|
|
cpu_use_exec ? pmodeint(num, 0) : pmodeint_2386(num, 0);
|
2020-04-10 01:08:52 +02:00
|
|
|
else {
|
2022-11-19 10:40:32 -05:00
|
|
|
addr = (num << 2) + idt.base;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
if ((num << 2UL) + 3UL > idt.limit) {
|
|
|
|
|
if (idt.limit < 35) {
|
|
|
|
|
cpu_state.abrt = 0;
|
|
|
|
|
softresetx86();
|
|
|
|
|
cpu_set_edx();
|
2020-04-10 01:08:52 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("Triple fault in real mode - reset\n");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
} else
|
|
|
|
|
x86_int(8);
|
|
|
|
|
} else {
|
|
|
|
|
if (stack32) {
|
|
|
|
|
writememw(ss, ESP - 2, cpu_state.flags);
|
|
|
|
|
writememw(ss, ESP - 4, CS);
|
|
|
|
|
writememw(ss, ESP - 6, cpu_state.pc);
|
|
|
|
|
ESP -= 6;
|
|
|
|
|
} else {
|
|
|
|
|
writememw(ss, ((SP - 2) & 0xFFFF), cpu_state.flags);
|
|
|
|
|
writememw(ss, ((SP - 4) & 0xFFFF), CS);
|
|
|
|
|
writememw(ss, ((SP - 6) & 0xFFFF), cpu_state.pc);
|
|
|
|
|
SP -= 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cpu_state.flags &= ~I_FLAG;
|
|
|
|
|
cpu_state.flags &= ~T_FLAG;
|
2020-02-29 19:12:23 +01:00
|
|
|
#ifndef USE_NEW_DYNAREC
|
2022-11-19 10:40:32 -05:00
|
|
|
oxpc = cpu_state.pc;
|
2020-02-29 19:12:23 +01:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = readmemw(0, addr);
|
2024-02-09 12:14:35 +01:00
|
|
|
cpu_use_exec ? loadcs(readmemw(0, addr + 2)) : loadcs_2386(readmemw(0, addr + 2));
|
2022-11-19 10:40:32 -05:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cycles -= 70;
|
|
|
|
|
CPU_BLOCK_END();
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
void
|
|
|
|
|
x86_int_sw(int num)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
uint32_t addr;
|
|
|
|
|
|
|
|
|
|
flags_rebuild();
|
|
|
|
|
cycles -= timing_int;
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
if (msw & 1)
|
2024-02-09 12:14:35 +01:00
|
|
|
cpu_use_exec ? pmodeint(num, 1) : pmodeint_2386(num, 1);
|
2020-04-10 01:08:52 +02:00
|
|
|
else {
|
2022-11-19 10:40:32 -05:00
|
|
|
addr = (num << 2) + idt.base;
|
|
|
|
|
|
|
|
|
|
if ((num << 2UL) + 3UL > idt.limit)
|
|
|
|
|
x86_int(0x0d);
|
|
|
|
|
else {
|
|
|
|
|
if (stack32) {
|
|
|
|
|
writememw(ss, ESP - 2, cpu_state.flags);
|
|
|
|
|
writememw(ss, ESP - 4, CS);
|
|
|
|
|
writememw(ss, ESP - 6, cpu_state.pc);
|
|
|
|
|
ESP -= 6;
|
|
|
|
|
} else {
|
|
|
|
|
writememw(ss, ((SP - 2) & 0xFFFF), cpu_state.flags);
|
|
|
|
|
writememw(ss, ((SP - 4) & 0xFFFF), CS);
|
|
|
|
|
writememw(ss, ((SP - 6) & 0xFFFF), cpu_state.pc);
|
|
|
|
|
SP -= 6;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cpu_state.flags &= ~I_FLAG;
|
|
|
|
|
cpu_state.flags &= ~T_FLAG;
|
2020-02-29 19:12:23 +01:00
|
|
|
#ifndef USE_NEW_DYNAREC
|
2022-11-19 10:40:32 -05:00
|
|
|
oxpc = cpu_state.pc;
|
2020-02-29 19:12:23 +01:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = readmemw(0, addr);
|
2024-02-09 12:14:35 +01:00
|
|
|
cpu_use_exec ? loadcs(readmemw(0, addr + 2)) : loadcs_2386(readmemw(0, addr + 2));
|
2022-11-19 10:40:32 -05:00
|
|
|
cycles -= timing_int_rm;
|
|
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2024-02-19 15:20:59 +01:00
|
|
|
if (cpu_use_exec)
|
|
|
|
|
trap = 0;
|
|
|
|
|
else
|
|
|
|
|
trap &= ~1;
|
2020-04-10 01:08:52 +02:00
|
|
|
CPU_BLOCK_END();
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
int
|
|
|
|
|
x86_int_sw_rm(int num)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
uint32_t addr;
|
2023-08-10 15:43:16 -04:00
|
|
|
uint16_t new_pc;
|
|
|
|
|
uint16_t new_cs;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
flags_rebuild();
|
|
|
|
|
cycles -= timing_int;
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
addr = num << 2;
|
2020-04-10 01:08:52 +02:00
|
|
|
new_pc = readmemw(0, addr);
|
|
|
|
|
new_cs = readmemw(0, addr + 2);
|
|
|
|
|
|
|
|
|
|
if (cpu_state.abrt)
|
2022-11-19 10:40:32 -05:00
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
writememw(ss, ((SP - 2) & 0xFFFF), cpu_state.flags);
|
|
|
|
|
|
|
|
|
|
if (cpu_state.abrt)
|
2022-11-19 10:40:32 -05:00
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
writememw(ss, ((SP - 4) & 0xFFFF), CS);
|
|
|
|
|
writememw(ss, ((SP - 6) & 0xFFFF), cpu_state.pc);
|
|
|
|
|
|
|
|
|
|
if (cpu_state.abrt)
|
2022-11-19 10:40:32 -05:00
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
SP -= 6;
|
|
|
|
|
|
|
|
|
|
cpu_state.eflags &= ~VIF_FLAG;
|
|
|
|
|
cpu_state.flags &= ~T_FLAG;
|
|
|
|
|
cpu_state.pc = new_pc;
|
2024-02-09 12:14:35 +01:00
|
|
|
cpu_use_exec ? loadcs(new_cs) : loadcs_2386(new_cs);
|
2020-02-29 19:12:23 +01:00
|
|
|
#ifndef USE_NEW_DYNAREC
|
2020-04-10 01:08:52 +02:00
|
|
|
oxpc = cpu_state.pc;
|
2020-02-29 19:12:23 +01:00
|
|
|
#endif
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
cycles -= timing_int_rm;
|
2024-02-19 15:20:59 +01:00
|
|
|
if (cpu_use_exec)
|
|
|
|
|
trap = 0;
|
|
|
|
|
else
|
|
|
|
|
trap &= ~1;
|
2020-04-10 01:08:52 +02:00
|
|
|
CPU_BLOCK_END();
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
return 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
void
|
2022-11-17 22:44:06 +01:00
|
|
|
x86illegal(void)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
x86_int(6);
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
int
|
2023-04-22 18:41:42 -03:00
|
|
|
checkio(uint32_t port, int mask)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2023-04-22 22:28:18 -03:00
|
|
|
uint32_t t;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2024-02-22 00:56:28 +01:00
|
|
|
if (!(tr.access & 0x08)) {
|
|
|
|
|
if ((CPL) > (IOPL))
|
|
|
|
|
return 1;
|
|
|
|
|
|
2024-02-19 19:09:35 +01:00
|
|
|
return 0;
|
2024-02-22 00:56:28 +01:00
|
|
|
}
|
2024-02-19 19:09:35 +01:00
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
cpl_override = 1;
|
2022-11-19 10:40:32 -05:00
|
|
|
t = readmemw(tr.base, 0x66);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-04-22 22:28:18 -03:00
|
|
|
if (UNLIKELY(cpu_state.abrt)) {
|
2023-04-22 18:41:42 -03:00
|
|
|
cpl_override = 0;
|
2022-11-19 10:40:32 -05:00
|
|
|
return 0;
|
2023-04-22 18:41:42 -03:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2023-04-22 22:28:18 -03:00
|
|
|
t += (port >> 3UL);
|
|
|
|
|
mask <<= (port & 7);
|
|
|
|
|
if (UNLIKELY(mask & 0xff00)) {
|
|
|
|
|
if (LIKELY(t < tr.limit))
|
|
|
|
|
mask &= readmemwl(tr.base + t);
|
|
|
|
|
} else {
|
|
|
|
|
if (LIKELY(t <= tr.limit))
|
|
|
|
|
mask &= readmembl(tr.base + t);
|
2023-04-22 18:41:42 -03:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
cpl_override = 0;
|
2023-04-22 22:28:18 -03:00
|
|
|
return mask;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2022-08-01 23:40:11 +02:00
|
|
|
#ifdef OLD_DIVEXCP
|
2022-11-19 10:40:32 -05:00
|
|
|
# define divexcp() \
|
|
|
|
|
{ \
|
|
|
|
|
x386_common_log("Divide exception at %04X(%06X):%04X\n", CS, cs, cpu_state.pc); \
|
|
|
|
|
x86_int(0); \
|
|
|
|
|
}
|
2022-08-01 23:40:11 +02:00
|
|
|
#else
|
2022-11-19 10:40:32 -05:00
|
|
|
# define divexcp() \
|
|
|
|
|
{ \
|
|
|
|
|
x86de(NULL, 0); \
|
|
|
|
|
}
|
2022-08-01 23:40:11 +02:00
|
|
|
#endif
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
int
|
|
|
|
|
divl(uint32_t val)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
uint64_t num;
|
|
|
|
|
uint64_t quo;
|
|
|
|
|
uint32_t rem;
|
|
|
|
|
uint32_t quo32;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (val == 0) {
|
2022-11-19 10:40:32 -05:00
|
|
|
divexcp();
|
|
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
num = (((uint64_t) EDX) << 32) | EAX;
|
|
|
|
|
quo = num / val;
|
|
|
|
|
rem = num % val;
|
|
|
|
|
quo32 = (uint32_t) (quo & 0xFFFFFFFF);
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
if (quo != (uint64_t) quo32) {
|
2022-11-19 10:40:32 -05:00
|
|
|
divexcp();
|
|
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EDX = rem;
|
|
|
|
|
EAX = quo32;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
idivl(int32_t val)
|
|
|
|
|
{
|
2023-08-10 15:43:16 -04:00
|
|
|
int64_t num;
|
|
|
|
|
int64_t quo;
|
|
|
|
|
int32_t rem;
|
|
|
|
|
int32_t quo32;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
if (val == 0) {
|
|
|
|
|
divexcp();
|
|
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
num = (((uint64_t) EDX) << 32) | EAX;
|
|
|
|
|
quo = num / val;
|
|
|
|
|
rem = num % val;
|
2020-04-10 01:08:52 +02:00
|
|
|
quo32 = (int32_t) (quo & 0xFFFFFFFF);
|
|
|
|
|
|
|
|
|
|
if (quo != (int64_t) quo32) {
|
2022-11-19 10:40:32 -05:00
|
|
|
divexcp();
|
|
|
|
|
return 1;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EDX = rem;
|
|
|
|
|
EAX = quo32;
|
|
|
|
|
|
|
|
|
|
return 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
void
|
2022-11-17 22:44:06 +01:00
|
|
|
cpu_386_flags_extract(void)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
flags_extract();
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
void
|
2022-11-17 22:44:06 +01:00
|
|
|
cpu_386_flags_rebuild(void)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
flags_rebuild();
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
|
|
|
|
|
2024-01-15 01:22:50 +06:00
|
|
|
extern uint64_t mmutranslate_noabrt_2386(uint32_t addr, int rw);
|
2024-01-14 15:26:40 +06:00
|
|
|
int
|
|
|
|
|
cpu_386_check_instruction_fault(void)
|
|
|
|
|
{
|
|
|
|
|
int i = 0;
|
|
|
|
|
int fault = 0;
|
|
|
|
|
/* Report no fault if RF is set. */
|
|
|
|
|
if (cpu_state.eflags & RF_FLAG)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
/* Make sure breakpoints are enabled. */
|
|
|
|
|
if (!(dr[7] & 0xFF))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
|
int breakpoint_enabled = !!(dr[7] & (0x3 << (2 * i))) && !(dr[7] & (0x30000 << (4 * i)));
|
2024-01-15 02:14:00 +06:00
|
|
|
uint32_t translated_addr = 0xffffffff;
|
2024-01-14 15:26:40 +06:00
|
|
|
if (!breakpoint_enabled)
|
|
|
|
|
continue;
|
2024-01-15 02:14:00 +06:00
|
|
|
|
|
|
|
|
translated_addr = dr[i];
|
|
|
|
|
|
2024-01-15 01:22:50 +06:00
|
|
|
if ((cs + cpu_state.pc) == (uint32_t)translated_addr) {
|
2024-01-14 15:26:40 +06:00
|
|
|
dr[6] |= (1 << i);
|
|
|
|
|
fault = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fault;
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-10 01:08:52 +02:00
|
|
|
int
|
2025-01-26 15:15:53 -05:00
|
|
|
sysenter(UNUSED(uint32_t fetchdat))
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
{
|
2020-04-10 01:08:52 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSENTER called\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!(msw & 1)) {
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("SYSENTER: CPU not in protected mode");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
x86gpf("SYSENTER: CPU not in protected mode", 0);
|
|
|
|
|
return cpu_state.abrt;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2021-04-10 07:18:47 +02:00
|
|
|
if (!(msr.sysenter_cs & 0xFFF8)) {
|
2020-04-10 01:08:52 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("SYSENTER: CS MSR is zero");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
x86gpf("SYSENTER: CS MSR is zero", 0);
|
|
|
|
|
return cpu_state.abrt;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSENTER started:\n");
|
|
|
|
|
x386_common_log(" CS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; EIP=%08X\n", cpu_state.seg_cs.seg, !!cpu_state.seg_cs.checked, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low, cpu_state.seg_cs.limit_high, cpu_state.seg_cs.ar_high, cpu_state.seg_cs.access, cpu_state.pc);
|
|
|
|
|
x386_common_log(" SS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; ESP=%08X\n", cpu_state.seg_ss.seg, !!cpu_state.seg_ss.checked, cpu_state.seg_ss.base, cpu_state.seg_ss.limit, cpu_state.seg_ss.limit_low, cpu_state.seg_ss.limit_high, cpu_state.seg_ss.ar_high, cpu_state.seg_ss.access, ESP);
|
2021-04-10 07:18:47 +02:00
|
|
|
x386_common_log(" Misc. : MSR (CS/ESP/EIP)=%04X/%08X/%08X pccache=%08X/%08X\n", msr.sysenter_cs, msr.sysenter_esp, msr.sysenter_eip, pccache, pccache2);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log(" EFLAGS=%04X%04X/%i 32=%i/%i ECX=%08X EDX=%08X abrt=%02X\n", cpu_state.eflags, cpu_state.flags, !!trap, !!use32, !!stack32, ECX, EDX, cpu_state.abrt);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Set VM, RF, and IF to 0. */
|
|
|
|
|
cpu_state.eflags &= ~(RF_FLAG | VM_FLAG);
|
|
|
|
|
cpu_state.flags &= ~I_FLAG;
|
|
|
|
|
|
|
|
|
|
#ifndef USE_NEW_DYNAREC
|
|
|
|
|
oldcs = CS;
|
|
|
|
|
#endif
|
|
|
|
|
cpu_state.oldpc = cpu_state.pc;
|
2022-11-19 10:40:32 -05:00
|
|
|
ESP = msr.sysenter_esp;
|
|
|
|
|
cpu_state.pc = msr.sysenter_eip;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg = (msr.sysenter_cs & 0xfffc);
|
|
|
|
|
cpu_state.seg_cs.base = 0;
|
|
|
|
|
cpu_state.seg_cs.limit_low = 0;
|
|
|
|
|
cpu_state.seg_cs.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_cs.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.access = 0x9b;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_cs.checked = 1;
|
|
|
|
|
oldcpl = 0;
|
|
|
|
|
|
|
|
|
|
cpu_state.seg_ss.seg = ((msr.sysenter_cs + 8) & 0xfffc);
|
|
|
|
|
cpu_state.seg_ss.base = 0;
|
|
|
|
|
cpu_state.seg_ss.limit_low = 0;
|
|
|
|
|
cpu_state.seg_ss.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_ss.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.access = 0x93;
|
|
|
|
|
cpu_state.seg_ss.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_ss.checked = 1;
|
2020-11-16 17:47:05 +01:00
|
|
|
#ifdef USE_DYNAREC
|
|
|
|
|
codegen_flat_ss = 0;
|
|
|
|
|
#endif
|
2020-11-16 00:01:21 +01:00
|
|
|
|
|
|
|
|
cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS | CPU_STATUS_V86);
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 /* | CPU_STATUS_PMODE*/);
|
2020-11-16 00:01:21 +01:00
|
|
|
set_use32(1);
|
2020-04-10 01:08:52 +02:00
|
|
|
set_stack32(1);
|
|
|
|
|
|
|
|
|
|
in_sys = 1;
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSENTER completed:\n");
|
|
|
|
|
x386_common_log(" CS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; EIP=%08X\n", cpu_state.seg_cs.seg, !!cpu_state.seg_cs.checked, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low, cpu_state.seg_cs.limit_high, cpu_state.seg_cs.ar_high, cpu_state.seg_cs.access, cpu_state.pc);
|
|
|
|
|
x386_common_log(" SS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; ESP=%08X\n", cpu_state.seg_ss.seg, !!cpu_state.seg_ss.checked, cpu_state.seg_ss.base, cpu_state.seg_ss.limit, cpu_state.seg_ss.limit_low, cpu_state.seg_ss.limit_high, cpu_state.seg_ss.ar_high, cpu_state.seg_ss.access, ESP);
|
2021-04-10 07:18:47 +02:00
|
|
|
x386_common_log(" Misc. : MSR (CS/ESP/EIP)=%04X/%08X/%08X pccache=%08X/%08X\n", msr.sysenter_cs, msr.sysenter_esp, msr.sysenter_eip, pccache, pccache2);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log(" EFLAGS=%04X%04X/%i 32=%i/%i ECX=%08X EDX=%08X abrt=%02X\n", cpu_state.eflags, cpu_state.flags, !!trap, !!use32, !!stack32, ECX, EDX, cpu_state.abrt);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2025-01-26 15:15:53 -05:00
|
|
|
sysexit(UNUSED(uint32_t fetchdat))
|
2020-04-10 01:08:52 +02:00
|
|
|
{
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSEXIT called\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-04-10 07:18:47 +02:00
|
|
|
if (!(msr.sysenter_cs & 0xFFF8)) {
|
2020-04-10 01:08:52 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("SYSEXIT: CS MSR is zero");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
x86gpf("SYSEXIT: CS MSR is zero", 0);
|
|
|
|
|
return cpu_state.abrt;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!(msw & 1)) {
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("SYSEXIT: CPU not in protected mode");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
x86gpf("SYSEXIT: CPU not in protected mode", 0);
|
|
|
|
|
return cpu_state.abrt;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (CPL) {
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("SYSEXIT: CPL not 0");
|
2020-04-10 01:08:52 +02:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
x86gpf("SYSEXIT: CPL not 0", 0);
|
|
|
|
|
return cpu_state.abrt;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSEXIT start:\n");
|
|
|
|
|
x386_common_log(" CS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; EIP=%08X\n", cpu_state.seg_cs.seg, !!cpu_state.seg_cs.checked, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low, cpu_state.seg_cs.limit_high, cpu_state.seg_cs.ar_high, cpu_state.seg_cs.access, cpu_state.pc);
|
|
|
|
|
x386_common_log(" SS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; ESP=%08X\n", cpu_state.seg_ss.seg, !!cpu_state.seg_ss.checked, cpu_state.seg_ss.base, cpu_state.seg_ss.limit, cpu_state.seg_ss.limit_low, cpu_state.seg_ss.limit_high, cpu_state.seg_ss.ar_high, cpu_state.seg_ss.access, ESP);
|
2021-04-10 07:18:47 +02:00
|
|
|
x386_common_log(" Misc. : MSR (CS/ESP/EIP)=%04X/%08X/%08X pccache=%08X/%08X\n", msr.sysenter_cs, msr.sysenter_esp, msr.sysenter_eip, pccache, pccache2);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log(" EFLAGS=%04X%04X/%i 32=%i/%i ECX=%08X EDX=%08X abrt=%02X\n", cpu_state.eflags, cpu_state.flags, !!trap, !!use32, !!stack32, ECX, EDX, cpu_state.abrt);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef USE_NEW_DYNAREC
|
|
|
|
|
oldcs = CS;
|
|
|
|
|
#endif
|
|
|
|
|
cpu_state.oldpc = cpu_state.pc;
|
2022-11-19 10:40:32 -05:00
|
|
|
ESP = ECX;
|
|
|
|
|
cpu_state.pc = EDX;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.seg = (((msr.sysenter_cs + 16) & 0xfffc) | 3);
|
|
|
|
|
cpu_state.seg_cs.base = 0;
|
|
|
|
|
cpu_state.seg_cs.limit_low = 0;
|
|
|
|
|
cpu_state.seg_cs.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_cs.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.access = 0xfb;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_cs.checked = 1;
|
|
|
|
|
oldcpl = 3;
|
|
|
|
|
|
|
|
|
|
cpu_state.seg_ss.seg = (((msr.sysenter_cs + 24) & 0xfffc) | 3);
|
|
|
|
|
cpu_state.seg_ss.base = 0;
|
|
|
|
|
cpu_state.seg_ss.limit_low = 0;
|
|
|
|
|
cpu_state.seg_ss.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_ss.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.access = 0xf3;
|
|
|
|
|
cpu_state.seg_ss.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_ss.checked = 1;
|
2020-11-16 17:47:05 +01:00
|
|
|
#ifdef USE_DYNAREC
|
|
|
|
|
codegen_flat_ss = 0;
|
|
|
|
|
#endif
|
2020-11-16 00:01:21 +01:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS /* | CPU_STATUS_V86*/);
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE);
|
2023-06-11 22:12:18 +02:00
|
|
|
flushmmucache_nopc();
|
2020-11-16 00:01:21 +01:00
|
|
|
set_use32(1);
|
2020-04-10 01:08:52 +02:00
|
|
|
set_stack32(1);
|
|
|
|
|
|
|
|
|
|
in_sys = 0;
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSEXIT completed:\n");
|
|
|
|
|
x386_common_log(" CS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; EIP=%08X\n", cpu_state.seg_cs.seg, !!cpu_state.seg_cs.checked, cpu_state.seg_cs.base, cpu_state.seg_cs.limit, cpu_state.seg_cs.limit_low, cpu_state.seg_cs.limit_high, cpu_state.seg_cs.ar_high, cpu_state.seg_cs.access, cpu_state.pc);
|
|
|
|
|
x386_common_log(" SS %04X/%i: b=%08X l=%08X (%08X-%08X) a=%02X%02X; ESP=%08X\n", cpu_state.seg_ss.seg, !!cpu_state.seg_ss.checked, cpu_state.seg_ss.base, cpu_state.seg_ss.limit, cpu_state.seg_ss.limit_low, cpu_state.seg_ss.limit_high, cpu_state.seg_ss.ar_high, cpu_state.seg_ss.access, ESP);
|
2021-04-10 07:18:47 +02:00
|
|
|
x386_common_log(" Misc. : MSR (CS/ESP/EIP)=%04X/%08X/%08X pccache=%08X/%08X\n", msr.sysenter_cs, msr.sysenter_esp, msr.sysenter_eip, pccache, pccache2);
|
2020-04-10 01:08:52 +02:00
|
|
|
x386_common_log(" EFLAGS=%04X%04X/%i 32=%i/%i ECX=%08X EDX=%08X abrt=%02X\n", cpu_state.eflags, cpu_state.flags, !!trap, !!use32, !!stack32, ECX, EDX, cpu_state.abrt);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2025-01-26 15:15:53 -05:00
|
|
|
syscall_op(UNUSED(uint32_t fetchdat))
|
2020-04-10 01:08:52 +02:00
|
|
|
{
|
2020-04-10 14:07:25 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSCALL called\n");
|
|
|
|
|
#endif
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* Let's do this by the AMD spec. */
|
2020-11-16 17:47:05 +01:00
|
|
|
/* Set VM and IF to 0. */
|
|
|
|
|
cpu_state.eflags &= ~VM_FLAG;
|
|
|
|
|
cpu_state.flags &= ~I_FLAG;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2020-11-16 17:47:05 +01:00
|
|
|
#ifndef USE_NEW_DYNAREC
|
|
|
|
|
oldcs = CS;
|
|
|
|
|
#endif
|
|
|
|
|
cpu_state.oldpc = cpu_state.pc;
|
2022-11-19 10:40:32 -05:00
|
|
|
ECX = cpu_state.pc;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* CS */
|
2022-11-19 10:40:32 -05:00
|
|
|
CS = AMD_SYSCALL_SB & 0xfffc;
|
|
|
|
|
cpu_state.seg_cs.base = 0;
|
|
|
|
|
cpu_state.seg_cs.limit_low = 0;
|
|
|
|
|
cpu_state.seg_cs.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_cs.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.access = 0x9b;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_cs.checked = 1;
|
|
|
|
|
oldcpl = 0;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* SS */
|
2022-11-19 10:40:32 -05:00
|
|
|
SS = (AMD_SYSCALL_SB + 8) & 0xfffc;
|
|
|
|
|
cpu_state.seg_ss.base = 0;
|
|
|
|
|
cpu_state.seg_ss.limit_low = 0;
|
|
|
|
|
cpu_state.seg_ss.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_ss.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.access = 0x93;
|
|
|
|
|
cpu_state.seg_ss.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_ss.checked = 1;
|
2020-11-16 17:47:05 +01:00
|
|
|
#ifdef USE_DYNAREC
|
|
|
|
|
codegen_flat_ss = 0;
|
|
|
|
|
#endif
|
2020-11-16 00:01:21 +01:00
|
|
|
|
|
|
|
|
cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS | CPU_STATUS_V86);
|
|
|
|
|
cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE);
|
|
|
|
|
set_use32(1);
|
2020-04-10 01:08:52 +02:00
|
|
|
set_stack32(1);
|
|
|
|
|
|
|
|
|
|
in_sys = 1;
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
2025-01-26 15:15:53 -05:00
|
|
|
sysret(UNUSED(uint32_t fetchdat))
|
2020-04-10 01:08:52 +02:00
|
|
|
{
|
2020-04-10 14:07:25 +02:00
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
|
|
|
|
x386_common_log("SYSRET called\n");
|
|
|
|
|
#endif
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2020-11-16 17:47:05 +01:00
|
|
|
if (CPL) {
|
|
|
|
|
#ifdef ENABLE_386_COMMON_LOG
|
2022-11-19 10:40:32 -05:00
|
|
|
x386_common_log("SYSRET: CPL not 0");
|
2020-11-16 17:47:05 +01:00
|
|
|
#endif
|
2022-11-19 10:40:32 -05:00
|
|
|
x86gpf("SYSRET: CPL not 0", 0);
|
|
|
|
|
return cpu_state.abrt;
|
2020-04-10 01:08:52 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-16 17:47:05 +01:00
|
|
|
cpu_state.flags |= I_FLAG;
|
|
|
|
|
/* First instruction after SYSRET will always execute, regardless of whether
|
|
|
|
|
there is a pending interrupt, following the STI logic */
|
|
|
|
|
cpu_end_block_after_ins = 2;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
2020-11-16 17:47:05 +01:00
|
|
|
#ifndef USE_NEW_DYNAREC
|
|
|
|
|
oldcs = CS;
|
|
|
|
|
#endif
|
|
|
|
|
cpu_state.oldpc = cpu_state.pc;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.pc = ECX;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* CS */
|
2022-11-19 10:40:32 -05:00
|
|
|
CS = (AMD_SYSRET_SB & 0xfffc) | 3;
|
|
|
|
|
cpu_state.seg_cs.base = 0;
|
|
|
|
|
cpu_state.seg_cs.limit_low = 0;
|
|
|
|
|
cpu_state.seg_cs.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_cs.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_cs.access = 0xfb;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_cs.checked = 1;
|
|
|
|
|
oldcpl = 3;
|
2020-04-10 01:08:52 +02:00
|
|
|
|
|
|
|
|
/* SS */
|
2022-11-19 10:40:32 -05:00
|
|
|
SS = ((AMD_SYSRET_SB + 8) & 0xfffc) | 3;
|
|
|
|
|
cpu_state.seg_ss.base = 0;
|
|
|
|
|
cpu_state.seg_ss.limit_low = 0;
|
|
|
|
|
cpu_state.seg_ss.limit = 0xffffffff;
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_state.seg_ss.limit_high = 0xffffffff;
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_state.seg_ss.access = 0xf3;
|
|
|
|
|
cpu_state.seg_cs.ar_high = 0xcf;
|
|
|
|
|
cpu_state.seg_ss.checked = 1;
|
2020-11-16 17:47:05 +01:00
|
|
|
#ifdef USE_DYNAREC
|
|
|
|
|
codegen_flat_ss = 0;
|
|
|
|
|
#endif
|
2020-11-16 00:01:21 +01:00
|
|
|
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_cur_status &= ~(CPU_STATUS_NOTFLATSS /* | CPU_STATUS_V86*/);
|
2020-11-16 00:01:21 +01:00
|
|
|
cpu_cur_status |= (CPU_STATUS_USE32 | CPU_STATUS_STACK32 | CPU_STATUS_PMODE);
|
2023-06-11 22:12:18 +02:00
|
|
|
flushmmucache_nopc();
|
2020-11-16 00:01:21 +01:00
|
|
|
set_use32(1);
|
2020-04-10 01:08:52 +02:00
|
|
|
set_stack32(1);
|
|
|
|
|
|
|
|
|
|
in_sys = 0;
|
|
|
|
|
|
|
|
|
|
return 1;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
2020-06-13 12:32:09 +02:00
|
|
|
|
2022-07-16 03:12:24 +02:00
|
|
|
void
|
2022-07-16 03:21:21 +02:00
|
|
|
cpu_register_fast_off_handler(void *timer)
|
2022-07-16 03:12:24 +02:00
|
|
|
{
|
2022-07-16 04:06:46 +02:00
|
|
|
cpu_fast_off_timer = (pc_timer_t *) timer;
|
2022-07-16 03:12:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cpu_fast_off_advance(void)
|
|
|
|
|
{
|
2022-07-16 03:21:21 +02:00
|
|
|
timer_disable(cpu_fast_off_timer);
|
|
|
|
|
if (cpu_fast_off_period != 0.0)
|
2022-11-19 10:40:32 -05:00
|
|
|
timer_on_auto(cpu_fast_off_timer, cpu_fast_off_period);
|
2022-07-16 03:12:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cpu_fast_off_period_set(uint16_t val, double period)
|
|
|
|
|
{
|
2022-07-16 03:21:21 +02:00
|
|
|
cpu_fast_off_period = ((double) (val + 1)) * period;
|
|
|
|
|
cpu_fast_off_advance();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
cpu_fast_off_reset(void)
|
|
|
|
|
{
|
|
|
|
|
cpu_register_fast_off_handler(NULL);
|
|
|
|
|
cpu_fast_off_period = 0.0;
|
|
|
|
|
cpu_fast_off_advance();
|
2022-07-16 03:12:24 +02:00
|
|
|
}
|
|
|
|
|
|
2022-07-16 02:45:46 +02:00
|
|
|
void
|
2022-07-16 02:47:39 +02:00
|
|
|
smi_raise(void)
|
2022-07-16 02:45:46 +02:00
|
|
|
{
|
2025-03-19 03:12:36 +01:00
|
|
|
uint8_t ccr1_check = ((ccr1 & (CCR1_USE_SMI | CCR1_SMAC | CCR1_SM3)) ==
|
|
|
|
|
(CCR1_USE_SMI | CCR1_SM3)) && (cyrix.arr[3].size > 0);
|
|
|
|
|
|
|
|
|
|
if (is_cxsmm && !ccr1_check)
|
|
|
|
|
return;
|
|
|
|
|
|
2022-07-16 02:45:46 +02:00
|
|
|
if (is486 && (cpu_fast_off_flags & 0x80000000))
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_fast_off_advance();
|
2022-07-16 02:45:46 +02:00
|
|
|
|
|
|
|
|
smi_line = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
2022-07-16 02:47:39 +02:00
|
|
|
nmi_raise(void)
|
2022-07-16 02:45:46 +02:00
|
|
|
{
|
|
|
|
|
if (is486 && (cpu_fast_off_flags & 0x20000000))
|
2022-11-19 10:40:32 -05:00
|
|
|
cpu_fast_off_advance();
|
2022-08-09 04:34:48 +02:00
|
|
|
|
|
|
|
|
nmi = 1;
|
2022-07-16 02:45:46 +02:00
|
|
|
}
|
|
|
|
|
|
2020-06-13 12:32:09 +02:00
|
|
|
#ifndef USE_DYNAREC
|
|
|
|
|
/* This is for compatibility with new x87 code. */
|
2022-11-19 10:40:32 -05:00
|
|
|
void
|
|
|
|
|
codegen_set_rounding_mode(int mode)
|
2020-06-13 12:32:09 +02:00
|
|
|
{
|
2022-11-19 10:40:32 -05:00
|
|
|
/* cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (mode << 10); */
|
2020-06-13 12:32:09 +02:00
|
|
|
}
|
|
|
|
|
#endif
|