Help me write an x64 OS making tutorial!

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
moo
Posts: 2
Joined: Tue Jan 24, 2017 8:01 am
Libera.chat IRC: moo_we_all_do

Help me write an x64 OS making tutorial!

Post by moo »

Hi! :D

I've visited making a bootloader once or twice before (https://github.com/cfenollosa/os-tutorial) but I never actually understood it well. Some of my questions were "What do all the registers mean?" and "Why are we using a 16 and 32 bit mode, and not just a 64-bit mode? What do modes even mean?"

So I'm calling for help to make a tutorial on how to build a basic operating system. One where you don't have to Google every single thing or go back to previous pages. Here's how I'm probably going to structure it:
  • Introduction to ASM: Printing "Hello, World!"
    ASM: What are registers and what do they mean?
    ASM: Preparing to load up a kernel
    C: Your first kernel
    C: Drawing shapes
    C: Taking input
The parts are short because I only want to go over the basics, but this whole time I've been assuming that you don't have to enable a 16 or 32 bit mode to enter it. (This is due to the confusion of many tutorials surrounding loading a kernel.)
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Help me write an x64 OS making tutorial!

Post by Kevin »

Please don't write another tutorial that misleads beginners by telling them to write a boot sector. Even more importantly, don't write a tutorial while you're still a beginner yourself.
Developer of tyndur - community OS of Lowlevel (German)
Lowl3v3l
Posts: 8
Joined: Mon Aug 29, 2016 12:33 pm
Libera.chat IRC: Lowl3v3l

Re: Help me write an x64 OS making tutorial!

Post by Lowl3v3l »

The main problem I see with all "tutorials" on osdev ( and many other topics) I see around is the wrong people writing them, usually the ones with not a full understanding. The experts tend to have other things to do. This is a main problem, because most tutorials will introduce nifty little bugs or big falsehoods that way which then just keep on spreading.
One hard question would be wether a "tutorial" is really needed on this extremely vast and complicated topic, i am not sure wether you, even if you got a dozen experts, could write a "tutorial" that covers everything necessesary in reasonable depth( i suppose you'd end up with several libraries that way), so i am more in line with saying "There don't need to be tutorials on osdev, there are books".
So why not just contribute to the wiki? Due to peer review and the inability to write a full "tutorial" in any reasonable time this would be the course of action i'd advise.

One general Tipp : you should NOT use tutorials, especially not ones from youtube. Read books, they are better. The wiki MIGHT be a good source, at least it had some peer review where tutorials most likely hadn't.
moo
Posts: 2
Joined: Tue Jan 24, 2017 8:01 am
Libera.chat IRC: moo_we_all_do

Re: Help me write an x64 OS making tutorial!

Post by moo »

Sorry :?

I learn better when teach, If that makes sense.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Help me write an x64 OS making tutorial!

Post by gerryg400 »

If you need help writing a tutorial, then really, do not write a tutorial.
If a trainstation is where trains stop, what is a workstation ?
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Help me write an x64 OS making tutorial!

Post by gerryg400 »

moo wrote:Sorry :?

I learn better when teach, If that makes sense.
It does not make sense.
If a trainstation is where trains stop, what is a workstation ?
Kevin
Member
Member
Posts: 1071
Joined: Sun Feb 01, 2009 6:11 am
Location: Germany
Contact:

Re: Help me write an x64 OS making tutorial!

Post by Kevin »

Well, it does make some sense. It's more or less the same as rubber duck debugging. Just make sure that you don't publish it.
Developer of tyndur - community OS of Lowlevel (German)
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Help me write an x64 OS making tutorial!

Post by gerryg400 »

Kevin wrote:Well, it does make some sense. It's more or less the same as rubber duck debugging. Just make sure that you don't publish it.
Agreed.
If a trainstation is where trains stop, what is a workstation ?
stevej150
Posts: 23
Joined: Wed Jan 25, 2017 8:16 am

Re: Help me write an x64 OS making tutorial!

Post by stevej150 »

You just make a tutorial without any knowledge? Don't copy and paste. Learn what things mean. Otherwise, don't make a tutorial.
One day in the future... computers will be holograms...
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: Help me write an x64 OS making tutorial!

Post by SpyderTL »

On the other hand, adding pages to the Wiki, or editing existing pages helped me a lot when I was just getting started.

This may be a better approach...
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
joegantic
Posts: 9
Joined: Thu Feb 16, 2017 2:10 pm

Re: Help me write an x64 OS making tutorial!

Post by joegantic »

You don't even know how to do Assembly and you want to teach it? That's insane. You don't teach football if you don't even know about the scores. You don't teach swimming or basketball if you don't know how to play. Learn Assembly. Then, come back later to a tutorial.
User avatar
MajickTek
Member
Member
Posts: 101
Joined: Sat Dec 17, 2016 6:58 am
Libera.chat IRC: MajickTek
Location: The Internet
Contact:

Re: Help me write an x64 OS making tutorial!

Post by MajickTek »

Note to the OP and anyone else reading this thread: If you absolutely need help writing a tutorial, maybe you should read one first.
Everyone should know how to program a computer, because it teaches you how to think! -Steve Jobs

Code: Select all

while ( ! ( succeed = try() ) ); 
x64dev
Posts: 16
Joined: Sun Feb 26, 2017 4:42 pm
Libera.chat IRC: x64dev

Re: Help me write an x64 OS making tutorial!

Post by x64dev »

moo wrote: The parts are short because I only want to go over the basics, but this whole time I've been assuming that you don't have to enable a 16 or 32 bit mode to enter it. (This is due to the confusion of many tutorials surrounding loading a kernel.)
If the pc starts using the BIOS then it will be in 16-bit mode. If you want to go to 64-bit long mode then you need to switch to 32-bit protected mode, set some control registers, setup a page tabel, enable paging, create a task state segment (TSS), enable long mode and jump to the first identity-mapped 64-bit page at which point you will be in long mode executing the 64-bit code that needs to continue booting the system.
Post Reply