Page 1 of 1

MP detection

Posted: Sat Jan 31, 2009 9:51 am
by boa
Hi,

I am actually trying to add SMP support to a frnd's OS. So i basically need to run some test runs for MP detection... I plan on using the ACPI tables for this. I have been using your tutorial to create bootloader stages, n they've been really useful... I am kinda new to OS development, n have a doubt... I wanna use ur bootloader stages to load a C program that will parse the ACPI tables...(basically the BDA and EBDA areas..)

is it possible to do this using C, and after entering protected mode?? would be really helpful if u could provide some insight.. u've already helped me alot..

also, I have been doin my development so far in a linux environment using NASM and gnu tools.. so if any1 needs any help with how i went abt doin it, I can do that.. thanks again..

Posted: Sat Jan 31, 2009 8:18 pm
by Andyhhp
Hi,

I dont fully understand what you mean by "is it possible to do this using C"

In this tutorial, there are 2 stages to the bootloader written in ASM which loads a kernel written in C/C++.

From that point of view, there is nothing wrong with loading a C program.

In terms of making a C progrma to parse the ACPI tables, that is also completely possible and I would recomend it over trying to do the same in ASM.

~Andrew

Posted: Sat Jan 31, 2009 8:55 pm
by boa
I'm sorry if I didnt make myself clear...

What I meant to ask was... parsing the ACPI tables requires probing the Bios data areas from what I understand.. Once in protected mode is it possible to write C code that can probe those areas, by explicitly using pointers pointing to the required address?

And once I identify the CPUs, is it again possible to startup the APs at that stage? I am sorry for the trouble, but I dont have much experience in OS development.. and your insights would be appreciated. Thanks.

Posted: Sun Feb 01, 2009 6:16 am
by Andyhhp
Hehe - I dont have that much experience either.

Yes - it is completely possible to use C for the things you want.

Enabling Protected Mode changes nothing in memory. The entire address space is the same as before. This includes things like the Real Mode IVT, BDA and EBDA.

As for activating AP's, the C language can do anything that you can do using ASM. If the specific task isnt part of the language itself (such as reading and writing to specific ports), you can just embed some inline ASM to do the task.

~Andrew

Posted: Sun Feb 01, 2009 7:54 am
by boa
thnx I think i get it.. one more question...

I followed the tutorial till the portion wher kernel development in C begins. wel.. I am not too comfortable with MSVC++.. So i kinda stopped there n thought of doin the ACPI parsing in protected mode 32 bit assembly in the small kernel stub that was created at the end of the tutorial b4 that.. Wel, it can b a hell of a job.. Like u said using C can b easier..

Is there anyway that I can use gnu tools? I know there is... but any tutorial or article that you think that would help me continue from where I stopped?? or some advice... would be great... thnx again...

Posted: Sun Feb 01, 2009 4:14 pm
by Andyhhp
I spose MSVC is not for everyone.

http://osdever.net/bkerndev/index.php is as possibly the best explanation of how to use the GNU tools. Ignore all the PHP errors at the top of the pag - the contents is all there at the bottom.

Half of the tutorial is not relevent to what you are doing but it does show you how to use the tools. One thing not to forget is that the GNU toolchain uses AT&T syntax for inline ASM which is very different to the syntax that NASM and MSVC uses.

Hope that help,

~Andrew