-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test PUSH/POP instructions with different operand size #4
Comments
You might as well make it a full push/pop test with different operand sizes and src/destinations? So all basic segment register push/pop, opcode 8F pop, opcode ff push, 80186+ immediate pushes(push imm8/16/32), off the top of my head. |
Added: |
There's also: Don't know how many of these are already tested against operand size, address size and/or stack address size(the B bit within the stack segment descriptor)? Although the stack address size might be outside of the current checks on this testsuite atm(since not much of protected mode is verified)? |
I know, some of those instructions maybe used but none of them are explicity tested, yet. |
So that means that the untested stack instructions still are: Those are still untested against operand/address/stack size, but pretty important for proper execution flow? Even most basic pretty important instructions are left unchecked? Why isn't INC/DEC(r/m16/32)/CMP/TEST tested with test 0xEE? |
PUSHA/POPA are heavily used for calls, that doesn't mean they are bug free though. They have to be properly tested for corner cases.
Yep.
Because there are only 24 hours in a day, usually :) |
Added: |
So, that still leaves: 60 PUSHA(D) As well as those INC/DEC(16&32 bits variants)/CMP/TEST on test EE(where, CMP=SUB and TEST=AND on a logical flag level(unaffected registers other than flags). INC/DEC is about the same as ADD/SUB with 1, but not affecting the carry flag). Edit: It seems the INC/DEC/CMP/TEST instructions aren't tested during the 0xEE test at all? Tests are still passing atm(with your latest commits). Although, thinking about it, those PUSH imm8/16/32 might need some self-modifying code in order to be tested extensively(modifying the value that's pushed). |
Can you test an older version of your emu to see if that POP ES bug you talked about at vogons can now be detected with test386?
I think that would be a bit overkill... I'll probably test with some pattern. |
I've just tested the current testsuite against a bit older commit of UniPCemu, before the POP ES fix. It does properly error out during the POST 0A tests. |
Nice. Added: |
Don't you mean 8F /0? 8F /1-7 are #UDs. That just leaves: Edit: So far no errors have occurred yet:D |
Yes you're right, 8F/0, cut'n'paste error... |
Added: |
Added: |
They all still check out. That just leaves PUSHF(D) and POPF(D) instructions. All other PUSH/POP operations are tested now. |
Is this a good or a bad thing? Do you expect any test to fail? |
Well, I know some software not running properly, most of them not even running in protected mode(yet). Like California Games hanging on the stage select screen(any CPU emulation in UniPCemu, 8086+ problem), Windows 95 crashing(jumping after various REP block moves) into cleared RAM(containing 0000h opcodes), Day of The Tentacle(tentacle.exe) not seeing the command line and giving me a unexpected 'by 0\n' on the command line, before showing help on parameters then crashing with a NULL pointer load error(no matter what's on the command line). Windows 3.0 simply hangs with recursive protection faults in protected mode after IRET from the kernel. That smells a whole lot like a big logic/(conditional) jump error to me. But the odd thing is that the conditional jumps themselves seem to run fine, as far as I can see from breakpoints. Even the simple testsuite in the remaining instruction thread shows no visible errors(current commit), so only a few possible culprits are left atm: flag storage(pushf/popf during real and protected mode) and a handful of remaining instructions(haven't tested 32-bit stack with my "testsuite"'s ret immediate instruction yet, due to running in real mode). |
Odd that with the latest improvements, some of those mentioned software(Windows 95 setup, Jazz Jackrabbit) tries to execute Protected-mode only instructions in real mode now(ARPL for Windows 95 setup, LLDT for Jazz Jackrabbit)? |
ARPL and LLDT are protected mode only and #UD would be thrown if a program would try to execute them in real mode. Sounds like some jump not taken somewhere way before those instructions. |
Well, the strange thing is that during my checking of the 8086, no errors were observed in basic execution. Jumps are made when flags are set and not made when not set. Unconditional jumps should also work. Then why is it ending up there? The 0F 386+ conditional jumps do exactly the same as the 8086+ jumps. |
Well, maybe the JMPs themselves are good but the code that decided to take or not those jumps is wrongly executed. The problem could actually be a thousand cycles before... |
Just checked all x86 jumps and conditional jumps. Each and every one should be working properly as far as I can see? Look at opcodes*.c for all opcode implementations. Look for CPU_jmprel for relative jumps and calls, CPU_jmpabs for absolute ones. "segmentWritten(CPU_SEGMENT_CS"(and destEIP load before that for it's EIP address to load) for the far jumps and calls. I can't see any errors in those instructions processing. Perhaps an error in the flags itself could also be a cause, but errors even happen on the 8086, which just pushes and pops them without modification of said data(raw access). |
Just tried running Windows 3.0 in it's default mode(no parameters). I see it page faulting twice(no other faults), then returning to the MS-DOS 5.0 prompt with the Windows logo screen behind it. Edit: Standard mode still triple faults for some odd reason. With only himem.sys and various drivers loaded, running win.exe without parameters returns it to the MS-DOS prompt after two paging faults on two different addresses(the last one being at EIP=0x8000XXXX, so within the kernel?). |
I've verified(during execution with breakpoints on the flags in Visual C++) that most conditional jump and loop instructions work as documented. Both used breakpoints on condition match and non match after it being matched. Jumps are taken when required and not taken when required not to. The only cases left untested are JO(overflow flag not set), JNO and JP(parity flag not set). All other jcc instructions work correctly. |
Yes, a PIQ is emulated, but it should be functioning normally afaik. Since it's using the same segmented/paging logic to check virtual and physical addresses and access them, as the EU would have(except not calling the BIU pipeline, but instead buffering into a simple fifo buffer, while it's called as a non-active BIU T3 or T1 cycle itself(depending on whether it's a 80(1)86 or 80286+, which is the same as BIU memory access cycles(which simply have higher priority using the basic if-else logic)). So it's the same as normal memory accesses(only instead of being called by the EU, it's executing directly on the BIU). The only way that could go wrong is when the basic segmentation and/or paging unit translation fails, which applies to the entire CPU(both prefetching, instruction fetching(EU<-PIQ) and normal instructions uses it this way). Since the BIU just dumbly fetches bytes/word/dwords(depending on alignment) using it's own EIP duplicate(which is loaded when a PIQ flush occurs, so during jumps and CPU resetting), nothing much should be able to go wrong there? The EIP address is always added to the base address of the CS segment descriptor, which uses the format as documented by the 80386+ CPU documentation. So the resulting address to fetch data from cannot be wrong, unless EIP(both BIU and register values) or the CS descriptor is loaded incorrectly, which would be a general problem having nothing to do with the BIU anyways(incorrect program execution). |
Also, the BIU must be working properly, otherwise it can't even boot past the BIOS, since any jump would fail right away because of a wrong base address/offset. |
Just tried running the AT BIOS, which confirms proper execution of the JP and JO conditional jumps. The only one left untested is JNO, both taken and not taken. |
From VOGONS thread https://www.vogons.org/viewtopic.php?f=9&t=60095
Test for this.
The text was updated successfully, but these errors were encountered: