public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: Alfonso <a.martone@retepnet.it>
To: linux-8086@vger.kernel.org
Subject: writing programs for ELKS
Date: Fri, 7 Feb 2003 13:22:27 +0100	[thread overview]
Message-ID: <200302071322.27842.a.martone@retepnet.it> (raw)
In-Reply-To: <1044556130.1597.23.camel@Castle.goembel>

Hi!!

I got a bunch of emails about my last messages, and try to answer to 
all questions here.


Re-entrancy: DOS system calls are not reentrant. This means that common 
DOS multitaskers (like DESQview) either emulate them in a reentrant 
manner (e.g.: reading a byte from the console is not that hard, but 
DOS makes it non-reentrant), or multiplex them with semaphores.

ELKS system calls are reentrant, because a task-switch can happen in 
every moment. As in every multitasked system, the calling process will 
be put to "sleep" while waiting for I/O (and, sometimes, while waiting 
for other higher priority operations).


Using Turbo C under ELKS means that we are accepting Turbo C limits 
(i.e.: the "int" type is 16 bit; features like floating-point math and 
overlay structure cannot be used without extreme special care, etc).

I did not consider Turbo Pascal because I do not know well its code 
generator and linker. The generated code must NOT contain far calls 
("extrasegment" calls) or interrupt calls. By using the "small" memory 
model, I am sure to have only one code-segment (upto 64k) and only one 
data-segment (upto 64k) without any need for segment override. That 
is, the program should never need to change the values in CS, DS, SS 
and -maybe- even ES (I cannot be sure that even the simplest Turbo 
Pascal program follows this rule). This is the reason why I defined a 
"clean" program to be an "upto 64k text, upto 64k data/bss/stack", and 
should not make any assumption about location of code segment, data 
segment, free memory, etc.


BSS means "bottom-stack space", and is the uninitialized space 
following the last byte of defined data. ELKS kernel wipes out it 
before starting the process, so that the uninitialized global arrays 
and variables are guaranteed to be zero-filled at the beginning. This 
is not always true in other environments, where BSS space is left 
uninitialized (so that the "startup code" has to wipe it... or, 
simply, warn the programmer that uninitialized data surely contains 
rubbish), and this is why C manuals warn about initialization.


In Linux and every other multitasked system processes are allowed to 
use memory only asking for it to the kernel. A task can use only what 
the kernel allowed for. Under Linux, if you try to access (even for 
reading a byte) other memory, the kernel gets an "exception" and kills 
the task before the operation is done (well, the signalling system is 
more complex, but it's guaranteed that any non-root process actually 
can't read and write anything out of explicitly authorized memory 
segments, files, etc).

ELKS cannot guarantee it, at least in the 8088/8086/80186 processors, 
because they do not have any memory protection instruction. An ELKS 
system has no true protection scheme (that is: it could be attacked by 
a decently written virus, even from a process without full root 
permissions), but remember that the "E" (embeddable) of "ELKS" means 
that you won't use it as a "let's try some dozens of new programs"...! 
Surely you will (re)build the entire system when you will add new 
changes...!
And - also - if you get a source program, you can check yourself if it 
does contain worms or viruses. This is the main reason why the viruses 
are an almost unknown phenomenon in the GNU-based world.


Yes, Turbo C is a nice thing, but, as everyone here, I like much more 
GPL-licensed software.

  parent reply	other threads:[~2003-02-07 12:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-30 13:41 please help this newbie running asm programs!!! Seemanta Dutta
2003-01-30 16:06 ` Gábor Lénárt
2003-02-05 23:13 ` writing programs for elks Alfonso
     [not found]   ` <1044556130.1597.23.camel@Castle.goembel>
2003-02-07 12:22     ` Alfonso [this message]
2003-02-07 21:05       ` writing programs for ELKS Dan Olson
2003-02-05 23:16 ` please help this newbie running asm programs!!! Alfonso
2003-02-11  5:52   ` Phil Goembel
2003-02-12 11:15     ` _main and startup code Alfonso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200302071322.27842.a.martone@retepnet.it \
    --to=a.martone@retepnet.it \
    --cc=linux-8086@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox