Page 1 of 1

Portability

Posted: Wed Aug 21, 2013 3:23 pm
by Primis
The wiki is very x86-centric, however I feel that there should be a page about the theory behind making a kernel portable (or, in a grander scheme, an OS). As I am personally going through the process porting my kernel to PPC, I thought I should make this page:
http://wiki.osdev.org/Portability
It is no where near complete, I just threw together a base. Feel free to discuss and add to it as the community sees fit.
Personally, I think that a portable kernel should be a design feature present on all kernels, if not just because it keeps your source tree cleaner.
--Primis

Re: Portability

Posted: Thu Aug 22, 2013 2:41 am
by AJ
Good idea. Should help people avoid the nightmare of adding portability at a late stage!

Cheers,
Adam

Re: Portability

Posted: Thu Aug 22, 2013 12:01 pm
by arseniuss
I used Linux (and probably other kernel) way that I have directory arch but however I see need for list which arch have which component.
For example paging/MMU may be differently implemented but kernel can have one way how to count free pages despite that they are 4KB or 4KB and 4MB or ....

Re: Portability

Posted: Thu Aug 22, 2013 1:28 pm
by Jezze
For things that might change like what bootloader you use or what architecture you are on I build libraries for those so I have mboot.a for multiboot-compliant bootloaders and stuff like libarm.a or libx86.a for architectures. Then I just pick and choose what components I want during linktime.

Re: Portability

Posted: Thu Aug 22, 2013 2:25 pm
by Marionumber1
Good start, but I have a few suggestions. My first thing is minor, but in Windows NT, the HAL doesn't handle all architecture specific code. The HAL only handles differences between hardware on the same CPU architecture (like 8259 PIC vs APIC, uniprocessor or multiprocessor, whether ACPI is supported). Architecture specific code (like GDT and IDT on x86, Paging) is part of the kernel. Also, I would disagree that drivers are targeted code. Architecture specific code should only contain what the kernel needs to initialize itself.

Re: Portability

Posted: Fri Aug 23, 2013 10:16 am
by Primis
Marionumber1 wrote:Good start, but I have a few suggestions. My first thing is minor, but in Windows NT, the HAL doesn't handle all architecture specific code. The HAL only handles differences between hardware on the same CPU architecture (like 8259 PIC vs APIC, uniprocessor or multiprocessor, whether ACPI is supported). Architecture specific code (like GDT and IDT on x86, Paging) is part of the kernel. Also, I would disagree that drivers are targeted code. Architecture specific code should only contain what the kernel needs to initialize itself.
I wouldn't call myself an expert on portability or kernels, I just like taking initiative. :D If you want, feel free to modify the article, it is a wiki after all