VOGONS


First post, by superfury

User metadata
Rank l33t++
Rank
l33t++

What happens when a CPU tries to load a segment descriptor(for loading CS,DS,ES etc. or interrupts/exceptions) or interrupt descriptor from said tables while in ring 3? Will a page fault occur because CPL=3 and the tables are marked as being a supervisor page?

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

Reply 1 of 2, by BloodyCactus

User metadata
Rank Oldbie
Rank
Oldbie

a ring3 program can load any selector from the GDT. its when it accesses memory through that selector that a fault will occur (eg: write to a cpl=0 page or something).

you could just write a test and try it...

if you even think about your statement for one second you would see your assumption is wrong. Your basically saying no ring3 program could ever load a descriptor from the gdt, because gdt will always be in ring0. yet we have pmode operating systems that do just this.

--/\-[ Stu : Bloody Cactus :: [ https://bloodycactus.com :: http://kråketær.com ]-/\--

Reply 2 of 2, by superfury

User metadata
Rank l33t++
Rank
l33t++

I assume the same applies to the LDT and IDT? I've already (yesterday) adjusted said loading code(loading those tables) to load as privilege level 0 instead of CPL to make e.g. JEMM386.EXE from FreeDOS able to handle it's faulting(although somehow Windows 95 setup still crashes due to other unknown CPU instruction bugs it seems).

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