comp.lang.ada
 help / color / mirror / Atom feed
* GNAT and no runtime
@ 2004-05-25 20:57 JCS
  2004-05-26  7:46 ` Rolf Ebert
                   ` (2 more replies)
  0 siblings, 3 replies; 29+ messages in thread
From: JCS @ 2004-05-25 20:57 UTC (permalink / raw)


Hi,

I'm trying to create a toy-OS in Ada and I'm still in the very begining
yet.
The "kernel" can boot (with the help of GRUB), I can print a "Hello
world" text, and retrieve some informations from the bootloader.
Before going further, I would like to take advantage of Ada, so at least
use exceptions.

Obviously, the program can't use the GNAT library, and it is so not
linked with it. I also use the pragma No_Runtime, to be sure I'm not using
anything which would require the runtime.

So then, I enabled the checks, and the linker complained about the missing
"__gnat_last_chance_handler" reference. In the GNAT manual, there is a
small reference to this function but somewhat unclear in the
implementation defined characteristics section:
===========================================================
No_Exception_Handlers 
This restriction ensures at compile time that there are no explicit
exception handlers. It also indicates that no exception propagation will
be provided. In this mode, exceptions may be raised but will result in an
immediate call to the last chance handler, a routine that the user must
define with the following profile: 

procedure Last_Chance_Handler (Source_Location : System.Address; Line : Integer); pragma Export (C, Last_Chance_Handler, "__gnat_last_chance_handler"); 

The parameter is a C null-terminated string representing a message to be
associated with the exception (typically the source location of the raise
statement generated by the compiler). The Line parameter when non-zero
represents the line number in the source program where the raise occurs
===========================================================
OK, so I made this routine print a litle message and do an endless loop.
To test it, I put a "raise Constraint_Error;" in my main routine,
obviously without any handler for it.
It linked correctly, and it worked, except that Source_Location where
pointing to an empty string (but the line was correct).

Not so bad, so then I tried to define my own exception, still in my main
routine, I wrote sth like:
  procedure main is
    ...
    My_Error : exception;
  begin
    ...
    raise My_Error;
  end main;

But now, it refuses again to link. I got some undefined references,
mainly in the elaboration code. It wants to elaborate:
  Ada.Exceptions
  System.Exception_Table
  System.Exceptions
  System.Soft_Links
  System.Secondary_Stack
And in the main program, I get an undefined reference to
 Ada.Exceptions.Raise_Exception

I'm a bit surprised, why is it so different than with a predefined
exception?
I didn't think that exceptions need OS-specific functions...

Note also: when I use "pragma No_Return(main);", I get a warning with
My_Error and not with Constraint_Error: 
"main.adb:31: attention : `noreturn' function does return"
That seems stupid, the function does not return, doesn't it?!

So you probably guess my question: is there a solution?
Do I have to implement something?

Cheers,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-25 20:57 GNAT and no runtime JCS
@ 2004-05-26  7:46 ` Rolf Ebert
  2004-05-26 12:17   ` JCS
  2004-05-28 15:13   ` JCS
  2004-05-26 10:52 ` Wojtek Narczynski
  2004-05-26 16:44 ` sk
  2 siblings, 2 replies; 29+ messages in thread
From: Rolf Ebert @ 2004-05-26  7:46 UTC (permalink / raw)


JCS <SANS.SPAM@MERCI.FR> wrote in message news:<pan.2004.05.25.20.56.53.697296@hejmreto.net>...
> Hi,
> 
> I'm trying to create a toy-OS in Ada and I'm still in the very begining
> yet.

The project sounds ambitious, but it can be a lot of fun.

I cannot answer your detailed questions.  I once had a look at the
GNAT runtime, too.  A good starting point is the private part of
system.ads and the corresponding explanations in targparm.ads.

Start slowly putting more and more things to your runtime.  You almost
certainly already have system.ads and some dummy (i.e. empty)
libgnat.a.  That is needed even in the case of No_Runtime.   You can
easily add things like a-uncconv, s-stoele, interface, s-maccod.  They
all just need to be present at compile time, but aren't needed at link
time (OK, the .ali's are, not the .o).

I highly recommend the free book "A Detailed Description of the GNU
Ada Run Time" at http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/index.htm.
 Things have changed a bit in gcc-3.4, but that are details.

Replace the pragma restriction (No_Runtime) in gnat.adc by all the
detailed restrictions that you can find.  Then remove the restriction
that you don't want to enforce anymore and see what runtime support is
needed and add it to your project.

HTH

     Rolf



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-25 20:57 GNAT and no runtime JCS
  2004-05-26  7:46 ` Rolf Ebert
@ 2004-05-26 10:52 ` Wojtek Narczynski
  2004-05-26 12:33   ` JCS
  2004-05-26 19:51   ` Georg Bauhaus
  2004-05-26 16:44 ` sk
  2 siblings, 2 replies; 29+ messages in thread
From: Wojtek Narczynski @ 2004-05-26 10:52 UTC (permalink / raw)


Hello,

> I'm trying to create a toy-OS in Ada and I'm still in the very begining
> yet.

Two good sources of information on GNAT runtime:

http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/main.htm
http://polaris.dit.upm.es/~str/proyectos/ork/

(The second may be more interesting for you)

> The "kernel" can boot (with the help of GRUB), I can print a "Hello
> world" text, and retrieve some informations from the bootloader.

Congrats! Did you use / tweak the b~main.ad[sb] (binder) code?

> Before going further, I would like to take advantage of Ada, so at least
> use exceptions.

I think you can "gnatmake" your program with -a (Consider all files)
to find out which files from the runtime are necessary for it to run.
For your Main procedure it gives:

s-stalib.adb, a-except.adb, system.ads, s-exctab.adb, s-memory.adb,
s-soflin.adb, ada.ads, a-elchha.adb, interfac.ads, s-mastop.adb,
s-secsta.adb, s-stoele.adb, s-traceb.adb, s-unstyp.ads, s-traent.adb,
s-htable.adb, s-crtl.ads, s-parame.adb, s-stache.adb, s-maccod.ads,
s-except.ads

It is very likely that you'll have to tweak some of those files.

By the way, do you know how to expand those filenames to full names,
or at least create symlinks with full length names? It would be so
much easier...

Regards,
Wojtek



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26  7:46 ` Rolf Ebert
@ 2004-05-26 12:17   ` JCS
  2004-05-28 15:13   ` JCS
  1 sibling, 0 replies; 29+ messages in thread
From: JCS @ 2004-05-26 12:17 UTC (permalink / raw)


On Wed, 26 May 2004 00:46:26 -0700, Rolf Ebert wrote:
> Start slowly putting more and more things to your runtime.  You almost
> certainly already have system.ads and some dummy (i.e. empty)
> libgnat.a.
Well, not exactly, I still use the predefined specs, and do not link with
any form of library (I don't use gnatlink, but directly ld instead)

> That is needed even in the case of No_Runtime.   You can easily add
> things like a-uncconv, s-stoele, interface, s-maccod.  They all just
> need to be present at compile time, but aren't needed at link time (OK,
> the .ali's are, not the .o).
I see, you suggest that I implement a minimal subset of libgnat. I was not
planning to do that so soon. I though it wouldn't be necessary for the
kernel itself. But it seems that I was wrong. Hope it won't be too hard...
I've already looked a bit in the GNAT sources, but to be honnest I was a
bit lost, the link you gave will probably be very helpful. Thanks.

> 
> Replace the pragma restriction (No_Runtime) in gnat.adc by all the
> detailed restrictions that you can find.  Then remove the restriction
> that you don't want to enforce anymore and see what runtime support is
> needed and add it to your project.
Yes, this is exactly what I've done, except that I still use pragma
No_Runtime, just to be sure of what I'm enabling when I delete a
restriction.

Many thanks Rolf,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 10:52 ` Wojtek Narczynski
@ 2004-05-26 12:33   ` JCS
  2004-05-26 16:05     ` Martin Krischik
  2004-05-27 10:23     ` Wojtek Narczynski
  2004-05-26 19:51   ` Georg Bauhaus
  1 sibling, 2 replies; 29+ messages in thread
From: JCS @ 2004-05-26 12:33 UTC (permalink / raw)


On Wed, 26 May 2004 03:52:40 -0700, Wojtek Narczynski wrote:
> http://polaris.dit.upm.es/~str/proyectos/ork/
Thanks.

>> The "kernel" can boot (with the help of GRUB), I can print a "Hello
>> world" text, and retrieve some informations from the bootloader.
> 
> Congrats! Did you use / tweak the b~main.ad[sb] (binder) code?
I use the binder code, yes.
But why would I need to tweak it? (Futhermore it would be annoying since
it is regenerated at each compile!)

>> Before going further, I would like to take advantage of Ada, so at
>> least use exceptions.
> 
> I think you can "gnatmake" your program with -a (Consider all files) to
> find out which files from the runtime are necessary for it to run. For
> your Main procedure it gives:
> 
> s-stalib.adb, a-except.adb, system.ads, s-exctab.adb, s-memory.adb,
> s-soflin.adb, ada.ads, a-elchha.adb, interfac.ads, s-mastop.adb,
> s-secsta.adb, s-stoele.adb, s-traceb.adb, s-unstyp.ads, s-traent.adb,
> s-htable.adb, s-crtl.ads, s-parame.adb, s-stache.adb, s-maccod.ads,
> s-except.ads
> 
> It is very likely that you'll have to tweak some of those files.
Yes, what a work for just a "hello world" message! :-)

> By the way, do you know how to expand those filenames to full names, or
> at least create symlinks with full length names? It would be so much
> easier...
No, I would also be interested by the answer since the big file set of
GNAT is somewhat confusing.

Thanks,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 12:33   ` JCS
@ 2004-05-26 16:05     ` Martin Krischik
  2004-05-27  9:40       ` Wojtek Narczynski
  2004-05-28 20:42       ` Wojtek Narczynski
  2004-05-27 10:23     ` Wojtek Narczynski
  1 sibling, 2 replies; 29+ messages in thread
From: Martin Krischik @ 2004-05-26 16:05 UTC (permalink / raw)


JCS wrote:

> On Wed, 26 May 2004 03:52:40 -0700, Wojtek Narczynski wrote:
>> http://polaris.dit.upm.es/~str/proyectos/ork/
> Thanks.
>> By the way, do you know how to expand those filenames to full names, or
>> at least create symlinks with full length names? It would be so much
>> easier...

No chance. Even gnat name or gnat chop won't expand them.

> No, I would also be interested by the answer since the big file set of
> GNAT is somewhat confusing.

The short names are hard coded into gnat. Any package from Ada.* Interface.*
GNAT.*  and System.* must use short name.

A total pain in the ass.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-25 20:57 GNAT and no runtime JCS
  2004-05-26  7:46 ` Rolf Ebert
  2004-05-26 10:52 ` Wojtek Narczynski
@ 2004-05-26 16:44 ` sk
  2004-05-26 17:42   ` JCS
  2 siblings, 1 reply; 29+ messages in thread
From: sk @ 2004-05-26 16:44 UTC (permalink / raw)
  To: comp.lang.ada

Visit

http://www.ktc.com/~sknipe

for a complete bootable GNAT build kernel. Useless
since all it does is say hello and halts the
processor; however, it does show a possible combination
of pragma No_Run_Time and related settings which should
get you where you want to go.


-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 16:44 ` sk
@ 2004-05-26 17:42   ` JCS
  2004-05-26 21:33     ` sk
  0 siblings, 1 reply; 29+ messages in thread
From: JCS @ 2004-05-26 17:42 UTC (permalink / raw)


On Wed, 26 May 2004 11:44:58 -0500, sk wrote:
> Visit
> 
> http://www.ktc.com/~sknipe
> 
> for a complete bootable GNAT build kernel. Useless
> since all it does is say hello and halts the
> processor; however, it does show a possible combination
> of pragma No_Run_Time and related settings which should
> get you where you want to go.

Nope, I looked the document, but there is nothing useful to me, I'm
already after this point. I've even more complex functions and a
better building process.
The author use the "pragma Supress (All_Checks)" and don't raise exception
so obviously there is no such problem than I have.

But a real OS made in Ada should use the builtin checks and generate
exception handling code, at least during the development stage.

Cheers,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 10:52 ` Wojtek Narczynski
  2004-05-26 12:33   ` JCS
@ 2004-05-26 19:51   ` Georg Bauhaus
  2004-05-27  9:43     ` Wojtek Narczynski
  1 sibling, 1 reply; 29+ messages in thread
From: Georg Bauhaus @ 2004-05-26 19:51 UTC (permalink / raw)


Wojtek Narczynski <wojtek@power.com.pl> wrote:
: By the way, do you know how to expand those filenames to full names,
: or at least create symlinks with full length names? It would be so
: much easier...

Maybe you can use this for a start:

$ grep '^package ' *.ads |grep 's-mastop.ads'
s-mastop.ads:package System.Machine_State_Operations is
$



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 17:42   ` JCS
@ 2004-05-26 21:33     ` sk
  2004-05-26 23:12       ` JCS
  0 siblings, 1 reply; 29+ messages in thread
From: sk @ 2004-05-26 21:33 UTC (permalink / raw)
  To: comp.lang.ada

 > The author use the "pragma Supress (All_Checks)" and don't
 > raise exception so obviously there is no such problem than
 > I have.

 > But a real OS made in Ada should use the builtin checks and
 > generate exception handling code, at least during the
 > development stage.

As the author, I am aware of its limitations :-) But, how can
you NOT suppress all checks until you have written the code
to provide the checks.

How can you have builtin's before you have the OS ? It seems
you are arguing the old philisophical conundrum of the chicken
and the egg.

 From my perspective, the author of the mini/toy/silly kernel,
you have to build the hardware coordination next and then
you build a run-time which can interface with the compiler.

My philosophy was/is based in the Intel architecture (i386
and above) which incorporates 4 "rings" of possible kernel
security which I would arrange loosely as follows ...

Ring:
1) Hardware
2) Coordinator/Executive
3) Kernel-to-User interface
4) User Space

... the software exceptions would tend to go in 3 primarily
with hardware exceptions going into 2.

So, I argue, that until you have a more definite CPU/OS
architecture, and a well defined idea of system-services,
expecting to use the GNAT-Run-Time (and porting it and
perhaps supplying a cross-compiler) becomes premature.


-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 21:33     ` sk
@ 2004-05-26 23:12       ` JCS
  2004-05-27 13:58         ` sk
  0 siblings, 1 reply; 29+ messages in thread
From: JCS @ 2004-05-26 23:12 UTC (permalink / raw)


On Wed, 26 May 2004 16:33:55 -0500, sk wrote:

>  > The author use the "pragma Supress (All_Checks)" and don't
>  > raise exception so obviously there is no such problem than
>  > I have.
> 
>  > But a real OS made in Ada should use the builtin checks and
>  > generate exception handling code, at least during the
>  > development stage.
> 
> As the author, I am aware of its limitations :-) But, how can
> you NOT suppress all checks until you have written the code
> to provide the checks.
Checks are builtin (i.e. generated by the compiler). There should be
suppressed only if you assume that you never make mistakes. (wich most 
developers seem to assume! (-: )

> 
> How can you have builtin's before you have the OS ? It seems you are
> arguing the old philisophical conundrum of the chicken and the egg.
No, I'm not willing to have a fully complete sets of tasking, memory
or real-time functionalities at this stage!
I'm just willing to have a basic Ada concept (exceptions) to go further in
the development without passing several days on a small bug because of a
stupid range check I didn't make somewhere in the code (just an exemple).

As for now, I studied a bit how exceptions works in GNAT, and it seems
that the only missing functionality is dynamic
memory allocation/deallocation. 
So now, I will try to make a static version, or maybe I will implement a
very basic dynamic memory allocation.

 
>  From my perspective, the author of the mini/toy/silly kernel,
> you have to build the hardware coordination next and then you build a
> run-time which can interface with the compiler.
Well, Ada exceptions do not involve any hardware support*, it should be
possible to implement them at the lowest level.

*: Well you need a CPU and some small amount of memory plus a basic
screen output function, but if you haven't that, you won't do many things
:-)

> My philosophy was/is based in the Intel architecture (i386 and above)
> which incorporates 4 "rings" of possible kernel security which I would
> arrange loosely as follows ...
> [...]
Even if I disagree with your design, it would be out of topic here.



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 16:05     ` Martin Krischik
@ 2004-05-27  9:40       ` Wojtek Narczynski
  2004-05-28 20:42       ` Wojtek Narczynski
  1 sibling, 0 replies; 29+ messages in thread
From: Wojtek Narczynski @ 2004-05-27  9:40 UTC (permalink / raw)


Hello,

> No chance. Even gnat name or gnat chop won't expand them.

I've taken a look at gnatchop, and it would be relatively easy to make
it expand them. gnatchop invokes gcc like this:

wojtek@slooby:~/work/gnatchop/build> /usr/local/bin/gcc -c -x ada
-gnats -gnatu ~/work/rts/adainclude/a-tasatt.adb
Unit Ada.Task_Attributes (body) line 1, file offset 0, file name
a-tasatt.adb

sometimes

wojtek@slooby:~/work/gnatchop/build> /usr/local/bin/gcc -c -x ada
-gnats -gnatu ~/work/rts/adainclude/a-except.ads
Configuration pragmas at line 1, file offset 0
Unit Ada.Exceptions (spec) line 39, file offset 2867, file name
a-except.ads

Filename can be derived from compilation unit name.

> The short names are hard coded into gnat. Any package from Ada.* Interface.*
> GNAT.*  and System.* must use short name.

Fortunately on some platforms there are hard/sym-links! :-)
 
> A total pain in the ass.

I've had too much. I am not yet sure what would be the cleanest way (a
separate tool based on gnatchop, some new gnatchop options, something
else).

By the way, they fixed target dependent names:

http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/

Is there any justification, other than tradition, for such cryptic
names?

Regards,
Wojtek



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 19:51   ` Georg Bauhaus
@ 2004-05-27  9:43     ` Wojtek Narczynski
  0 siblings, 0 replies; 29+ messages in thread
From: Wojtek Narczynski @ 2004-05-27  9:43 UTC (permalink / raw)


Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de> wrote in message news:<c92sgg$jv5$1@a1-hrz.uni-duisburg.de>...
> Wojtek Narczynski <wojtek@power.com.pl> wrote:
> : By the way, do you know how to expand those filenames to full names,
> : or at least create symlinks with full length names? It would be so
> : much easier...
> 
> Maybe you can use this for a start:
> 
> $ grep '^package ' *.ads |grep 's-mastop.ads'
> s-mastop.ads:package System.Machine_State_Operations is

Please look at my other post about how gnatchop invokes gcc.

Regards,
Wojtek



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 12:33   ` JCS
  2004-05-26 16:05     ` Martin Krischik
@ 2004-05-27 10:23     ` Wojtek Narczynski
  2004-05-27 12:45       ` JCS
  1 sibling, 1 reply; 29+ messages in thread
From: Wojtek Narczynski @ 2004-05-27 10:23 UTC (permalink / raw)


Hello,

> I use the binder code, yes. But why would I need to tweak it?

I was just curious wether you did need to tweak it.

> (Futhermore it would be annoying since it is regenerated at 
> each compile!)

I thought it would be regenerated only when needed.

Regards,
Wojtek



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-27 10:23     ` Wojtek Narczynski
@ 2004-05-27 12:45       ` JCS
  0 siblings, 0 replies; 29+ messages in thread
From: JCS @ 2004-05-27 12:45 UTC (permalink / raw)


On Thu, 27 May 2004 03:23:56 -0700, Wojtek Narczynski wrote:
>> I use the binder code, yes. But why would I need to tweak it?
> 
> I was just curious wether you did need to tweak it.

I just use the "-n" switch to tell the binder there is no main program.
(Well there is, but it is called from assembly).
I also use the "-o" parameter because I don't like the "b~" name, but 
this is just detail.

>> (Futhermore it would be annoying since it is regenerated at each
>> compile!)
> 
> I thought it would be regenerated only when needed.

Yes, but since elaboration code is very dependent on nearly all sources,
it is almost each time regenerated.

Take care,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 23:12       ` JCS
@ 2004-05-27 13:58         ` sk
  2004-05-27 21:30           ` JCS
  0 siblings, 1 reply; 29+ messages in thread
From: sk @ 2004-05-27 13:58 UTC (permalink / raw)
  To: comp.lang.ada

JCS <SANS.SPAM@MERCI.FR>:
 > ... <snip>
 >

So, in sumary, you are porting the GNAT run-time ?

The point I am trying to make is that to port a run-time,
you need to know what you are porting it to ! Replacing
each run-time function at a time will probably work, but
why not actually step back and write the kernel/executive to
achieve your goals and then port the GNAT run-time to your
kernel's capabilities ?

 > Even if I disagree with your design, ...

Not "my design", it is how the Intel (>= i386) chips are built.
Why not use the security/ring features of the chip if they are
available ?

 > ...it would be out of topic here.

Discussion of OS written in Ada off topic ? Sorry, I disagree,
the topic seems appropriate to comp.lang.ada


-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-27 13:58         ` sk
@ 2004-05-27 21:30           ` JCS
  2004-05-27 22:42             ` sk
  0 siblings, 1 reply; 29+ messages in thread
From: JCS @ 2004-05-27 21:30 UTC (permalink / raw)


On Thu, 27 May 2004 08:58:10 -0500, sk wrote:

> JCS <SANS.SPAM@MERCI.FR>:
>  > ... <snip>
>  >
> 
> So, in sumary, you are porting the GNAT run-time ?
Not the whole, just a very small subset of it, just to have exceptions
working. In fact, I would be perfectly happy if I didn't have to
reimplement some GNAT RT functions, but unfortunately it seems that I have
to.

> The point I am trying to make is that to port a run-time, you need to
> know what you are porting it to ! Replacing each run-time function at a
> time will probably work, but why not actually step back and write the
> kernel/executive to achieve your goals and then port the GNAT run-time
> to your kernel's capabilities ?
You probably misunderstand me, I was wishing exception because it helps to
develop my kernel, it's not a functionnality of the kernel. See it as a
debug feature.

> 
>  > Even if I disagree with your design, ...
> 
> Not "my design", it is how the Intel (>= i386) chips are built. Why not
> use the security/ring features of the chip if they are available ?
A short answer: ring 1 and 2 in the Intel protection mechanism are almost
useless, they don't provide any useful instruction that are in ring 0, but
they can access all memory of user-levels apps (ring 3).
Btw, the only system who use ring 2 is OS/2 and it was for some graphics
stuff. I don't know any real-life OS which use ring 1.
Almost all others processors have only 2 protections levels: supervisor
(ring 0 on Intel) and application (ring 3 on Intel). But again it is out
of topic here.

>  > ...it would be out of topic here.
> 
> Discussion of OS written in Ada off topic ? Sorry, I disagree, the topic
> seems appropriate to comp.lang.ada

Simply, it is more OS design relative than Ada relative.

Regards,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-27 21:30           ` JCS
@ 2004-05-27 22:42             ` sk
  0 siblings, 0 replies; 29+ messages in thread
From: sk @ 2004-05-27 22:42 UTC (permalink / raw)
  To: comp.lang.ada

 > You probably misunderstand me, ... <snip>
I think I am beginning to, you are addressing your immediate
needs. I still would recommend a bottom-up approach over a
top-down though :-)

 > Simply, it is more OS design relative than Ada relative.

If there are any c.l.a archives around, try and find articles
in the 1998-2000 range. There were an extremely large number
of OS design messages with very little relevence to Ada
specifically. This thread is nowhere near the extremes of the
messages in that era :-)


----------------------------------------------------------------
PS. If you decide to go further, watch out for GRUB. It has
two issues which I found presumptious when I was playing with
this stuff (toy OSes) a couple of years ago.

1) To get to 32-bit protected-mode, an initial set of gates
(interrupt, task etc) has to be established. GRUB does this.

2) The documentation (GRUB version 0.96 I think) clearly stated
that the implementors intended to implement a more "complete"
memory-manager.

Both these issues, in my opinion, should be within the kernel
space and not the bootloader.

-- 
-------------------------------------------------
-- Merge vertically for real address
--
--     s n p @ t . o
--      k i e k c c m
-------------------------------------------------




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26  7:46 ` Rolf Ebert
  2004-05-26 12:17   ` JCS
@ 2004-05-28 15:13   ` JCS
  1 sibling, 0 replies; 29+ messages in thread
From: JCS @ 2004-05-28 15:13 UTC (permalink / raw)


On Wed, 26 May 2004 00:46:26 -0700, Rolf Ebert wrote:
> I cannot answer your detailed questions.  I once had a look at the
> GNAT runtime, too.  A good starting point is the private part of
> system.ads and the corresponding explanations in targparm.ads.
> 
> Start slowly putting more and more things to your runtime.  You almost
> certainly already have system.ads and some dummy (i.e. empty)
> libgnat.a.  That is needed even in the case of No_Runtime.   You can
> easily add things like a-uncconv, s-stoele, interface, s-maccod.  They
> all just need to be present at compile time, but aren't needed at link
> time (OK, the .ali's are, not the .o).

OK, I've finally been able to implement the minimal runtime, and it seems
to work (I've not yet tested if stack-checking is working, but it
shouldn't be too hard to make it working). I've made very little changes,
and implemented a stupid heap, that was needed.

The only thing that is still boring is that gcc makes some "memcpy" calls
when optimisation is turned on. I've so made one, but do you know a way to
avoid gcc make those calls and generate code instead?

Regards,
JC



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-26 16:05     ` Martin Krischik
  2004-05-27  9:40       ` Wojtek Narczynski
@ 2004-05-28 20:42       ` Wojtek Narczynski
  2004-06-08  5:43         ` Martin Krischik
  1 sibling, 1 reply; 29+ messages in thread
From: Wojtek Narczynski @ 2004-05-28 20:42 UTC (permalink / raw)


Hello,

> No chance. Even gnat name or gnat chop won't expand them.

It turns out that "gnatchop -gnatd4 <internal_filename>" will expand
filenames, but the result seems to be useless for anything but
browsing. I get interesting errors(1) if I try to compile them.
Apparently GNAT uses source filename, not package name to tell, which
file is internal.
 
(1)Like these:
 unchecked_conversion.ads:20:10: incorrect context for "Intrinsic"
convention
 interfaces-c_streams.ads:272:36: non-static constant in preelaborated
unit

> The short names are hard coded into gnat. Any package from Ada.* Interface.*
> GNAT.*  and System.* must use short name.

If only there were some strings hardcoded! There is much more than
that.

Regards,
Wojtek



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-05-28 20:42       ` Wojtek Narczynski
@ 2004-06-08  5:43         ` Martin Krischik
  2004-06-09  5:07           ` Simon Wright
  0 siblings, 1 reply; 29+ messages in thread
From: Martin Krischik @ 2004-06-08  5:43 UTC (permalink / raw)


Wojtek Narczynski wrote:

> Hello,
> 
>> No chance. Even gnat name or gnat chop won't expand them.
> 
> It turns out that "gnatchop -gnatd4 <internal_filename>" will expand
> filenames, but the result seems to be useless for anything but
> browsing. I get interesting errors(1) if I try to compile them.
> Apparently GNAT uses source filename, not package name to tell, which
> file is internal.
>  
> (1)Like these:
>  unchecked_conversion.ads:20:10: incorrect context for "Intrinsic"
> convention
>  interfaces-c_streams.ads:272:36: non-static constant in preelaborated
> unit
> 
>> The short names are hard coded into gnat. Any package from Ada.*
>> Interface.*
>> GNAT.*  and System.* must use short name.
> 
> If only there were some strings hardcoded! There is much more than
> that.

There seems to be some algorithm. I recently tried to build some extension
to the Ada.* tree for Wide_Characters. GNAT was then telling me exactly
which filename to use for what package.

In the end the hole thing failed. After compiling everything OK, GNAT moaned
about my packages not been part of the predefined Library.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-08  5:43         ` Martin Krischik
@ 2004-06-09  5:07           ` Simon Wright
  2004-06-09  6:22             ` Martin Krischik
  2004-06-09 16:33             ` Robert I. Eachus
  0 siblings, 2 replies; 29+ messages in thread
From: Simon Wright @ 2004-06-09  5:07 UTC (permalink / raw)


Martin Krischik <krischik@users.sourceforge.net> writes:

> There seems to be some algorithm. I recently tried to build some
> extension to the Ada.* tree for Wide_Characters. GNAT was then
> telling me exactly which filename to use for what package.

I had a quick scan of the gnat UG
  http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/
but no luck (there may be info hidden in there ..)

gnatkr will tell you the file name GNAT expects for Ada.*, GNAt.*,
System.*:

   smaug.pushface.org[5]$ gnatkr ada.calendar
   a-calend

> In the end the hole thing failed. After compiling everything OK,
> GNAT moaned about my packages not been part of the predefined
> Library.

There are rules for packages that are amended parts of the library:
you need to compile with at least -gnatg, all warnings are treated as
errors .. but I would still have expected it to build. I've never
tried any _new_ units, though.



^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09  5:07           ` Simon Wright
@ 2004-06-09  6:22             ` Martin Krischik
  2004-06-09  7:20               ` Martin Dowie
  2004-06-09 16:33             ` Robert I. Eachus
  1 sibling, 1 reply; 29+ messages in thread
From: Martin Krischik @ 2004-06-09  6:22 UTC (permalink / raw)


Simon Wright wrote:

> Martin Krischik <krischik@users.sourceforge.net> writes:
> 
>> There seems to be some algorithm. I recently tried to build some
>> extension to the Ada.* tree for Wide_Characters. GNAT was then
>> telling me exactly which filename to use for what package.
> 
> I had a quick scan of the gnat UG
>   http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/
> but no luck (there may be info hidden in there ..)
> 
> gnatkr will tell you the file name GNAT expects for Ada.*, GNAt.*,
> System.*:
> 
>    smaug.pushface.org[5]$ gnatkr ada.calendar
>    a-calend
> 
>> In the end the hole thing failed. After compiling everything OK,
>> GNAT moaned about my packages not been part of the predefined
>> Library.
> 
> There are rules for packages that are amended parts of the library:
> you need to compile with at least -gnatg, all warnings are treated as
> errors .. but I would still have expected it to build. I've never
> tried any _new_ units, though.

They did compiler OK. The error comes when you tried to "with" them. I have
not tired to compile the whole program with -gnatg.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09  6:22             ` Martin Krischik
@ 2004-06-09  7:20               ` Martin Dowie
  2004-06-09  7:52                 ` Martin Krischik
  0 siblings, 1 reply; 29+ messages in thread
From: Martin Dowie @ 2004-06-09  7:20 UTC (permalink / raw)


"Martin Krischik" <krischik@users.sourceforge.net> wrote in message
news:1760877.vB5b9iA35e@linux1.krischik.com...
> >> In the end the hole thing failed. After compiling everything OK,
> >> GNAT moaned about my packages not been part of the predefined
> >> Library.
> >
> > There are rules for packages that are amended parts of the library:
> > you need to compile with at least -gnatg, all warnings are treated as
> > errors .. but I would still have expected it to build. I've never
> > tried any _new_ units, though.
>
> They did compiler OK. The error comes when you tried to "with" them. I
have
> not tired to compile the whole program with -gnatg.

Sorry, I'm missing something here. I've added the new Ada.Directories and
Ada.Calendar.* packages to 3.15p (never had to use -gnatg, I just used -a)
and built applications just fine. I do get the warnings about with-ing GNAT
internal packages but that didn't stop anything.

-- Martin






^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09  7:20               ` Martin Dowie
@ 2004-06-09  7:52                 ` Martin Krischik
  2004-06-09  9:26                   ` Martin Dowie
  0 siblings, 1 reply; 29+ messages in thread
From: Martin Krischik @ 2004-06-09  7:52 UTC (permalink / raw)


Martin Dowie wrote:

> "Martin Krischik" <krischik@users.sourceforge.net> wrote in message
> news:1760877.vB5b9iA35e@linux1.krischik.com...
>> >> In the end the hole thing failed. After compiling everything OK,
>> >> GNAT moaned about my packages not been part of the predefined
>> >> Library.
>> >
>> > There are rules for packages that are amended parts of the library:
>> > you need to compile with at least -gnatg, all warnings are treated as
>> > errors .. but I would still have expected it to build. I've never
>> > tried any _new_ units, though.
>>
>> They did compiler OK. The error comes when you tried to "with" them. I
> have
>> not tired to compile the whole program with -gnatg.
> 
> Sorry, I'm missing something here. I've added the new Ada.Directories and
> Ada.Calendar.* packages to 3.15p (never had to use -gnatg, I just used -a)
> and built applications just fine. I do get the warnings about with-ing
> GNAT internal packages but that didn't stop anything.

Maybe I am missing something:

  -a       Consider all files, even readonly ali files

And that helps? Well I give it a try.

With Regards

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09  7:52                 ` Martin Krischik
@ 2004-06-09  9:26                   ` Martin Dowie
  2004-06-09 11:50                     ` Martin Krischik
  0 siblings, 1 reply; 29+ messages in thread
From: Martin Dowie @ 2004-06-09  9:26 UTC (permalink / raw)


"Martin Krischik" <krischik@users.sourceforge.net> wrote in message
news:2611361.JMxpSgI9HX@linux1.krischik.com...
> > Sorry, I'm missing something here. I've added the new Ada.Directories
and
> > Ada.Calendar.* packages to 3.15p (never had to use -gnatg, I just
used -a)
> > and built applications just fine. I do get the warnings about with-ing
> > GNAT internal packages but that didn't stop anything.
>
> Maybe I am missing something:
>
>   -a       Consider all files, even readonly ali files
>
> And that helps? Well I give it a try.

Yes, although you'll find it compiles almost every other
system/ada/gnat/interface
package too in the process! I just pick out the .ali/.o files I'm interested
in and
copy them to the 'adalib' and the source to the 'adainclude' folders and
start using
the new Ada.* packages..

Cheers

-- Martin






^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09  9:26                   ` Martin Dowie
@ 2004-06-09 11:50                     ` Martin Krischik
  2004-06-10  5:15                       ` Simon Wright
  0 siblings, 1 reply; 29+ messages in thread
From: Martin Krischik @ 2004-06-09 11:50 UTC (permalink / raw)


Martin Dowie wrote:

> "Martin Krischik" <krischik@users.sourceforge.net> wrote in message
> news:2611361.JMxpSgI9HX@linux1.krischik.com...
>> > Sorry, I'm missing something here. I've added the new Ada.Directories
> and
>> > Ada.Calendar.* packages to 3.15p (never had to use -gnatg, I just
> used -a)
>> > and built applications just fine. I do get the warnings about with-ing
>> > GNAT internal packages but that didn't stop anything.
>>
>> Maybe I am missing something:
>>
>>   -a       Consider all files, even readonly ali files
>>
>> And that helps? Well I give it a try.
> 
> Yes, although you'll find it compiles almost every other
> system/ada/gnat/interface
> package too in the process! I just pick out the .ali/.o files I'm
> interested in and
> copy them to the 'adalib' and the source to the 'adainclude' folders and
> start using
> the new Ada.* packages..

This might actually help with the problems I have with the x86_64 version.
The linker is upset that the -fPIC option was not used when libgnat.a was
created.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09  5:07           ` Simon Wright
  2004-06-09  6:22             ` Martin Krischik
@ 2004-06-09 16:33             ` Robert I. Eachus
  1 sibling, 0 replies; 29+ messages in thread
From: Robert I. Eachus @ 2004-06-09 16:33 UTC (permalink / raw)


Simon Wright wrote:

>>In the end the hole thing failed. After compiling everything OK,
>>GNAT moaned about my packages not been part of the predefined
>>Library.

> There are rules for packages that are amended parts of the library:
> you need to compile with at least -gnatg, all warnings are treated as
> errors .. but I would still have expected it to build. I've never
> tried any _new_ units, though.

Once you compile them correctly with -gnatg, you need to put them in the 
right two places.  The .ali files go in (on Windows for GNAT 3.15p):

C:\Program Files\GNAT\lib\gcc-lib\pentium-mingw32msv\2.8.1\adalib

and the .adb and .ads files in:

C:\Program Files\GNAT\lib\gcc-lib\pentium-mingw32msv\2.8.1\adainclude

-- 

                                           Robert I. Eachus

"The terrorists rejoice in the killing of the innocent, and have 
promised similar violence against Americans, against all free peoples, 
and against any Muslims who reject their ideology of murder. Their 
barbarism cannot be appeased, and their hatred cannot be satisfied. 
There's only one way to deal with terror: We must confront the enemy and 
stay on the offensive until these killers are defeated." -- George W. Bush




^ permalink raw reply	[flat|nested] 29+ messages in thread

* Re: GNAT and no runtime
  2004-06-09 11:50                     ` Martin Krischik
@ 2004-06-10  5:15                       ` Simon Wright
  0 siblings, 0 replies; 29+ messages in thread
From: Simon Wright @ 2004-06-10  5:15 UTC (permalink / raw)


Martin Krischik <krischik@users.sourceforge.net> writes:

> This might actually help with the problems I have with the x86_64
> version.  The linker is upset that the -fPIC option was not used
> when libgnat.a was created.

The problem we had with -a was that the compiler options that gnatmake
uses to build your code aren't necessarily the same as those used for
the rebuilt library. We saw this with GNAT Project; IIRC the compiler
options for your code come from package Compiler, those for library
code from package Builder. We saw this because of -mlongcall (PPC
option needed for large programs, not so large under VxWorks whith
lots of memory on the SBC!).

We now rebuild the library with the options we need; see
Makefile.adalib in the adalib/ directory. Note that some GNAT releases
(I don't know about the public GCC) don't include everything you need
for Makefile.adalib to work, I can help a bit if you do go this route.

-- 
Simon Wright                               100% Ada, no bugs.



^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2004-06-10  5:15 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-25 20:57 GNAT and no runtime JCS
2004-05-26  7:46 ` Rolf Ebert
2004-05-26 12:17   ` JCS
2004-05-28 15:13   ` JCS
2004-05-26 10:52 ` Wojtek Narczynski
2004-05-26 12:33   ` JCS
2004-05-26 16:05     ` Martin Krischik
2004-05-27  9:40       ` Wojtek Narczynski
2004-05-28 20:42       ` Wojtek Narczynski
2004-06-08  5:43         ` Martin Krischik
2004-06-09  5:07           ` Simon Wright
2004-06-09  6:22             ` Martin Krischik
2004-06-09  7:20               ` Martin Dowie
2004-06-09  7:52                 ` Martin Krischik
2004-06-09  9:26                   ` Martin Dowie
2004-06-09 11:50                     ` Martin Krischik
2004-06-10  5:15                       ` Simon Wright
2004-06-09 16:33             ` Robert I. Eachus
2004-05-27 10:23     ` Wojtek Narczynski
2004-05-27 12:45       ` JCS
2004-05-26 19:51   ` Georg Bauhaus
2004-05-27  9:43     ` Wojtek Narczynski
2004-05-26 16:44 ` sk
2004-05-26 17:42   ` JCS
2004-05-26 21:33     ` sk
2004-05-26 23:12       ` JCS
2004-05-27 13:58         ` sk
2004-05-27 21:30           ` JCS
2004-05-27 22:42             ` sk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox