32-bit or 64-bit x86?

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
glolichen
Posts: 15
Joined: Wed Jul 10, 2024 9:23 pm

32-bit or 64-bit x86?

Post by glolichen »

Currently working on an x86 OS and made some progress (some basic paging, etc), but obviously not that deep in yet. I would like to know whether transitioning to x86-64 is a good idea, since that's more modern and "looks easier" to some degree. Thanks.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: 32-bit or 64-bit x86?

Post by iansjack »

Assuming you are not targeting 32-bit only hardware, I would go for 64-bit. The virtually unlimited address space makes life much easier.
nullplan
Member
Member
Posts: 1789
Joined: Wed Aug 30, 2017 8:24 am

Re: 32-bit or 64-bit x86?

Post by nullplan »

In 64-bit mode, you have a lot of advantages like a somewhat better interrupt system (though the IST interrupts somewhat ruin it), a virtual address space that is guaranteed to be larger than the physical one, and of course easier access to 64-bit physical addresses (yes, you can use PAE in 32-bit mode to get to those, but that has its own issues).

The only reason for 32-bit mode in this day and age is legacy support. Oh, and RDOS wants it for segmentation. Everyone else should start with 64-bit mode or transition to it very quickly.
Carpe diem!
rdos
Member
Member
Posts: 3296
Joined: Wed Oct 01, 2008 1:55 pm

Re: 32-bit or 64-bit x86?

Post by rdos »

When x86 CPUs that cannot handle segmentation and protected mode dominate the market, I might consider x86_64, or I might stop doing OS development (most likely the latter).

Besides, I like challenging environments more than easy. Designing a 32-bit OS is more challenging, particularly if you want to be able to use 1TB of physical memory. After all, I could do Java development instead of OS development since the former is much easier and gives quicker results. The main challenge with an OS project is that you could write ALL of the code yourself, and not having to rely on anybody else. And you could solve all the design issues the way you want them to be solved rather than relying on other people's poor design choices.

Ah, and by the way, x86_64 doesn't allow you to run good-ole DOS applications natively. 8)
songziming
Member
Member
Posts: 70
Joined: Fri Jun 28, 2013 1:48 am
Contact:

Re: 32-bit or 64-bit x86?

Post by songziming »

Always prefer 64-bit. Since x86_64 has larger vmspace, no segments, compliant interrupt stack frame.
Reinventing the Wheel, code: https://github.com/songziming/wheel
Post Reply