comp.lang.ada
 help / color / mirror / Atom feed
From: "Sergey Koshcheyev" <serko84@hotmail.com>
Subject: Re: Curiousity: pragma No_Run_Time for Gnat
Date: Tue, 25 Sep 2001 15:37:37 +0200
Date: 2001-09-25T15:37:37+02:00	[thread overview]
Message-ID: <9oq1b1$2ol4$1@ns.felk.cvut.cz> (raw)
In-Reply-To: mailman.1001419228.11962.comp.lang.ada@ada.eu.org


"M. A. Alves" <maa@liacc.up.pt> wrote in message
news:mailman.1001419228.11962.comp.lang.ada@ada.eu.org...
> or... The Meanings of "Pure"
>
> Sergey Koshcheyev wrote:
> > I don't know exactly what you [Marin Condic] mean by "pure" x86 code.
> > What you get from the compiler on x86 is a 32-bit executable in the
> > platform-specific executable format (ELF on Linux, PE on Win32)
>
> You man the _target_ platform? (If so then code not pure.)

Well, GNAT has to generate the object files in *some* format, and unless you
have a cross-compiling version, it'll be ELF on Linux and PE (COFF) on
Win32. After that, you can use for example objcopy to transform the
generated format to some other, including plain binary (not tested, might
require linking the complete executable first or might not be possible at
all) - that's what you seem to call pure code, however when writing an OS
for x86, plain binary format isn't that useful.

> > which isn't linked to GNAT libraries, though I think it may be linked
> > dynamically to the C library. Linker switch -nostdlib can be used to
> > overcome this and get a completely stand-alone executable (tested on
> > Linux). Another linker switch can be used to link the C library in
> > statically (also tested on Linux).
>
> You mean _compiled_ on Linux or _executed_ on Linux? (If the latter then
> code not pure.)

I did all my testing in Linux. Any file in ELF format can be executed in
Linux, except if it's an OS it will crash at the first privileged
instruction, and probably even earlier.
Grub is a bootloader that, among other features, can switch to protected
mode, load an OS kernel in ELF format from disk, and run it. The OS then has
to do things like setting up descriptor tables, etc. You can of course write
your own bootloader and use your own format for the kernel image (binary,
for example), but it's easier to just use grub and make your OS kernel an
ELF executable.

> But note that for OS execution it would be acceptable to depend on the
> BIOS (at least early on the startup process); after all the BIOS is there
> and it is running before the OS.  *** But it is not acceptable at all for
> execution to depend on another OS. ***

GNAT assumes a 32bit environment which implies protected mode on x86, so
BIOS isn't accessible. You can still use machine code insertions to do
things that you can't do in Ada, or link to some assembly routines. The
execution of the no-run-time program does not depend on the OS - GNAT
doesn't itself generate code to do system calls, you can't use Text_IO or
threads from such program, and so on.

> In fact, I have been thinking in terms of a MIOS (Minimal Input/Output
> System) package providing access to the "minimal system" I have suggested
> before (Ada_OS talk) as a starting target (floppy, keyboard, screen): MIOS
> would probably be implemented with BIOS services: hence, in part, the
> tribute in its name.

Well, it's getting slightly off-topic, but writing a keyboard and a screen
driver isn't hard, floppy driver is harder. I have written a tiny OS kernel
in Ada myself as a university project, after it gets graded (in a few days),
I can make it available, if there is interest. It has a simple keyboard and
screen driver, no floppy driver and minimal support for threads and
pre-emptive scheduling (though not using the Ada language constructs).

> BTW, what is GRUB?  And where is GNORT?

GRUB - GRand Unified Bootloader, http://www.gnu.org/software/grub/
GNORT stands (stood) for Gnat NO Run Time, now it's called something like
GNAT Pro High Integrity edition, I think. It's a product that ACT sells. I
don't know what it contains, maybe somebody who knows can provide pointers
or information about it.

Any corrections to what I wrote above are welcome.

Sergey Koshcheyev

> Thanks,
>
> --
>    ,
>  M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
>  A M A D O   Rua Campo Alegre, 823         fax 351+226003654
>  A L V E S   P-4150 PORTO, Portugal        mob 351+939354002






  parent reply	other threads:[~2001-09-25 13:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-25 14:09 Curiousity: pragma No_Run_Time for Gnat M. A. Alves
2001-09-25 13:05 ` chris.danx
2001-09-25 13:07 ` Jacob Sparre Andersen
2001-09-25 13:37 ` Sergey Koshcheyev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-09-25 17:07 M. A. Alves
2001-09-25 16:49 M. A. Alves
2001-09-25 15:05 ` chris.danx
2001-09-25 15:38   ` Marin David Condic
     [not found] <Pine.LNX.4.33.0109251630310.3066-100000@lagoa.niaad.liacc.up.pt>
2001-09-25 14:48 ` Samuel Tardieu
     [not found] <Pine.LNX.4.33.0109251343310.2841-100000@lagoa.niaad.liacc.up.pt>
2001-09-25 13:20 ` David C. Hoos
2001-09-24 19:02 Marin David Condic
2001-09-24 21:14 ` Sergey Koshcheyev
2001-09-24 21:54   ` Marin David Condic
2001-09-25  7:32     ` Sergey Koshcheyev
2001-09-25 14:00       ` Marin David Condic
2001-09-25 14:14         ` Lutz Donnerhacke
2001-09-25 19:40           ` Robert Dewar
2001-09-26  9:04             ` Lutz Donnerhacke
2001-09-25 15:20         ` Sergey Koshcheyev
2001-09-25  7:36     ` Jean-Marc Bourguet
2001-09-25  7:43   ` Peter Amey
2001-09-25 14:02     ` Marin David Condic
replies disabled

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