I have been developing an 32 bit operating system and I want to allow programs to separate segments from the kernel.

To do that I need to make SS, and DS registers actually point to the programs stack and .data section.

From my research I believe this is done through setting up a local descriptor table.

I am assuming this is very similar to the GDT and the LDT is loaded through lldt.

However I do not get how I use this once my segments are set up. Could anyone explain?

有帮助吗?

解决方案

No, there's no need to set up a separate LDT just to set up userspace SS/CS/DS segment descriptors.

It's possible to do that just saving registers state in interrupt handlers and using an entry for task selector in GDT (it is required by CPU to loookup a kernel-space SS of the process to go into an interrupt from userspace).

其他提示

Well, you can't find better tutorial than Intel manual. Really, find Intel 80386 programming manual (386 manual is shorter and imho better written than newer ones; it has main spots you need). Or IA32 programming manual from Intel website. It has all information you are searching for.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top