"Just make a 32-bit kernel! It's easier!"
No. 32-bit is the past. We're in the future, despite obvious lack of flying cars.
So, anyway, how do I actually go about doing this? I need actual code samples and stuff because I'm a relative noob.
64-bit OS howto
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: 64-bit OS howto
http://wiki.osdev.org/Creating_a_64-bit_kernel. Read the wiki.
Re: 64-bit OS howto
If you're relatively new to the subject, I certainly wouldn't recommend jumping into 64-bit. It makes sense to say 64-bit is the way to go, but it certainly complicates things a lot, for example:amitron94 wrote:"Just make a 32-bit kernel! It's easier!"
No. 32-bit is the past. We're in the future, despite obvious lack of flying cars.
So, anyway, how do I actually go about doing this? I need actual code samples and stuff because I'm a relative noob.
- You will need extra setup to get a 64-bit kernel up and running.
- Long mode requires PAE (it MUST be on before switching), if you never really understood paging or didn't get the hang of it, this will be a bottleneck.
- The easiest ways of getting BIOS interrupts working (VM8086 and switching back to real mode) are impossible (or perhaps possible in some very complicated way if you manage to turn off long mode again, with huge amounts of overhead perhaps). Instead you will need specific drivers or an emulator of some sorts.
EDIT: Nick beat me to it.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.
Re: 64-bit OS howto
So I guess I'll stick to 32-bit, and once I can I'll rewrite it as 64-bit... (I hope by then GRUB 2 will get awesomeness that allows you to launch directly into long mode and stuff, but it's another one of my pipe dreams.)
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: 64-bit OS howto
You know, all of these newbies who run around saying things like "32-bit is archaic" really get tiresome after a while, since they seem not to know what they're talking about as there are millions of embedded devices which are running today on 32-bit low-end CPUs and whose companies are not going to switch to 64-bit processors for an embedded device for at least probably another ~5 years, if so few.
Of course, if you're writing a single-platform kernel for x86-IBM_PC then by all means, go ahead and stick yourself to 64-bit x86. 32-bit CPUs *still* make up the largest CPU-type both in current distribution, and in the number of them that have already been released. and for quite a while after this, they'll remain so.
Of course, if you're writing a single-platform kernel for x86-IBM_PC then by all means, go ahead and stick yourself to 64-bit x86. 32-bit CPUs *still* make up the largest CPU-type both in current distribution, and in the number of them that have already been released. and for quite a while after this, they'll remain so.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: 64-bit OS howto
The most common CPU type in distribution today is 8-bit. By sales volume, it is most probably clones of the Intel 8051 architecture (8-bitters vastly outsell bigger processors, and the 8051 has a large dominance there - largely because it is a defacto standard architecture used by multiple manufacturers).
The single biggest seller of 8-bit microcontrollers is Microchip (And its PIC lines), however.
The single biggest seller of 8-bit microcontrollers is Microchip (And its PIC lines), however.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: 64-bit OS howto
Mm. I see, thanks for the correction .
Either way, the whole "32-bit is gone" argument remains shaky.
Either way, the whole "32-bit is gone" argument remains shaky.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
Re: 64-bit OS howto
The whole point is not to spend time on something that will become obsolete within the foreseeable future. Albeit 64bit will eventually go the way of the Z80, it's not going to happen within the next 10 years and probably not in the next 20.
Although I see the OP's point, I still agree 32bit, if not 16bit, is the way to go for your first OS. One shouldn't fool oneself into thinking one's first attempt will be worth anything but the knowledge one gains from making it, as soon as one starts to get anything of any importance one will realize the mistakes one made while learning. Those mistakes will be numerous.
Although I see the OP's point, I still agree 32bit, if not 16bit, is the way to go for your first OS. One shouldn't fool oneself into thinking one's first attempt will be worth anything but the knowledge one gains from making it, as soon as one starts to get anything of any importance one will realize the mistakes one made while learning. Those mistakes will be numerous.