From: Linus Benedict Torvalds (torvalds@klaava.Helsinki.FI)
Date: 01/23/92


From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
Subject: V86, echo, *P=NULL etc updates
Date: 23 Jan 1992 11:25:40 GMT

Replying to questions (mostly from the mailing-list - I'm trying to move
over to alt.os.linux):

> V86-mode and DOS sessions under Linux?

Right. Seems everybody wants these, but the problem is that Linux wasn't
designed with V86-mode in mind, and the memory management makes some
assumptions that are simply incompatible with V86 tasks. The problem is
that a V86-task /has to/ be at virtual address 0-1M, and doesn't care
about the current linux protections scheme that uses segments. All right
so far: but the current kernel also lives in that space. Ooops.

This means that either (1) the mm has to be totally rewritten, (2) we
resort to ugly tricks with changing IDT's and page tables by hand, or
(3) I come up with something clever.

(1) has several problems: the current mm may not be a work of art, but
it /does/ have the good point of working, and it's extremely simple.
Changing the mm to something more like "real" unices would complicate
things. I don't feel this is a good option.

(2) The "ugly" tricks needed are so ugly I'm probably going to have
nightmares just because I thought about them. Trust me: you don't want
DOS compatability that bad.

(3) is of course optimal: the problem is that the I want:
 - the first 16 megabytes to be "identity mapped" to the physical
   memory. This is one of the reasons the mm is so simple (and there is
   no need to translate DMA addresses etc)
 - the first megabyte (+64kB) would have to be paged memory for the V86
   mode (with all the current frills: demand loading, VM etc).
And these two things don't mix very well. So I thought V86 would have to
wait.

Things aren't really that bad: I brainstormed a little, and I think I've
got the problem solved by using segments and paging at the same time to
make the first 16M /look/ identity mapped, although they aren't. It's
not even going to be very ugly: just a few hacks, that could be said to
be "interesting". I'm not promising anything, though.

> [ echo command ]

No, there is no echo for linux. Not that big a problem: use

#! /bin/sh
echo $*

or port (or write) something in C if you wish. Using a shell-script
isn't that bad: it probably doesn't use much memory, as most of the
pages get to be shared.

> I get "*P=NULL" printed on the console.

Right. This is a debugging message: the sleep-function changed
behaviour in 0.12, and I added a few sanity checks. This message just
means that something is sleeping/waking up without using the proper
routines: I don't know where this happens, but at least it's harmless.
If you know something that consistently brings up this message, I can
probably track it down. I have seen it once, and didn't notice what
caused it.

> mvdir/rename system call

As already mentioned, it doesn't exist. Yet. I'm coding it right now,
and it will work today on my machine (I think), and by the weekend, I
should be able to send out (minor) kernel patches to get it working for
those that want it. I hope.

> Shared libs

Seem to work. The kernel features are there already (even in the
released 0.12), and pmacdona an I have made some simple scripts/programs
to create shared libraries from the current unshared ones. Small
utility programs usually shrink to half their size, but my guess is that
debugging programs using shared libs will be impossible even when we do
get a debugger. I think the 0.13 root-image will contain the first
"real" use of shared libraries.

> Linux-0.13

I still don't know when this will be out: it depends on several things.
Don't try to get TCP/IP, sockets and X all working in time for it - I
think it's going to be released February (mumble mumble 20?)th, and I'm
totally satisfied if it just adds the higher-level routines for VFS and
minor fixes (faster floppy, rename, one totally unnecessary panic-call
etc) and a init/login (I'll use the simple version available already if
the "real" version doesn't get implemented).

Mail me about anything bigger you have already started on: we'll try to
work something out.

                Linus

PS. I still try to reply to all personal mail the same day I get it, but
I know I've missed some (not many though). My mail-box grows by about
30-70 messages per day, so I definitely don't have time to go back and
check them out. Re-mail any questions/suggestions if you don't hear from
me.