Questions about IDT
Posted: Tue Jun 04, 2019 1:53 pm
I know James Molloy's tutorial has its issues, but I didn't find these mentioned on the list so I was wondering if it's OK to do things this way or not.
1. His code sets all gates as interrupt gates, including the first 32 reserved for CPU interrupts, which I imagine should be set as trap gates instead. According to the wiki, the difference between the two is minimal (automaticaly disabled and reenabled interrupts for interrupt gates but not for trap gates), but surely there's a good reason why trap gates are a separate type?
2. When setting a gate, his code explicitly always changes the DPL to ring 3, which according to my understanding means that usermode code can also trigger CPU and hardware interrupts in addition to software interrupts. This is bad right?
1. His code sets all gates as interrupt gates, including the first 32 reserved for CPU interrupts, which I imagine should be set as trap gates instead. According to the wiki, the difference between the two is minimal (automaticaly disabled and reenabled interrupts for interrupt gates but not for trap gates), but surely there's a good reason why trap gates are a separate type?
2. When setting a gate, his code explicitly always changes the DPL to ring 3, which according to my understanding means that usermode code can also trigger CPU and hardware interrupts in addition to software interrupts. This is bad right?