UniPCemu build 2019/03/16 15:28 is now live!


The latest updates for UniPCemu are now available on itch.io! These include CPU improvements(both newly supported features and bugfixes), various hardware improvements and bugfixes and various bigger emulator speed optimizations.

This time it's a bigger update, due to the months spent debugging the code and improving on it to become both faster and more accurate.

Common emulator framework updates:

  • Fixed exception.c to be using the 64-bit fopen header correctly.
  • Fixed emucore.h
  • Disabled releasing Ctrl/Alt/Shift when releasing the used sticky key to allow releasing the combined key before releasing ctrl/alt/shift in any order.
  • Seperated 64-bit file I/O support from 32-bit file I/O using normal C++ functionality using different pointer types.
  • Improved 64-bit file support.
  • Fixed SDL 1.2 library autoconfiguration on Linux.
  • Fixed Linux Makefile to use proper linker flags from sdl2-config.
  • Improved and fixed fatal error messages using raiseError.
  • Fixed SDL init error to be logged and displayed correctly.
  • Made 64-bit file I/O fully portable.
  • Improved 64-bit fopen to prioritize SDL_RWops over the old handlers for compatibility(for SDL2).
  • Improved PSP 64-bit fopen RWops support with SDL2.
  • Improved 64-bit fopen support by adding support for SDL2 RWops.
  • Fixed 64-bit fread/fwrite to use proper parameters and correct results in all cases.
  • Implemented the safe(_)scatnprintf function to safely concatenate printf-formatted text to a string.
  • Implemented the new safescatnprintf function to the logging support.
  • Fixed MinGW-incompatibility defining of the _POSIX_C_SOURCE define for large file support on Linux. This has now been reduced to be used for Linux and Android only.
  • Fixed MinGW safe_strcpy issue warning about maximum size being copied.
  • Fixed MinGW 64-bit hexadecimal dumps to be of a proper length.
  • Fixed Windows MinGW64 long long sprintf format to be correct, and usable my the Windows drivers.
  • Generalized the sprintf defines.
  • Moved Windows-specific SDL includes to sdl_rest.h, which has been moved outside the platform-specific checks to be used in a generalized way, handling SDL base includes for all platforms.
  • Fixed 64-bit fopen warnings on Linux.
  • Improved linux build compatibility.
  • Fixed directory list support on Linux.
  • Fixed 64-bit file support on Linux.
  • Improved compatiblity for 64-bit fopen.
  • Fixed fopen64 missing variable on PSP.
  • Fixed fopen64 closing curly bracked that isn't supposed to be there.
  • Improved 64-bit file operations on Linux/Android.
  • Implemented 64-bit file seek for Linux platforms.
  • Improved non-Windows and Linux code compatibility.
  • Updated the makefile for linux with improved paths.
  • Improved the Linux makefile for a proper SDL2 repository directory build.
  • Added support for building SDL2 using the common emulator framework SDL2 repository.
  • Added support for RDP Delta detection.
  • Improved 64-bit file location handling on all supported platforms.
  • Improved 64-bit file offset support.
  • Improved support for 64-bit file I/O on different platforms.
  • Fixed Ctrl/Alt/Shift buffered input to not give the last key that's pressed when releasing said key, when it's release input is specified(type 2 input_buffer mode).
  • Improved logging to properly only verify debugger input when logging to the debugger log, instead of all logs(when verification is enabled).
  • Optimized verification input on the debugger output.
  • Optimized debugger validation for equal data.
  • Implemented logging of not equally verified data to be marked.
  • Added support to verify debugger input from stdin.
  • Added support to redirect debugger output to printf.
  • Fixed Linux version gotos.

UniPCemu updates:

  • Updated the common emulator framework to the latest commit.
  • Updated the Android Gradle to the latest version.
  • Optimized the BIU IPS clock PIQ filling algorithm to take the limit for expand up segments into consideration to prevent possible overflow, if possible.
  • Optimized the BIU IPS clock PIQ filling algorithm to take paging into consideration, not checking for more invalid linear addresses than needed(only once for the final fetch, and if that fails, another for the final byte on the (previous) valid page.
  • Fixed unused PIQ_retry label within CPU_readOP.
  • Optimized BIU memory checks to occur only when needed.
  • Added ModR/M parsing checks for it not being decoded to make sure it's loaded when required, otherwise it's logged.
  • Improved IRET to V86 from non-PL0 to not affect the V86 flag, staying in protected mode as is documented.
  • Simplified IRET during unprivileged V86 mode(IOPL<3).
  • Simplified POPFD IOPL being unchanging when not CPL 0.
  • Improved ATA read verify sectors command to properly include the final sector of the disk.
  • Improved ATAPI handling of transferring 0 sectors to not error out on the maximum amount of sectors to transfer instead and not give any data at all before finishing said command successfully.
  • Fixed ATAPI Read CD-ROM capacity sector size.
  • Fixed CD-ROM read capacity command to give correct results.
  • Improved handling of A20 line to not affect triple fault, but only affect CPU initialization.
  • Fixed 80486 BSWAP undocumented behaviour needing to be for 16-bit instead of 32-bit BSWAP instructions.
  • Implemented the BSWAP r16 undocumented behaviour on all CPUs supporting it(e.g. 80486 and up).
  • Fixed missing headers.
  • Tseng video cards that are emulated don't have PCI support(nor does the VGA), so it's disabled for active emulation.
  • Sector count on ATAPI can't be written to, it's not responding to any writes.
  • Improved ATA base timing to be the ATAPI result timing accordingly(ATA/ATAPI command A0 timing).
  • Improved IDE base timings based on PCem's ide.c.
  • Adjusted ATA timings to be closer to a real device.
  • Fixed all interrupts properly stopping REP instructions without faults.
  • Improved INT1 disassembly.
  • Report non-Protected mode-only faults as well.
  • Report all exceptions thrown, and check them properly now as well.
  • Improved multitasking Present bit check order.
  • Improved segment loading Present bit to be of the lowest priority among all the checks that can fault loading the descriptor itself.
  • Removed specific Android Studio files from version control.
  • Removed Android Studio specific idea files.
  • Added missing .iml files.
  • Removed unused variable clearing Paging lists.
  • Fixed Android project on Android Studio.
  • Fixed TLB size to be compatible with the added lists for the 4MB entries.
  • Optimized TLB way during reads.
  • Fixed compiler warnings and errors.
  • Improved the paging TLB to be Set-associative instead of Way-associative.
  • Improved x86 TLB to be either 8 sets, 4-way(80486) or 4 sets, 8-way(as documented on the 80386).
  • Modified the S-bit in the TLB to use sets 4-7.
  • A 80486 has a 8-way TLB.
  • Improved 80386+ XLAT address size wrapping.
  • Improved PUSHFD to not push the resume flag, if it's set.
  • Fixed 80386 SMSW/SLDT/STR to compile again.
  • Fixed 80386 header.
  • Optimized ModR/M steps.
  • Improved SMSW/SLDT/STR instructions to work properly with 32-bit registers(memory is still 16-bit only).
  • Fixed ModR/M documentation of the Slashr parameter.
  • Fixed 16/32-bit MOVS/ZX instructions to be as documented.
  • Improved 80286+ handling of the CR0 EM bit.
  • Added documentation on the x87 FPU emulation faults.
  • Fixed bios.c BIGFILE structure.
  • Modified all 64-bit file I/O to use the now BIGFILE structur instead of the old FILE structure.
  • Moved to as much 64-bit file I/O as possible.
  • Improved automatic directory creation for the project's working directory when ran on Linux.
  • Fixed cross-platform paths.
  • Fixed cross-platform build for bios.c.
  • Improved default root path for the program's files to be in the home directory of the user.
  • Improved and generalized 80286+ FPU instructions and emulation.
  • Fixed task switching CS.RPL==CS.DPL instead of CPL==TR.DPL. Also disabled said check for Virtual 8086 mode, as it doesn't have any RPL in CS.
  • Disable MMU buffering. This is forbidden for cycle accuracy and a waste of time with IPS clocking mode.
  • Allow - and _ in filename inputs.
  • Optimized memory mapped I/O debugging.
  • Optimized direct memory reads.
  • Optimized Paging.
  • Optimized Paging for 4KB pages.
  • Don't process 4MB pages when emulating a 80486 or lower CPU.
  • Improved handling of conforming code segment descriptors, according to documentation.
  • Applied the safescatnprintf function to the snprintf function calls that the MinGW compiler was detecting as using recursive concatenation of printf-formatted text.
  • Improved linux build compatibility.
  • Fixed Jcc jumps to behave correctly again.
  • Fixed PDBR to use valid bits only.
  • Fixed PSE to be Pentium and up only.
  • Added support for a 32-bit IDE data port.
  • Fixed PDE 4MB page always being dirty, since it has no dirty bit.
  • Fixed PDE page size bit to be bit 7 instead of bit 6.
  • Fixed PDE 4MB pages to use the correct page size instead of invalidly shifting it past bit 0.
  • Implemented support for 4MB paging.
  • Fixed NULL segment selector with call gates.
  • Fixed gate to NULL segment to throw #GP(0).
  • Improved handling of gated segment write faults and protection ordering.
  • Improved address size to affect the usage of (E)IP and it's truncating for the Jcc opcodes.
  • Extended the relative and absolute jump internals to support truncating of EIP depending on the address size instead.
  • Make fault raising apply the cycles for the current interrupt or protected-mode method, if needed.
  • Optimized paging to check for MRU entries first when writing and reading the TLB. Also only process entries that are allocated. Don't use direct indexes into the TLB entries anymore, just pointers given by the TLB retrieval functions, which is faster.
  • Improved Double Fault conditions.
  • Don't finish the MIDI device when RDP was toggled.
  • Fixed instruction base timing to be a proper base 0 instead of base 1 when looking up from the timing table.
  • Fixed x86 timing priority to check the proper items.
  • Improved x86 timing priority list sorting.
  • Fixed x86 timing lookup to properly apply the mode and operand size.
  • Fixed stack check during RETF.
  • Fixed stack switch privilege level check and result.
  • Fixed the privilege level check to not overlap the TSS busy bit condition.
  • Fixed protection compiler issues.
  • Improved privilege level check.
  • Fixed SS privilege checks.
  • Improved stack switches CPL handling.
  • Improved Stack Switch privilege level requirement.
  • Fixed paged reads from linear address space to report correctly.
  • Fixed the Normal translation layer to report the logical address instead of the linear address(adding nothing).
  • Fixed logging of CPU table reads and writes to report a correct Paging address.
  • Improved privilege checks on CALL and JMP to lower or different privilege levels.
  • Improved LAR/LSL system descriptor vs normal descriptor definition checks.
  • Fixed 80386 LAR/LSL NULL segment selector detection.
  • Improved LAR/LSL/VERR/VERW instructions to give valid results for Not-present descriptors and correct handling of NULL segment selectors.
  • Fixed Stack segment privilege check to require CPL==RPL==DPL.
  • Invalid stack loading throws #GP except when loading with a non-present bit.
  • Improved stack faults.
  • Fixed Non-present LDTR and not present data segment descriptors.
  • Restored NULL GDT descriptor support for all previous GDT registers(missing TR clearing the Present bit).
  • Modified descriptor loading to be compatible with the simplified descriptor loading.
  • Simplified descriptor loading to GDT/LDT basics only.
  • Improved stack switching faults to properly set the EXT bit (during interrupts).
  • Fixed code errors.
  • Improved protection faults during interrupts according to the i386 programmer's reference manual.
  • Improved x86 interrupt protection checks ordering according to the above-mentioned manual.
  • Improved interrupt code segment loading to support page faults correctly.
  • Improved interrupt code segment descriptor checking order of fault checks to be as documented.
  • Fixed the Android SDK version required to compile the application.
  • Improved Android manifest.
  • Fixed allocTLB to properly check for available allocations.
  • Cleaned up paging and fixed MinGW warnings.
  • Cleaned up protection and fixed MinGW warnings.
  • Modem emulation is single-threaded, so don't apply a buffer lock.
  • Internalized MMU direct I/O.
  • Optimized MMU hardware mapping handler calls.
  • Optimized not present descriptor cache faulting.
  • Optimized initializing and clearing the Paging TLB lists.
  • Made the TLB list operations inlined.
  • Paging TLB: Don't update the most recent entry, when moving a list item, to itself.
  • Removed unneeded load of the TLB entry to be newest.
  • Added comment about Paging_oldestTLB safety return.
  • Improved the Paging single address invalidation routine to be more accurate.
  • Reimplemented Paging TLB LRU algorithm using linked lists.
  • Improved IDT protection checks.
  • #NP isn't triggered on IDT entries. #GP is supposed to be triggered instead.
  • Improved interrupt descriptor and interrupt code segment descriptor checking and segment loading.
  • Fixed interrupt throwing #NP when an IDT entry or GDT entry is NULL or not present.
  • Interrupt to non-present code descriptor throws a #GP(selector) fault.
  • Fixed endianness of interrupt segment descriptor low base and limit fields.
  • LDTR in LDT is illegal.
  • Fixed the incorrect stack checking of the new generalized method.
  • Fixed roof of Expand-up and Expand-down segments.
  • Roof of 16-bit Expand-up segments is 20-bit instead of 16-bit.
  • Optimized Present bit of cached descriptors not being (un)likely.
  • Improved CPU flags updating.
  • Precalculated Alignment checks.
  • Simplified Alignment flag checks with a invalid address lookup table.
  • Optimized descriptor limit checks with simplified logic.
  • Optimized descriptor System bit checks for read/write/execute checks on non-System descriptors.
  • Spinning down a readied/ready disc becomes idle and not trigger anything anymore.
  • Improved mode sense data header and fixed it's values.
  • Improved reporting of the CD-ROM tray type in the CD-ROM capabilities page.
  • Improved ATAPI reporting of no disc in caddy while inserted, ejected and a disc being inserted with the mode command and related commands.
  • Improved mode sense command protection against buffer overflows.
  • Improved ATAPI Mode Sense/Mode Select commands.
  • Implemented CD-ROM Capabilities Eject bit.
  • Fixed Windows 64-bit builds instruction set on Visual Studio.
  • Fixed ATAPI mode sense result size.
  • Fixed ATAPI mode select command buffer size problems.
  • Fixed ATAPI mode sense usable pages.
  • Enabled SSE2 on Windows 64-bit builds, due to it being mandatory on a 64-bit x86_64 CPU.
  • Modified the CPU cores to use the generalized way of checking memory accesses.
  • Modified the CPU memory protection to be working in 16-bit and 32-bit chunks, if possible.
  • Implemented simplified 32-bit memory access checks, due to memory protection not requiring checking all four memory locations, just the borders.
  • Writing to CS already flushes the PIQ, so don't flush it again after loading it.
  • Faulting RET shouldn't add to the stack incorrectly.
  • Optimized segment descriptor saving to only save the Access Rights byte(all other values being read-only.
  • Optimized normal 80386+ 32-bit opcodes memory protection checks.
  • Optimized 80386+ 0F opcodes memory protection checks.
  • Fixed BSF and BSR memory protection checks.
  • Optimized 80186+ memory protection checks.
  • Fixed 80386+ XCHG memory check order.
  • Optimized 8086+ memory checks.
  • Fixed 8086+ XCHG memory protection order.
  • Optimized GRP5 /3 and /5 to check for faults once.
  • Restored SHLD/SHRD 16-bit to shift in zeroes past 16-bits again.
  • Implemented the 80486 WP bit to the paging unit.
  • Fixed modr/m segment override detection for timings.
  • Improved ENTER instruction to fault if it's violating the stack segment after it's allocation of the local variables.
  • Fixed BIOS text input when inputting Ctrl/Alt/Shift with the new mode not inputting the last pressed key when releasing Ctrl/Alt/Shift.
  • Improved paging checks for writes in Supervisor mode to allow writes to read-only user pages, according to documentation.
  • Supervisor can write all, no matter what the write privileges are.
  • Fixed BIU to handle the TLB correctly when writing to memory.
  • Added missing EBP value to be undone on faults like ESP(e.g. during ENTER).
  • Page fault is SS:[(E)SP] isn't writable after ENTER, as is documented.
  • Fixed 80386+ LXS  disassembly.
  • Improved segmentation rights error conditions to take the unused bits into consideration properly.
  • Don't give paging read flags that aren't valid for said functions.
  • Improved stack switching to not fault on the privilege level anymore(since a new one is loaded).
  • Improved call gate size to properly check stacks after switching stacks.
  • Fixed MinGW compiler warnings.
  • Improved protection checks to be done as CPL 0 accesses.
  • Improved stack switching and I/O bitmap checks to be done with paging and segmentation accordingly.
  • Improved TSS port rights checking against protection mechanisms.
  • Improved port rights checking to be according to the 80386 and 80486 programmer's reference manuals.
  • Improved TSS I/O access checks against paging and segmentation.
  • Improved SHLD/SHRD 16-bit instructions.
  • Improved PUSHF and PUSHFD throwing faults in Virtual 8086 mode.
  • Improved handling of 16-bit segment register writes.
  • SH*D are undefined starting from 16-bits shifted according to documentation(documenting >= instead of >)?
  • SHLD/SHRD with a count more than 16 has an undefined result(now a NOP).
  • Fixed debugger task&CR3 breakpoints to not trigger on different CPU modes when a non-CR3 and/or task only breakpoint is set.
  • Improved GRP5 JMPF/CALLF to perform memory checks correctly.
  • Fixed POPF(D) instructions.
  • Switches the flag for segmentation check from bit 4 to bit 7 due to collision with bit 4(prefetch).
  • Split calls to modrm_check8/16/32 to first apply normal segmentation for all items, then apply paging for all items.
  • Split calls to checkMMUaccess to first apply normal segmentation for all items, then apply paging for all items.
  • Fixed BSR and BSF zero flag being properly cleared with a valid result and bit 0 being found.
  • Fixed a bug in the BSF instructions, where a set bit 0 produces an incorrect result, instead of 0.
  • Extended segmented memory access checks to only check for segmentation, debugger or paging individually.
  • Improved memory access checking to allow checking without checking paging translation.
  • Fixed syntax error.
  • Modified stack push of the error code during a fault to another task to push 32-bits depending on the TSS descriptor's size(80286 vs 80386 task), instead of the D/B-bit(which is documented as always 0, even in 32-bit mode, thus can't be used for differentiating the stack operand size).
  • Improved modem response strings.
  • Improved and slightly optimized UART DLAB clocking.
  • Improved modem result code reporting.
  • LAR and LSL also throw a #UD fault on Virtual 8086 mode.
  • Optimized modem status change checks.
  • Implemented the Loopback status register specifics, switching bits 0/1 around accordingly.
  • Improved Modem Control when entering and leaving Loopback mode, as well as when running in Loopback mode.
  • Improved modem Ringing reporting to report the correct ring line.
  • Improved modem Ringing to ring first, then answer and silence until the next ring, while ringing.
  • Both Modem Status Interrupts and bit 2 for the modem status get set/activated when dropping the Ring Indicator.
  • Improved UART Modem Status Interrupt causes.
  • Improved UART interrupt priorities.
  • Improved UART Transmitter Holding Register becoming empty to cause an interrupt instead of being transmitted fully without new data being loaded into the Transmitter Holding Register.
  • Simplified and optimized the Modem Status Register delta bits.
  • UART MSR RING line delta indicates that the RING line went from low to high.
  • Improved Modem Control Register having limited bits.
  • Implemented UART Loopback mode.
  • UART Scratch register doesn't exist on a 8250 UART.
  • Moved Modem Status Register updating and it's related delta bits to the updating loop.
  • Fixed UART clocking to actually tick.
  • Fixed UART cycle handling.
  • Made UART clocking parallel and more cycle-based.
  • Added logic for starting and finishing UART transfers.
  • Improved the UART line status interrupt to only apply to errors.
  • Improved the UART line status register to clear indicated errors after reads.
  • Improved the UART to properly send/receive data when prioritizing sending, having something to receive and nothing to send anymore.
  • Improved negation of carry flag.
  • Improved J(E)CXZ condition.
  • Improved modr/m offset displacement to apply as a signed number.
  • Improved Bit Test instructions to apply a signed displacement instead of an unsigned one.
  • Improved alignment flag when handling interrupts.
  • Improved alignment check exception conditions.
  • Improved IRET flags behaviour.
  • Improved debugger repeating instructions reporting the initial state of the registers correctly.
  • Improved debugger logging to be lower case only, except opcodes being logged.
  • Improved Direct MIDI output support for Windows only.
  • Improved advanced log logging conditions to act on general logging correctly.
  • Fixed CR3 breakpoints requiring Paging to be activated.
  • Optimized paging to minimize TLB lookups and used TLB entries.

Files

UniPCemu.apk 3 MB
Mar 16, 2019
UniPCemu_PSP.zip 854 kB
Mar 16, 2019
UniPCemu_win64.zip 1 MB
Mar 16, 2019
UniPCemu_win64server.zip 1 MB
Mar 16, 2019
UniPCemu_win32.zip 1 MB
Mar 16, 2019
UniPCemu_win32server.zip 1 MB
Mar 16, 2019

Get UniPCemu

Leave a comment

Log in with itch.io to leave a comment.