Page 2 of 3

Re:pascal os development

Posted: Wed Jun 01, 2005 7:03 pm
by Crazed123
That kernel could've been smaller, some of that system unit was bloated.

I've got something good going with mine. The idea is that you delegate CPU dependent functions such as your assembler and whatnot to the RTL, along with making yourself able to use FPC's built in memory management features like AnsiStrings and dynamic arrays. Kernel and exception stubbing is also done in there. Makes your kernel kind of big, but that's because your putting some of the kernel code in RTL, which leads to a slight excess.

The kernel itself then contains actual physical and logical memory routines, a console driver, and kernel policies.

Re:pascal os development

Posted: Thu Jun 02, 2005 2:34 am
by Kim
Indeed the kernel could be allot smaller, buts its a multiboot-compliant hello world kernel.
And the system unit could be as big as a couple of lines...

Under what license is freepascal's rtl, LGPL?
I think its best to write your own mini rtl in pure pascal code and not asm so its easy portable (and hoping the compiler optimizes it decent :p )... and you don't have to worry about some license.

Edit: and there shouldn't be any problems of linking your own rtl to the compiler.

Re:pascal os development

Posted: Thu Jun 02, 2005 7:04 pm
by Crazed123
Write the RTL portable and the kernel not?

Re:pascal os development

Posted: Fri Jun 03, 2005 3:44 am
by Kim
A kernel can't be 100% portable, because every architecture is different. An kernel is always splitted in two big parts crossplatform code and architecture dependent code.

Re:pascal os development

Posted: Fri Jun 03, 2005 12:04 pm
by srg
Out of interest, what is GNU Pascal generally like compaired to FreePascal. For this or anything?

srg

Re:pascal os development

Posted: Fri Jun 03, 2005 1:09 pm
by Kim
http://www.freepascal.org/faq.html#FPandGNUPascal

This could answer your question...

Iam using freepascal because I use winxp, and gnu pascal needs a posix shell to work and doesn't have all the features (lang extensions) I want.

Re:pascal os development

Posted: Fri Jun 03, 2005 1:12 pm
by srg
Kim wrote: http://www.freepascal.org/faq.html#FPandGNUPascal

This could answer your question...

Iam using freepascal because I use winxp, and gnu pascal needs a posix shell to work and doesn't have all the features (lang extensions) I want.
I see, well cygwin would solve the posix shell problem.

I'll read that page.

srg

Re:pascal os development

Posted: Tue Jun 07, 2005 4:50 pm
by kerim
Hi, I'm almost done with setting up a Pascal OSDev web site, so if anyone of you guys have any docs related to OS development in pascal, or you have any suggestions, ideas or anything, please mail me : [email protected]

Thanx :)

Re:pascal os development

Posted: Thu Jun 16, 2005 12:34 am
by kerim
I've finished setting up a Pascal OSDev forum (for now, web site should be active in about 10 days beacuse of my faculty obligations). So, I invite all those Pascal programmers who want to make their OS in Pascal to join us.

Re:pascal os development

Posted: Thu Jun 16, 2005 6:19 pm
by Crazed123
I looked at that 32-bit Hello World you posted and have two questions:

1.Where is the kernel entrypoint? You seem to have defined kmain(), but not a program... end. statement to be found.
2.If you wanted to adapt that kernel for Object Pascal features such as classes and dynamic arrays, how would you do it?

Re:pascal os development

Posted: Fri Jun 17, 2005 10:11 am
by Kim
As you can see in the linker script -> ENTRY(kstart)

Entrypoint of the kernel image is kstart a function inside the asm stub. Then the asm stub calls our pascal function kmain -> the entry into the pascal part of the kernel.

The only differents from a program unit and a normal unit is that the program unit has a begin end; part. And you can't pass params to that entry point. So i used a normal unit as entry to the pascal part of the kernel, where i defined the entry kmain with all the params(here the multiboot info) i needed.

About Object Pascal -> you can't use this from the start of your kernel, obj pascal needs a runtime, like c++. For example you code mystring := someotherstring; the compiler compiles this by calling functions defined in the runtime library (rtl). So if you got your basic kernel writen in normal pascal you can add an runtime to your kernel that defines compiler needed functions for example allocating memory for a new object. So later when you write some kind of interface to hardware you could use an object based implementation, because you defined everything the compiler needs to use objects.

Edit:
You can give a program begin end; part params by writing a correct gprt0.as, stub the compiler needs. Both way's do come out the same and the implementation +- looks the same.

Check out this freepascal kernel writen by Yury B. (iam not sure about the name) uses begin end;: http://heanet.dl.sourceforge.net/sourceforge/stormdos/sd32_0_01.tar.bz2

Re:pascal os development

Posted: Fri Jun 17, 2005 11:02 am
by Crazed123
He also wrote the template to the RTL I've built.

I realize the kernel needs to provide some runtime stuff. What I was wondering was how do you define that in your RTL and then link it to the rest of the Object Pascal code.

Re:pascal os development

Posted: Mon Jun 20, 2005 1:20 pm
by Kim
Something like this ??? Iam not sure but when I ever get to the point of writing a real rtl that I want to link to the compiler ill ask in the freepascal boards. If you ever find out plz share it with us :)

Code: Select all

{$define FPC_SYSTEM_HAS_FPC_SHORTSTR_COPY}
procedure int_strcopy(len:longint;sstr,dstr:pointer);[public,alias:'FPC_SHORTSTR_COPY'];

Re:pascal os development

Posted: Mon Jun 20, 2005 3:00 pm
by Dex4u
Have you seen the freepascal os called "AnonymOS" or some thing like that, i can not find the link to it, but i have on a disk some were, if you want it let me know.

Re:pascal os development

Posted: Wed Jun 22, 2005 9:11 am
by Crazed134
Sure, put it up here. The original website's gone down.

You say it's an example of how to build an RTL for a kernel with real runtime capabilities?