Keeping GDT, IDT and LDT tables within kernel memory?

Emulation of old PCs, PC hardware, or PC peripherals.

Keeping GDT, IDT and LDT tables within kernel memory?

Postby superfury » 2018-4-20 @ 12:20

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?
superfury
l33t
 
Posts: 2617
Joined: 2014-3-08 @ 11:25
Location: Netherlands

Re: Keeping GDT, IDT and LDT tables within kernel memory?

Postby BloodyCactus » 2018-4-20 @ 14:09

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 :: http://kråketær.com :: http://mega-tokyo.com ]-/\--
User avatar
BloodyCactus
Oldbie
 
Posts: 703
Joined: 2016-2-03 @ 13:34
Location: Lexington VA

Re: Keeping GDT, IDT and LDT tables within kernel memory?

Postby superfury » 2018-4-21 @ 13:26

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).
superfury
l33t
 
Posts: 2617
Joined: 2014-3-08 @ 11:25
Location: Netherlands


Return to PC Emulation

Who is online

Users browsing this forum: No registered users and 2 guests