From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,95dad97c56f9de95 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-25 06:51:37 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!news-FFM2.ecrc.net!news.cesnet.cz!crax.cesnet.cz!news.felk.cvut.cz!not-for-mail From: "Sergey Koshcheyev" Newsgroups: comp.lang.ada Subject: Re: Curiousity: pragma No_Run_Time for Gnat Date: Tue, 25 Sep 2001 15:37:37 +0200 Organization: Czech Technical University Message-ID: <9oq1b1$2ol4$1@ns.felk.cvut.cz> References: NNTP-Posting-Host: r41.dkm.cz X-Trace: ns.felk.cvut.cz 1001425057 90788 62.24.83.41 (25 Sep 2001 13:37:37 GMT) X-Complaints-To: usenet@ns.felk.cvut.cz NNTP-Posting-Date: Tue, 25 Sep 2001 13:37:37 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Xref: archiver1.google.com comp.lang.ada:13325 Date: 2001-09-25T15:37:37+02:00 List-Id: "M. A. Alves" 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