Future proofing

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
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Future proofing

Post by DrHaximus »

Hello.
I've been reading the tutorials on the wiki here at osdev.org and found them very helpful. Unfortunately I've been reading around on this forum and apparently:

1) BIOS is becoming more depreciated
2) 32bit is also becoming more depreciated

If this is correct, could anybody redirect me in the correct direction? Also, why are the wiki tutorials still reflecting BIOS/32bit?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Future proofing

Post by bluemoon »

Read on Brendan's response to http://forum.osdev.org/viewtopic.php?f=1&t=26482
BIOS is becoming obsoleted, and it is already being emulated on top of uEFI application on some hardware; however it should still be usable in a few years, and the most important part is that you should design your OS or boot code that rely less on BIOS so that you face less impact for the transition.

32-bit system is however not entirely depreciate, it is widely used on mobile.
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Re: Future proofing

Post by DrHaximus »

Thank you, but I don't plan on developing for mobile platforms.

Also, my two questions still remain, where can I find more updated information?
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Future proofing

Post by iansjack »

Information about both these subjects is widely available via Google. The best reference for 64-bit assembler programming is the Intel (or AMD) Programmer's Reference Manual.
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Re: Future proofing

Post by DrHaximus »

I appreciate the reference, but I'm a newbie and need a bit of a helping hand, do you know any modern books or online resources?
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Future proofing

Post by Brendan »

Hi,
DrHaximus wrote:Thank you, but I don't plan on developing for mobile platforms.

Also, my two questions still remain, where can I find more updated information?
For UEFI: However, I'd advocate some sort of abstraction layer; so that only the boot code cares what the firmware is (and so that the kernel and the rest of the OS doesn't know and doesn't care). This allows you to support BIOS, UEFI, SFI, coreboot, multi-boot, Linux boot protocol, or anything else you could feel like; just by writing a different boot loader.

For 64-bit it's probably best to start with your favourite Intel or AMD manual.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
DrHaximus
Posts: 11
Joined: Wed Mar 27, 2013 9:13 pm

Re: Future proofing

Post by DrHaximus »

Cheers!
Have a good day everyone.
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Future proofing

Post by iansjack »

You can find more information, and references, about UEFI in this Wiki: http://wiki.osdev.org/UEFI
mich
Posts: 18
Joined: Sun Nov 11, 2012 5:36 pm

Re: Future proofing

Post by mich »

To be really future proof I recommend modularizing your OS correctly.

E.g. why would you want to use the BIOS? To get the memory map and to load your kernel from the boot device. Both those things can be combined into a module, let's call it the boot loader. If done correctly the boot loader will hand over control with a defined state to the loaded kernel. The Multiboot specification is a good example of that. Then as Brendan already pointed out it doesn't matter whether your kernel is booted via BIOS, UEFI, coreboot or PXE.

Then do the same with your entire OS. 32bit vs 64bit? Why not use a programming language to hide the differences? So instead of using assembler use C. I was able to "port" a small 32bit x86 kernel to 64bit by merely recompiling it to x86_64, granted I had to modify the boot up process a little so I could call my kernel's entry point in 64bit but on the grand scheme of things this was neglectable. But for this to work you need to be aware of how your C code is compiled to machine code, e.g. you should avoid ambiguous types such as int, unsigned int, ... but rather make your own (or use the one's from stdint.h) int32_t, uint32_t, ... this way you should not have any problems moving between architectures.

Next you must also encapsulate all your hardware dependent code, like drivers. This starts with simple functions such as I/O ports. You might feel tempted to just use inline assembler or whatnot, but you should rather make an interface to the I/O ports which you can then use in both 32bit and 64bit.
Then also do this for your memory management. x86 vs x86_64 paging can be hidden behind an interface, as well, etc.

Now if you do this for you entire OS - that is always thoroughly investigation whether particular code or routine is machine dependent or not 32bit vs 64bit should not be a problem. x86 vs ARM vs PPC will be a little harder to tackle but if modularization of dependant and independent is followed by the book it will also be no problem.
Post Reply