OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 23, 2017 3:45 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: A new page in frequently asked questions
PostPosted: Wed Mar 08, 2017 10:04 pm 
Offline
User avatar

Joined: Mon Feb 20, 2017 1:01 am
Posts: 13
Location: The Moon
I see a page in FAQ called [wiki]http://wiki.osdev.org/I_Can%27t_Get_Interrupts_Working[/wiki]. However, I see many forum posts saying that loading the GDT causes a triple fault. I created one of these forum posts a few days ago, and I got good answers with simple fixes. So, why don't we create a "Help! I can't get a GDT working"?

_________________
Developing an OS that is so early in development, it can't do anything because stupid me can't figure out interrupts
Image


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Sun Mar 12, 2017 9:39 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1069
It's a wiki, anyone can create any page. If there's a page that you think should exist, then create it.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Mon Mar 13, 2017 8:18 pm 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2050
Location: Bucharest, Romania
I wonder whether it's really necessary to have a page on the GDT, another on the instruction that loads it, a tutorial on how to set it, a whole bunch of other pages describing x86 segmentation and related things, and now a dedicated FAQ. It's just a simple record whose fields describe segments. I think the problem is not missing information but very poor computer science education on elementary topics.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Tue Mar 14, 2017 2:48 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 751
Love4Boobies wrote:
I wonder whether it's really necessary to have a page on the GDT, another on the instruction that loads it, a tutorial on how to set it, a whole bunch of other pages describing x86 segmentation and related things, and now a dedicated FAQ. It's just a simple record whose fields describe segments. I think the problem is not missing information but very poor computer science education on elementary topics.


I think it has more to do with the ability to work with information than with basics of CS per se.
It's about dealing with unknown unknown, filling the gaps, which is aggravated by several factors: too much info, not easy to digest due to the way written, not just the sheer amount, and, finally, in the particular case of system things like GDT, IDT and page translation the ease of screwing up. It either works or, most often, during the first several attempts, it does not and the code crashes spectacularly and there's little clue available immediately as to why.


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Tue Mar 14, 2017 10:24 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2050
Location: Bucharest, Romania
Perhaps I'm wrong about this but I remain unconvinced that it has to do with any of the things you've mentioned because people are usually quite comfortable dealing with huge amounts of incomplete information in their regular lives. The one exception to this is the dry way in which technical documentation is written but, on the other hand, it seems a lot simpler to interpret a text whose meaning is literal than to extract meaning from a great novel. It seems to me that the only time people get truly lost is when they are on unfamiliar territory.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Tue Mar 14, 2017 11:28 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 7821
Location: At his keyboard!
Hi,

beauhefley wrote:
I see a page in FAQ called [wiki]http://wiki.osdev.org/I_Can%27t_Get_Interrupts_Working[/wiki]. However, I see many forum posts saying that loading the GDT causes a triple fault. I created one of these forum posts a few days ago, and I got good answers with simple fixes. So, why don't we create a "Help! I can't get a GDT working"?


Because everyone has different bugs you'd need a tree of many questions. Something like:

Is loading the GDT supposed to cause a general protection fault (for security reasons - e.g. because the code is running at CPL=3):
    Yes: Congratulations, your kernel is secure!
    No: Is the "GDT pointer" accessible (e.g. with normal read, like "mov eax,[GDTpointer]" instead of "lgdt [GDTpointer]")?
      No: There's probably a problem with the segment (e.g. DS) that you had before attempting to load a GDT, or some other issue (e.g. page fault, where page fault handler can't start and triggers a general protection fault).
      Yes: Is the GDT limit correct?
        No:.....

What you really want is an expert system; where it'll start by asking the previously stored questions, and if the previously stored questions don't lead to a solution it'll allow the questions and answers to be extended/improved if/when a solution is found elsewhere.


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.


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Tue Mar 14, 2017 4:16 pm 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2050
Location: Bucharest, Romania
I think what most people want is to have the code handed to them. If they don't have the time to study the documentation, they certainly don't have time to go through every possible scenario.

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Wed Mar 15, 2017 3:32 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 751
Love4Boobies wrote:
Perhaps I'm wrong about this but I remain unconvinced that it has to do with any of the things you've mentioned because people are usually quite comfortable dealing with huge amounts of incomplete information in their regular lives.

In our "regular lives" we don't have to be exactly precise in like a hundred of subsequent actions. Our movements are approximate, but we still make it from point A to point B. Our judgement (including risk assessment) is often quite sloppy too, but we can still live and multiply all the while doing silly things and believing strange things. Wrong change at the store? Thinking a person is (being) mean if they don't smile at you or chitchat with you? Imprecision and mistakes here usually don't cause grave immediate problems. And often times you can interact with other people to get issues resolved. Here, OTOH, you can't plead, incentivize or threaten the CPU to run your code to your satisfaction. You need to talk to it by the book. With precision. Step by step for hundreds of steps. And the book is big and boring. And it has a number of mistakes and ambiguities here and there and you have to make sense of it. Every little thing you ignore because you think you know it or you think it's unimportant, while in reality it's the other way around, every little thing like that may be the very reason why the CPU is "acting up".

Love4Boobies wrote:
The one exception to this is the dry way in which technical documentation is written but, on the other hand, it seems a lot simpler to interpret a text whose meaning is literal than to extract meaning from a great novel. It seems to me that the only time people get truly lost is when they are on unfamiliar territory.

But maybe you're right. Maybe both of us are right. If you make the circle noting that people turn to other people with their programming problems and eventually figure stuff out, become comfortable and skilled... :)


Top
 Profile  
 
 Post subject: Re: A new page in frequently asked questions
PostPosted: Wed Mar 15, 2017 6:32 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1069
On topic, my experience is that the majority of GDT problems are caused by having the wrong data in the table itself. Not understanding how the base addresses and lengths are stored, not understanding what the various bit flags mean or where they're stored, and so on. Usually an endianess or bit-ordering problem, sometimes a lack of understanding of what all the terminology means. These problems become especially noticeable when one is trying to use something other than a flat memory model (or with a flat or semi-flat memory model, in a year's time when they eventually exceed the incorrectly-set limit of their kernel code segment or whatever).

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group