Page 1 of 1

32-bit or 64-bit x86?

Posted: Wed Jul 10, 2024 9:32 pm
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.

Re: 32-bit or 64-bit x86?

Posted: Wed Jul 10, 2024 11:30 pm
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.

Re: 32-bit or 64-bit x86?

Posted: Thu Jul 11, 2024 11:08 am
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.

Re: 32-bit or 64-bit x86?

Posted: Mon Jul 15, 2024 8:59 am
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)

Re: 32-bit or 64-bit x86?

Posted: Mon Jul 15, 2024 11:59 am
by songziming
Always prefer 64-bit. Since x86_64 has larger vmspace, no segments, compliant interrupt stack frame.