Theoretical GDT question

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
TwixEmma
Posts: 11
Joined: Tue Jul 16, 2013 10:10 am
Location: England
Contact:

Theoretical GDT question

Post by TwixEmma »

Hi, I don't know if something like this has been discussed before and I hope this is the right place to put this, I was busy designing my GDT to allow for four segment types, 3 for each ring level, and 1 that would overlap it all and allow ring 0 code to read everything everywhere else. My theoretical question was is it possible to have a GDT entry spanning everything, that only allows ring0 data reading, my idea is that any program ran on the OS could be viewed by the OS even though the program is somewhere like ring3. This is useful for debugging and disassembling programs contained with the OS. I'm somewhat new to OS development, although I've done a lot of research. Thanks in advance.
"Don't think, don't try, just do." Master Yoda
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: Theoretical GDT question

Post by AJ »

Hi,

Anything running in kernel mode can already read user mode pages without a special GDT entry. If you are running a flat memory model, you just need ring 0 code and data segments and ring 3 code and data segments extending across the entire virtual memory space (4 descriptors plus the null descriptor). You then control access to individual pages via the u/s bit in your paging structutres.

Cheers,
Adam
Post Reply