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).