Page 1 of 1
64-bit OS howto
Posted: Fri Apr 23, 2010 12:36 pm
by amitron94
"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.
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 1:55 pm
by NickJohnson
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 1:57 pm
by Creature
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.
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:
- 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.
If that didn't convince you, Stephan Van Schaik is working on a
tutorial relating 64-bit and long mode. Other information may be found on the wiki.
EDIT: Nick beat me to it.
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 2:53 pm
by amitron94
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.)
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 5:07 pm
by gravaera
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.
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 7:18 pm
by Owen
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.
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 8:12 pm
by gravaera
Mm. I see, thanks for the correction
.
Either way, the whole "32-bit is gone" argument remains shaky.
Re: 64-bit OS howto
Posted: Fri Apr 23, 2010 9:04 pm
by TylerH
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.