What is architecture independent and dependent?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
AaronMiller
Member
Member
Posts: 81
Joined: Thu Mar 06, 2008 1:26 pm
Location: Roseville, California (USA)
Contact:

What is architecture independent and dependent?

Post by AaronMiller »

This may seem like an idiotic question, but I'm trying to make my kernel architecture independent. That is, isolating the architecture dependent parts from the independent parts. I'm just wondering, is all hardware interfaced the same way? Is it enough to provide drivers with some functions to communicate with the hardware, and then just make sure the drivers are rebuilt for the various architectures? (With the exception of obvious bit-size and endian-ness attributes.) I assume that the answer to both of those is yes, but I want to be certain.

I'm hoping someone can clarify where the line is for me, as I'm uncertain. Thanks for reading.

Cheers,
-naota
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: What is architecture independent and dependent?

Post by JamesM »

The answer is "sometimes". At the hardware level of course each device acts the same no matter what computer it is connected to, however accessing it can be different.

The big difference is memory-mapped I/O versus I/O port access. The x86 is the only mainstream architecture with a dedicated I/O address space. All other architectures use memory-mapped solely. That will affect your design decisions.

Also, the "standard memory map" if there is such a thing for devices (VGA, legacy ISA etc) will not exist on non-x86 computers. Accessing 0xb8000 on a PowerPC for example, will do nothing.

Then you have the bus controllers. Usually the BIOS or boot firmware will initialise the PCI bus for you (or Sbus or Ebus if you're on a legacy SPARC), but scanning the bus may differ. On PowerPC for example, you read the device map that the firmware made for you. No I/O at all. The x86 you read config space. Etc etc.

Honestly, it's a difficult business. We at pedigree made a half-decent job of isolating the hardware-dependent stuff from hardware-independent; we accomplished that by developing for around 5 architectures in parallel to start with, to ensure our abstractions were up to the task. Retrofitting is very difficult: look at the architectures you're interested in first, and see what they need.
User avatar
AaronMiller
Member
Member
Posts: 81
Joined: Thu Mar 06, 2008 1:26 pm
Location: Roseville, California (USA)
Contact:

Re: What is architecture independent and dependent?

Post by AaronMiller »

Thank you very much. That was a very well thought out response. :)
Post Reply