VOGONS


Reply 400 of 406, by mr.cat

User metadata
Rank Member
Rank
Member

I followed the breadcrumbs and found the cause for the Minix3 boot panic 😁
Looks like the problem is with TLB handling, so maybe this explains some Windows issues too?

In my previous post, I found the main suspect on the Minix side to be reload_cr3().
Now taking a look at UniPCemu's source, we see this line in Paging_clearTLB():

for (TLB_set = 0; TLB_set < 8; ++TLB_set) //Process all possible sets!

However, the TLB_usedlist_head array is defined as having 16 entries both in headers/cpu/paging.h and in cpu/paging.c (via the setsize variable).
I just went and changed that loop size from 8 to 16 and whaddya know, that did the trick 😁

Last edited by mr.cat on 2021-11-22, 06:06. Edited 1 time in total.

Reply 401 of 406, by superfury

User metadata
Rank l33t
Rank
l33t
mr.cat wrote on 2021-11-19, 21:31:
I followed the breadcrumbs and found the cause for the Minix3 boot panic :D Looks like the problem is with TLB handling, so mayb […]
Show full quote
superfury wrote on 2021-10-09, 20:41:
Hmmm... Disabling the memory cache entirely also makes Windows 9x crash in exactly the same way as before (with the cache enable […]
Show full quote

Hmmm... Disabling the memory cache entirely also makes Windows 9x crash in exactly the same way as before (with the cache enabled).
So the issue is actually not in the cache itself, but probably in one of the other affected areas, probably the BIU itself?
Or perhaps something else that's changed? Hmmm...
Edit: Hmmm... Reverting the BIU to no longer split the memory accesses for prefetching (always using the same cache instead of double caching) and disabling the caching of multiple bytes at once seem to have no effect. It will still ned up at the invalid instruction with trap and sign flags being set (which isn't supposed to happen)...
So the search for the error continues...
Edit: OK. So the cause seems to have been the physical memory block repeated read optimization, which remembers if the last access to a physical memory is to skip the MMIO devices mapping for the most recently used 4K block of memory.
When disabling said optimization, Windows 98 at least seems to reboot correctly?

I followed the breadcrumbs and found the cause for the Minix3 boot panic 😁
Looks like the problem is with TLB handling, so maybe this explains some Windows issues too?

In my previous post (see above), I found the main suspect on the Minix side to be reload_cr3().
Now taking a look at UniPCemu's source, we see this line in Paging_clearTLB():

for (TLB_set = 0; TLB_set < 8; ++TLB_set) //Process all possible sets!

However, the TLB_usedlist_head array is defined as having 16 entries both in headers/cpu/paging.h and in cpu/paging.c (via the setsize variable).
I just went and changed that loop size from 8 to 16 and whaddya know, that did the trick 😁

Well, managed to get those cache issues fixed (the cause wasn't the cache itself but instead the remembering('caching') of the last accessed memory or ROM access was causing issues. So that cache part has been disabled for now(it was causing the Windows reboot issues after detecting hardware)). Then found the VGA memory aperture's bottleneck and managed to optimize it (the memory accesses being reduced to 0.5% for the MMU memory accesses themselves (VGA reduced from ~0.5% CPU usage to ~0.02%).

Implemented those 8 to 16 entries in the paging unit. Also changed said number to a define at the top (for ease of implementation) with all those locations using it.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io

Reply 402 of 406, by superfury

User metadata
Rank l33t
Rank
l33t

OK. WIndows NT 4.0 changed alright: I now get a NULL segment dereference during a MOV instruction, then another reset?
It's some data segment:offset dereference. And because the segment register is a NULL (0x0000-0x0003 without P-bit set), it reboots?
Edit: OK. It's some MOV instruction using a CS: prefix override. So it's faulting on trying to access something on the CS segment? CS is F000, so it's probably running the BIOS ROM code in the cached RAM.
Looking at the CPU mode, it's indeed in real mode...
The CS access rights in the descriptor cache is 0x9B...
The access rights themselves for CS seem to be actual 0x9B(not writable, which it should be), instead of being properly executable/read/write as in actual real mode (as undocumented behaviour for the Pentium-compatible CPUs).
Edit: Fixed that one. Still crashing NT 4.0 though.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io

Reply 403 of 406, by superfury

User metadata
Rank l33t
Rank
l33t

With Minix 3.3.0, running setup from the bash shell causes it to hang still? Directory listing (ls) works though. The echo program also works.

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io

Reply 404 of 406, by mr.cat

User metadata
Rank Member
Rank
Member
superfury wrote on 2021-11-22, 02:50:

With Minix 3.3.0, running setup from the bash shell causes it to hang still? Directory listing (ls) works though. The echo program also works.

The boot was moving at a glacial speed for me, so I never got as far as having a shell.
There could be some differences between the Minix3 versions.
Besides Minix, there are other small OSes out there that could be used as test cases (HelenOS, KolibriOS, Genode...).

EDIT: Yup, 3.3.0 seems to work (or at least, I now get a shell).
I was previously using a customized git version, it got stuck at launching the "random" service.

Last edited by mr.cat on 2021-11-22, 11:20. Edited 1 time in total.

Reply 405 of 406, by superfury

User metadata
Rank l33t
Rank
l33t
mr.cat wrote on 2021-11-22, 06:04:
The boot was moving at a glacial speed for me, so I never got as far as having a shell. There could be some differences between […]
Show full quote
superfury wrote on 2021-11-22, 02:50:

With Minix 3.3.0, running setup from the bash shell causes it to hang still? Directory listing (ls) works though. The echo program also works.

The boot was moving at a glacial speed for me, so I never got as far as having a shell.
There could be some differences between the Minix3 versions.
Besides Minix, there are other small OSes out there that could be used as test cases (HelenOS, KolibriOS, Genode...).

I did fix one other bug besides the 8 to 16 entry TLB bug: transitioning to real mode on the Pentium and to protected mode from real mode properly ignores the CS access rights in real mode (for Pentium processors and up). Perhaps that's the difference?
I'm using the 3.3.o iso from the minix website (latest official release afaik).

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io

Reply 406 of 406, by superfury

User metadata
Rank l33t
Rank
l33t
mr.cat wrote on 2021-11-22, 06:04:
The boot was moving at a glacial speed for me, so I never got as far as having a shell. There could be some differences between […]
Show full quote
superfury wrote on 2021-11-22, 02:50:

With Minix 3.3.0, running setup from the bash shell causes it to hang still? Directory listing (ls) works though. The echo program also works.

The boot was moving at a glacial speed for me, so I never got as far as having a shell.
There could be some differences between the Minix3 versions.
Besides Minix, there are other small OSes out there that could be used as test cases (HelenOS, KolibriOS, Genode...).

EDIT: Yup, 3.3.0 seems to work (or at least, I now get a shell).
I was previously using a customized git version, it got stuck at launching the "random" service.

Just tried KolibriOS. It seems to boot into the desktop. It's running very slowly (though managed to run the SHELL 0.7.4 program). It displays 'Shell 0.7.4

Type 'help' for help. Input seems to work, but slowly?

It only displays about 1/4 of the screen (whereever the mouse cursor is at)?
Edit: It even has Dosbox 🤣 Let's see if it runs...
Edit: nope. not even in Qemu? Dosbox's Kolibri build is broken apparently?

Author of the UniPCemu emulator.
UniPCemu Git repository
UniPCemu for Android, Windows and PSP on itch.io