Feasibility to keep GDTR and GDT data only into registers

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Feasibility to keep GDTR and GDT data only into register

Post by Kevin »

Brendan wrote:For protected mode only; have interrupt and exception handlers at CPL=3 (e.g. in a shared library maybe). These could do nothing more than call the kernel (via. SYSCALL or SYSENTER) where the kernel still handles the cause of the interrupt or exception.
Don't even interrupt/trap gates within the same privilege level reload the code segment? Actually, you can't even decide whether it's the same privilege level or not without looking at the GDT (except if you use an LDT, but that wouldn't save anything).
Developer of tyndur - community OS of Lowlevel (German)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Feasibility to keep GDTR and GDT data only into register

Post by Brendan »

Hi,
Kevin wrote:
Brendan wrote:For protected mode only; have interrupt and exception handlers at CPL=3 (e.g. in a shared library maybe). These could do nothing more than call the kernel (via. SYSCALL or SYSENTER) where the kernel still handles the cause of the interrupt or exception.
Don't even interrupt/trap gates within the same privilege level reload the code segment? Actually, you can't even decide whether it's the same privilege level or not without looking at the GDT (except if you use an LDT, but that wouldn't save anything).
D'oh - you're right, you would need a single CS descriptor because CPU doesn't do any "if CS field of IDT entry == current CS" optimisation. :(


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Feasibility to keep GDTR and GDT data only into register

Post by Kevin »

Probably because that would be a similar optimisation as "if cr3 is reloaded with the same value, don't flush the TLB", in other words plain wrong. The GDT could have changed since the shadow registers were initialised from the GDT the last time, so the processor has no choice but to look at it.
Developer of tyndur - community OS of Lowlevel (German)
Post Reply