Resources needed to GDT fault handeling

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.
Post Reply
andrewshi98
Posts: 1
Joined: Thu Aug 20, 2020 9:21 pm
Libera.chat IRC: Andrew

Resources needed to GDT fault handeling

Post by andrewshi98 »

What happen when a kernel try to cause a segmentation error? Does this access generate an interrupt? What happen if the kernel has turned the interrupt off? Does that mean GDT is not in use when the interrupt is off?

Sorry if the answer seem too obvious or demonstrate substantial misunderstanding towards how GDT work. It would be greatly appreciated if you could give some resources on what GPT is trying to protect against and what happen when there is an invalid access to memory according to GPT.
alexfru
Member
Member
Posts: 1111
Joined: Tue Mar 04, 2014 5:27 am

Re: Resources needed to GDT fault handeling

Post by alexfru »

andrewshi98 wrote:What happen when a kernel try to cause a segmentation error? Does this access generate an interrupt?
An exception (typically, #GP, see the CPU documentation). It is a kind of hardware interrupt originating not from an external device, but from the CPU itself.
andrewshi98 wrote:What happen if the kernel has turned the interrupt off?
You still get the exception.
andrewshi98 wrote:Does that mean GDT is not in use when the interrupt is off?
The GDT is pretty much always in use because the various segment protection checks stay in place even when there are no outside interrupts.
andrewshi98 wrote:Sorry if the answer seem too obvious or demonstrate substantial misunderstanding towards how GDT work. It would be greatly appreciated if you could give some resources on what GPT is trying to protect against and what happen when there is an invalid access to memory according to GPT.
Check out the official intel or AMD documentation on the CPU. It's been documented since the i80386 (Intel 80386 Programmer's Reference Manual 1986). You may actually want to start with that old document because it's shorter than the current one.
Post Reply