OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:17 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: enter to protected mode
PostPosted: Tue Oct 10, 2017 9:06 pm 
Offline

Joined: Mon Nov 28, 2016 10:29 am
Posts: 1
hi!
I am new in os development and my english is not good.
I am learning from "Operating System Development Series" in "Brokenthorn". but in linux not windows.
I am in "Tutorial 10: Prepare for the Kernel Part 1". but i can not enter to protected mode. also i'm using qemu.
please HELP ME!


Top
 Profile  
 
 Post subject: Re: enter to protected mode
PostPosted: Wed Oct 11, 2017 7:21 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

I'm afraid that "I can not enter protected mode" is far too vague a problem.

If you want anyone to help you, you need to contact the author of the tutorial (who does frequent these forums), or attempt to do some research and debugging and come back with a more specific question.

Cheers,
Adam


Top
 Profile  
 
 Post subject: Re: enter to protected mode
PostPosted: Wed Oct 11, 2017 8:18 am 
Offline
Member
Member

Joined: Sat Jan 21, 2017 7:35 am
Posts: 35
Why can't you enter protected mode? You should be specific and give a background on what work you have done in your kernel code. You could post a 'portion' of the entering-protected-mode-switch code also.


Top
 Profile  
 
 Post subject: Re: enter to protected mode
PostPosted: Thu Oct 12, 2017 8:35 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
amindelavar wrote:
hi!
I am new in os development and my english is not good.
I am learning from "Operating System Development Series" in "Brokenthorn". but in linux not windows.
I am in "Tutorial 10: Prepare for the Kernel Part 1". but i can not enter to protected mode. also i'm using qemu.
please HELP ME!


As has already been said, we would need to see your source code as it currently exists, or at least the part where you think the problem lies, in order to determine the cause. Further, you need to describe the problem in greater detail; saying it doesn't work without saying what does happen simply isn't sufficient information for us to work with.

That having been said, there is some advice I can give.

First, I would strongly recommend that if you haven't set up version control for your source code, and an offsite repository on a host such as Cloudforge or GitHub, do so now before proceeding with anything else. Trust me, at some point you will delete important files by accident, or have a drive failure, or need to trace back through your changes to find out where a bug was introduced, or want to share your code with someone else in a way that let's them see the latest changes without having to send them updates repeatedly. These things happen to everyone, sooner or later.

If nothing else, it makes asking questions here easier, as you can post a link to the files in the repo rather than pasting large code samples into your messages.

It is about more than just backups; it gives you a record of your changes in a way that makes it easy to search through them. It also allows you to make 'experimental' branches to test things out while leaving your 'trunk' code unchanged, and later you can merge the successful experiments into the trunk. If you get in the habit of committing to VCS regularly, it will save your butt.

Second, I strongly recommend reading the wiki page How To Ask Questions, as well as the Eric S. Raymond essay/how-to article it is based on, "How to Ask Questions the Smart Way". I don't mean this in a condescending way; we've all been novices at one point. Asking questions effectively on Internet message boards is actually a surprisingly involved skill, one which takes time and knowledge to master.

Third, there are known flaws in the Brokenthorn tutorial series; I am not familiar enough with the tutorial personally to point them out, but I expect that there are others here who are. This is not to say that it is a bad tutorial as such. This is pretty much an unavoidable issue with any tutorials in this topic, and for all its problems, it is my understanding that BT is better than many others. It does mean that you need to be judicious in using anyone's tutorials, rather than following them exactly.

Finally, if you haven't already, I would strongly recommend reading the introductory material in the wiki (I know I've already mentioned some of these, but bear with me):


After this, go through the material on the practical aspects of
running an OS-dev project:

Then you should read up on the core technologies for the platform. Assuming that you are targeting the PC architecture, this would be:

I strongly suggest that you read through the first two set of pages in detail, and preferably at least go through the third part briefly, before doing any actual development.

While this is a lot of reading, it simply reflects the due diligence that any OS-devver needs to go through in order to get anywhere. OS development, even as a simple project, is not amenable to the Stack Overflow cut-and-paste model of software development; you really need to understand a fair amount of the concepts and principles before writing any code, and the examples given in tutorials and forum posts generally are exactly that. Copying an existing code snippet without at least a basic idea of what it is doing simply won't do. While learning itself is an iterative process - you learn one thing, try it out, see what worked and what didn't, read some more, etc. - in this case a basic foundation is needed at the start. Without a solid understanding of at least some of the core ideas before starting, you simply can't get very far in OS dev.

Hopefully, this won't scare you off; it isn't nearly as bad as it sounds. It just takes a lot of patience and a bit of effort, a little at a time.

_________________
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.


Top
 Profile  
 
 Post subject: Re: enter to protected mode
PostPosted: Mon Oct 16, 2017 3:53 pm 
Offline
Member
Member
User avatar

Joined: Sun Feb 18, 2007 7:28 pm
Posts: 1564
Hello,

Have you modified the code in any way? How have you confirmed that it is not entering protected mode? Since you are using Linux (most probably with GCC) you will need to modify the boot loader to support your binary image format. Have you done this? We encourage using Bochs debugger to verify that the in memory GDT is correct and single step past the point when the code initiates the far jump to protected mode code. If you are not sure or are convinced that the issue is indeed related to entering protected mode, please feel free to provide us a copy of the disk image for testing in our environments. Also, please let us know if you have modified the code presented in the series in any way.

_________________
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], SemrushBot [Bot] and 85 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