Global Decriptor Table Design

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
mark3094
Member
Member
Posts: 164
Joined: Mon Feb 14, 2011 10:32 pm
Location: Australia
Contact:

Global Decriptor Table Design

Post by mark3094 »

I was just thinking about where (in terms of project layout) the GDT should go.
I have three projects; a HAL which is compiled to a static library, a C static library, and a Kernel project which references the other two libraries. I haven't started the Kernel yet, but I am about to. I have separate libraries so they are easily replacable if needed (portable, etc).

I currently have the GDT being created in the boot loader, but I want it in the Kernel somewhere in case a different boot loader is ever used, then I can be sure the GDT is always set up as I want it.
My initial thought was to put it in the Kernel project, but I have since thought that maybe it should go in the HAL, as it is specific to x86 architecture. If I ever port to any other architecture, only the HAL is replaced.

Does this sound reasonable? Is there anything I have overlooked?
tushs
Member
Member
Posts: 28
Joined: Mon Aug 02, 2010 7:43 am

Re: Global Decriptor Table Design

Post by tushs »

IF GDT is static and able to compiled by gas then I think no need to put it into HAL. it should be kernel, startup asm file with a function load_gdt(); if required later u can use #ifdef in asm file according to architecture.
Post Reply