2003-07-28 08:28:08

by Rick A. Hohensee

[permalink] [raw]
Subject: The Well-Factored 386

The four actual main modes of the 386

Operation of the INTeL 80386 is clearly much more flexible than currently
used, as far as the basic states the machine can run in. "Real Mode" and
"Protected Mode" are two possibilities out of several that are concievably
useful. It can be seen from things that are possible in "Real Mode", such
as "Unreal Mode", use of 386-era instructions and so on, that the
canonical modes are not monolithic entities, but are cases of various
combinations of discrete state switches. There is no 8086 in a 386.
Canonical Wake-up Real Mode, which I will refer to as CWR Mode, seems to
be how these several state switches are set at machine reset, but are
semantically just settings of independant things, and clearly CWR Mode can
be set up from individual settings available to the user. This is also
much more evident from a careful traversal of the detailed instruction
specs in the INTeL Programmer's Reference (386INTEL.TXT) for the 80386.

I'd say the two most global switches in the machine are the PE bit,
Protection Enabled, quite sensibly placed at bit 0 in control register 0,
and the D bit of the active code segment descriptor affiliated with CS,
the Default Bit. Two bits gives four possible states. All four are capable
of being the default mode of a system. Two are used as such; CWR Mode and
Protected Mode. Here's a breakdown and some neologizing...


PE=0 Dbit=0 (un)Real Mode
PE=0 Dbit=1 Forreal Mode
PE=1 Dbit=0 Veal Mode (BKA "286 task")
PE=1 Dbit=1 Protected Mode


The documented modes are the outside cases in a binary-count listing,
where PE=Dbit. There's a very good reason for that. IRET is sensitive to
Dbit, whereas interrupts push a stack frame of operands sized in
accordance with PE. This is some of INTeL's* description of the action of
INT, which represents all interrupts in this regard, when PE=0...

IF PE = 0
THEN GOTO REAL-ADDRESS-MODE;

REAL-ADDRESS-MODE:
Push (FLAGS);
IF <! 0; (* Clear interrupt flag *)
TF <! 0; (* Clear trap flag *)
Push(CS);
Push(IP);
(* No error codes are pushed *)
CS <! IDT[Interrupt number * 4].selector;
IP <! IDT[Interrupt number * 4].offset;


That is, IP is pushed if PE=0, not EIP. FLAGS is also a dual (a "word" in
INTeLese, 16 bits). Thus if, for example, you are in Forreal Mode, you get
a 6-byte stack push of FLAGS, CS and then IP on an interrupt, and the
corresponding IRET will later pop 12 bytes for basically the same 3
registers, and the system streaks off to the big bitbucket in the sky.

HOW ever, IRET is only PARTIALLY sensitive to Dbit. What I didn't say a
moment ago is that IRET is really sensitive to the current effective code
size, of which the D bit is just one component. If we prefix the IRET in a
Forreal Mode interrupt handler with 0x66, the other-operand-size prefix,
it will pop duals in a use32 CS. The interrupt occuring with PE=0 pushed
duals. It works. The inside cases of Veal Mode and Forreal Mode simply
need thier IRETs un-default-sized. In Veal Mode you coerce IRET into using
quads in a use16 code segment, and in Forreal Mode the same prefix in a
use32 code segment will coerce the IRET pops to duals. In Veal Mode, where
PE=1 when an interrupt occurs, you also have the option of handling the
interrupt with a Dbit=1 segment for the pertinent interrupt handler, in
which case it can IRET back to Veal Mode with a naked IRET. I suppose you
can also segregate Veal Mode segments with thier descriptor bases and
limits. In all the quirkiness of the 386, the broad orthogonality of the
other-sizing prefixes is quite refreshing, and even works on stuff like
POPA.

This is from the blow-by-blow description of IRET...

IF OperandSize = 32 (* Instruction = IRETD *)
THEN EIP <! Pop();
ELSE (* Instruction = IRET *)
IP <! Pop();

Again, OperandSize is Dbit as effected by a possible prefix.

This is why INTeL only mentions Veal Mode as "286 tasks". Tasks don't
IRET. Most of what a 386 provides big facilities for, like tasks, can also
be done piecemeal, as would be the case running a system in straight
Forreal Mode.

Canonical Wake-up Real Mode and Unreal Mode are two flavors of the same
basic setting of PE and Dbit. The difference is in segment limits. This
points up a basic concept here. 8086-style segments are a lightweight
layer that may or may not be active, but 386 segments are always active.
PE=0 does not turn them off. PE=0 means you can't change them until you
turn PE back to 1. PE should be called "PCE, Protections Changes Enabled".

This means the four basic modes have a state diagram about like so...


_______________
| WAKE-UP |
|canonical rmode|
| PE=0 use16 |
|_______________|
A |set PE to 1
| |
set PE to 0| |
___|________V__
| Veal |
| Mode |
| PE=1 use16 |
|_______________|
A |far xfer
| | to use32 CS
far xfer to | |
use16 CS| |
___|_______V___
| Protected |
| Mode |
| PE=1 use32 |
|_______________|
A |set PE to 1
| |
set PE to 0| |
___|________V__
| Forreal Mode |
| Mode |
| PE=0 use32 |
|_______________|


Interesting. Forreal Mode is the furthest from Wake-up, and you can only
get to Forreal Mode from pmode. Forreal Mode is like a back room off of
pmode. You can interrupt between pmode and Veal Mode. Conversely, events
in rmode or Forreal Mode (PE=0) have to be handled in the mode they occur
in.

The above diagram does not account for different segment limits and bases
than those in effect in WakeUp Rmode, so e.g. unreal mode is not shown.
This chart also does not account for V86 Mode, which basically requires
386 task-switch constructs. The above modes and transitions do NOT need a
TSS, or paging. I suspect V86 could run off Veal Mode OR pmode.

Veal Mode is a protected mode. That means it's a quick switch to good old
use32 Protected Mode. It may afford some better code density, and thus
speed. Forreal Mode is unprotected, which means interrupts are handled
somewhat faster, which benefits realtime services. Either can be
incorporated into a multi-mode system. Forreal Mode also doesn't seem to
have any analogy at all in current use, other than the INTeL "flat model",
which is a simplified pmode, but that similarity is rather superficial.

For the 386 to do what it does, and particularly to have pulled it off in
the mid-eighties, things have to be fairly simple. You can figure that
whatever the 386 does, it's implemented as simply as possible. The modes
of the machine are composites of simple switches, and various effects,
such as loaded descriptors, tend to persist until changed. This has always
been the case with e.g. 8086 segment registers. In the 386, however,
8086-style "segments" are not alternates of 386 segments, they are a
superficiality on top of them. With that in mind, the states one goes
through simply getting from real mode to pmode start to make more sense.

The following (osimplay) code demonstrates the superficiality of 8086
"schmegments" vis-a-vis 386 segments, even when PE=0...

<from flat pmode>
. global/flipPE # Welcome to Forreal Mode
# cell still 4

= 4 to A # 32-bit schmegmented addressing demo
= A to ES # proving we got PE = to 0.
= 9348539 to A
= A to @ $((0xb8a00))
ES
= A to @ $((0xb8a00))

That code causes two identical attribute-glyph pairs to appear on the VGA
text screen 32 charcells displaced from each other. That is the 4 in ES,
times 16 as per 8086, divided by two since each charcell is 2 bytes. Plus
a flat 32-bit address to put it on the screen. Forreal Mode thus does
32-bit 8086 schmegmented address computation. What is this type of
addressing useful for? Precious little. In Forreal mode you've got 32 bits
to start with. The point is you have the big flat segments left over from
pmode. The 8086 address-math does prove we're not in pmode any more,
however. Otherwise the ES prefix of 4 would have GPFed.


Rick Hohensee
Precision Mojo Engineer

*
I've converted my 386INTEL.TXT to 7-bit ASCII-art, not to mention
op-source-dest and other unINTeLifications, and "<!" is the right-to-left
assignment operator in the instruction description code, helpfully
pronounced "becomes".


The appended hex/octal/listing appears to be handling INT 35 in Forreal
Mode, ala
otheroperandsize
dismiss

It also demos the 32-bit schmegmented addressing mentioned earlier, and it
keeps it's IDT in the VGA text buffer. The hex/octal input editor in
osimplay needed to type it in is Left As An Excercize To The Reader.


00000000 00... ALLOT 0x7C00
00007c00 270 28 02 = 552 to A
00007c03 271 01 00 = 1 to C
00007c06 31 322 XOR D with D
00007c08 8e 302 = D to ES
00007c0a 273 00 7c = 0x7c00 to B
00007c0d cd 13 submit 0x13
00007c0f fa nosurprises
00007c10 270 00 b8 = 0xb800 to A
00007c13 8e 330 = A to DS
00007c15 270 93 0d = 3475 to A
00007c18 89 006 2c 01 = A to @ 300
00007c1c 31 300 XOR A with A
00007c1e 8e 330 = A to DS
00007c20 0f 01 16 37 7d setGDT IGDTRpointer
00007c25 270 00 b8 = 0xb800 to A
00007c28 8e 330 = A to DS
00007c2a 270 94 0d = 3476 to A
00007c2d 89 006 30 01 = A to @ 304
00007c31 66 otheroperandsize
00007c32 31 300 XOR A with A
00007c34 100 1+ A
00007c35 0f 22 300 = A to CR0
00007c38 e9 00 00 jump hvfnvkfv
00007c3b (O) hvfnvkfv
00007c3b 89 006 34 01 = A to @ 308
00007c3f 89 006 35 01 = A to @ 309
00007c43 0f 20 300 = CR0 to A
00007c46 89 006 36 01 = A to @ 310
00007c4a 89 006 37 01 = A to @ 311
00007c4e ea 53 7c 10 00
00007c53 (O) u32
00007c53 270 18 00 00 00 = 0x18 to A
00007c58 8e 330 = A to DS
00007c5a 270 57 65 67 13 = 325543255 to A
00007c5f 89 005 d4 00 00 00 = A to @ 212
00007c65 89 005 d8 80 0b 00 = A to @ 753880
00007c6b 89 005 78 81 0b 00 = A to @ 754040
00007c71 89 005 18 82 0b 00 = A to @ 754200
00007c77 270 18 00 00 00 = 0x18 to A
00007c7c 8e 330 = A to DS
00007c7e 8e 300 = A to ES
00007c80 8e 320 = A to SS
00007c82 31 300 XOR A with A
00007c84 8e 340 = A to FS
00007c86 8e 350 = A to GS
00007c88 270 d1 00 00 00 = 0xd1 to A
00007c8d 272 64 00 00 00 = 0x64 to D
00007c92 ee send byte
00007c93 90 nop
00007c94 90 nop
00007c95 90 nop
00007c96 90 nop
00007c97 90 nop
00007c98 90 nop
00007c99 90 nop
00007c9a 90 nop
00007c9b 90 nop
00007c9c 90 nop
00007c9d 270 df 00 00 00 = 0xdf to A
00007ca2 272 60 00 00 00 = 0x60 to D
00007ca7 ee send byte
00007ca8 272 92 00 00 00 = 0x92 to D
00007cad ec recieve byte
00007cae 0d 02 00 00 00 OR 2 to A
00007cb3 ee send byte
00007cb4 (O) a20loop
00007cb4 270 55 55 aa aa = 0xaaaa5555 to A
00007cb9 89 005 d8 ff 1f 00 = A to @ 2097112
00007cbf 8b 035 d8 ff 1f 00 = @ 2097112 to B
00007cc5 39 303 -test A to B
00007cc7 0f 85 e7 ff ff ff when not zero a20loop
00007ccd 274 f0 ef 00 00 = 61424 to SP
00007cd2 31 377 XOR DI with DI
00007cd4 (O) perFMIDTvector
00007cd4 60 pushcore
00007cd5 270 aa 7d 00 00 = twitch32unP to A
00007cda e8 ae 00 00 00 call install32unP
00007cdf 61 pullcore
00007ce0 107 1+ DI
00007ce1 81 377 ff 00 00 00 -test 255 with DI
00007ce7 75 eb when not zero short perFMIDTvector
00007ce9 0f 01 1d bb 7d 00 00 setIDT IDT32unPpointer
00007cf0 31 333 XOR B with B
00007cf2 103 1+ B
00007cf3 0f 20 300 = CR0 to A
00007cf6 31 330 XOR B to A
00007cf8 0f 22 300 = A to CR0
00007cfb 270 04 00 00 00 = 4 to A
00007d00 8e 300 = A to ES
00007d02 270 bb a5 8e 00 = 9348539 to A
00007d07 89 005 00 8a 0b 00 = A to @ 756224
00007d0d 26 ES
00007d0e 89 005 00 8a 0b 00 = A to @ 756224
00007d14 66 otheroperandsize
00007d15 9c pushflags
00007d16 66 otheroperandsize
00007d17 68 00 00 push 0
00007d1a 66 otheroperandsize
00007d1b e8 8c 00 call twitch32unP
00007d1e (O) theloop
00007d1e 8b 005 88 88 0b 00 = @ 755848 to A
00007d24 100 1+ A
00007d25 89 005 88 88 0b 00 = A to @ 755848
00007d2b cd 23 submit 35
00007d2d 90 nop
00007d2e 90 nop
00007d2f 90 nop
00007d30 90 nop
00007d31 e9 e8 ff ff ff jump theloop
00007d36 f4 halt
00007d37 (O) IGDTRpointer
00007d37 00 04 3d 7d 00 00
00007d3d (O) GDT
00007d3d 00 00 00 00 00 00 00 00 0 the required NULL
00007d45 ff ff 00 00 00 89 cf 00 1 0x8 TSS
stackstack
00007d4d ff ff 00 00 00 9a cf 00 2 0x10 ring0 USE32
CS
00007d55 ff ff 00 00 00 92 cf 00 3 0x18 ring0 data
00007d5d ff ff 00 00 00 9a 00 00 4 0x20 USE16 CS
00007d65 ff ff 00 00 00 92 00 00 5 0x28 USE16 data
?S
00007d6d 00 00 00 00 00 00 00 00 6 0x30
00007d75 00 00 00 00 00 00 00 00 7 0x38
00007d7d 00 00 00 00 00 00 00 00 8 0x40
00007d85 00 00 00 00 00 00 00 00 9 0x48
00007d8d
00007d8d (O) install32unP
00007d8d c1 347 02 upshift 2 to DI
00007d90 81 307 00 80 0b 00 + IDT32unP to DI
00007d96 89 007 = A to @ DI
00007d98 c3 return
00007d99 (O) install16
00007d99 c1 347 02 upshift 2 to DI
00007d9c 81 307 00 84 0b 00 + IDT16 to DI
00007da2 e8 1a 00 00 00 call schmegment
00007da7 89 007 = A to @ DI
00007da9 c3 return
00007daa (O) twitch32unP
00007daa 120 push A
00007dab 8b 005 50 8a 0b 00 = @ 756304 to A
00007db1 100 1+ A
00007db2 89 005 50 8a 0b 00 = A to @ 756304
00007db8 130 pull A
00007db9 66 otheroperandsize
00007dba cf dismiss
00007dbb (O) IDT32unPpointer
00007dbb 00 04 00 80 0b 00
00007dc1 (O) schmegment
00007dc1 123 push B
00007dc2 89 303 = A to B
00007dc4 c1 353 10 downshift 16 to B
00007dc7 81 340 ff ff 00 00 AND 65535 to A
00007dcd c1 343 1c upshift 28 to B
00007dd0 09 330 OR B to A
00007dd2 133 pull B
00007dd3 c3 return



2003-07-28 13:54:54

by David Miller

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Mon, 28 Jul 2003 04:44:56 -0400
"Rick A. Hohensee" <[email protected]> wrote:

> The four actual main modes of the 386

Please stop making off-topic postings. If you continue to do
so I will have to yank you from the lists at vger.kernel.org
and filter you from sending emails to the lists.

Thank you.

2003-07-28 15:21:47

by hp

[permalink] [raw]
Subject: Re: The Well-Factored 386

though probably not always that enlightning as announced, I certainly would
not consider those artices 'off topic'. - i fact, despite i don't understand
a word of those silly idiomatic texts, sometimes, i found the latest one
quite interesting and, tightly reated to 'assembly' . any attempt to trying
to documenting on the rsp. cpu should be regarded "on-topic", what else...!

and, no #reader# (as opposed to some until now un-known, sort of 'maintainer')
seems to have felt offended so there is no reason to that rude admonition.
for instance, i would find those overly repeated, stupid questions about some
obscure 'real mode' in linux (or for access to #the# graphic memory) much
more annoying and accordinly "off topic" - if i would, at all.

or, were you trying to cut down a bit on the tremendous traffic in this group?
what a great relief...

thanks + regards,

hp

David S. Miller am Montag, 28. Juli 2003 15:06:
> On Mon, 28 Jul 2003 04:44:56 -0400
>
> "Rick A. Hohensee" <[email protected]> wrote:
> > The four actual main modes of the 386
>
> Please stop making off-topic postings. If you continue to do
> so I will have to yank you from the lists at vger.kernel.org
> and filter you from sending emails to the lists.
>
> Thank you.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly"
> in the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
FAQ(s) + DOCs at http://linuxassembly.org
pse, reply to << lx -at- lxhp -dot- in-berlin -dot- de >>

2003-07-28 20:35:16

by Rick A. Hohensee

[permalink] [raw]
Subject: Re: The Well-Factored 386

>[email protected]
>Please stop making off-topic postings. If you continue to do
>so I will have to yank you from the lists at vger.kernel.org
>and filter you from sending emails to the lists.
>
>Thank you.
>-


Rick Hohensee July 2003

Why, Rick? WHY?

This is /Ha3sm/blurb on my box, where this originated. Ha3sm is an OS
project written in osimplay, which is an assembler I wrote entirely in GNU
Bash. Ha3sm is hoped to eventually be a complete computer operating system
with a design emphasis on the local "console" user. Forth/AmigaDos first,
server stuff second.

I wrote osimplay for several reasons. First of all, I couldn't stop
laughing when it occured to me that I could write a 386 assembler in Bash.
So I did it. I'm still quite amused by it. There are utterly serious
reasons for such a thing, however. Interdependancies of software packages
are pernicious. Eventually you get to where you can't change anything, and
you have to have everything for anything to work. Most Linux distros are
like that now. You can't downsize Red Hat. Highly un-unix, in my opinion.
You have to start with kernel sources and work up. I did so with cLIeNUX.
Linux people think unix collapses without Perl. I don't have Perl in
$PATH, and it's not in a cLIeNUX Core package. For what, writing an
assembler?

I don't mean to single out Larry Wall. Perl is only quantitatively worse
in this regard than most other unix apps. Assume a unix, and you assume a
lot of stuff. Well, when you want to write something original, most of
that stuff is just in your way. Looking at the sh history in my devel vt,
I use Lynx for a file browser, Pico, grep, less, cat and a couple other
stone-stock doodads. An assembler in Bash is the lowest-level programming
done from the highest level. Directly. No funny libraries. No middleman.
No toolchains. Trivial portablility issues. Near-zero "install" issues.
Get about your actual business, writing machine code. Which, by the way,
is your actual business when writing, say, C. Or other arbitrary binary
data.

Perl is also a good example of what they give people to learn programming.
Java, etc. also. The problem there is you are learning abstractions. With
assembly you are learning how a computer actually works. With 386 assembly
in 2003 you are learning how several hundred million desktop machines and
laptops actually work at thier core. The 386 is ugly, but it's a fairly
generic register machine, and most of what you learn about it applies to
other register machines. Well, if you're selective. Ignore AAA, for
example.

This is what you need to know to ever do anything fundamental, and in fact
is what you need to know to use the abstractions well. Bell Labs still
uses C for Plan 9, but they wrote C. You can see in the exquisite Plan 9
code that when they write something in C they can see what it's exact
machine code ramifications are. This is mastery, and it is a bottom-up
thing. It's also really writing assembly. Ken Thompson wrote the original
UNIX kernel, and ed, which are the two programs that define unix, in my
opinion. The original ed was in PDP assembly. (So was the kernel). The PDP
had about as many different branch conditions as a 386, i.e. 4 or 5 flags
and branches on all of them plus some combinations of them. Thompson used
most if not all of those branch conditions in ed. By hand. That's the sort
of sight that can give somebody that believes Chuck Moore (Forth) is The
One True UberCoder a crisis of faith. When somebody like Thompson (a tiny
group, I admit) writes C, it just looks like they're writing C.

Even if you don't have the next Forth or UNIX in you, you need to know
assembly to master programming, be it Forth, C, ml, Lisp or whatever.
Period. High Level Languages have not lived up to the hopes for them.
Period. Things like Java are for building technology bubbles. Torvalds is
Torvalds because he wrote all the assembly Minix needed for pmode. C is
the lingua franca of the Internet because it's as low-level as it can be
and still claim to be high-level, or "portable". C produces snappy
application code. That's where it beats a public domain Forth, and
commercial Forths are, well, commercial. Like, you can't reuse the parts
like you can with a homebrew. You can write an OS in C, which was it's
original striking achievement. People didn't write OSes in high-level
languages in 1972.

Well, they still don't. Plan 9 has very little assembly in it, but that's
Bell Labs. They note that Plan 9 is an experiment. And it still has some
assembly at crucial junctures. And those guys see the assembly under (int
*)(bla()****) or what-the-hell as they are writing it. BSD has more, and
386 Linux is ludicrous for asm("") and setup.S and so on. And the
difficulty and non-portability of e.g. GNU C asm("") offsets fully all the
joys <cough> of C, for OS devel. So in realistic terms, operating systems
are written in assembly. osimplay does not attempt to pretend otherwise.
There are some stand-alone Forths out there, which you extend in Forth,
but the Forths are in assembly, if they're not on Forth hardware.

What osimplay does do is make assembly as easy as possible. The rush to
the high-level mirage has left assembly stuck in 1965. This is the
opportunity osimplay jumps on. There's enough suffering in the world
without having to pretend 386 instructions are different depending on if
you are in rmode or pmode. They are the same opcode. In osimplay they are
the same mnemonic. With a prefix, they are the same action. And mnemonics
actually are mnemonic in osimplay. The most central piece of data in a PC
is called "A" in osimplay, not %eax/%ax/%al. Et cetera.

osimplay also deliberately violates the unix ideal of lots of small tools.
That's a good model except as pertains to your command interpreter. The
shell is not a tool; it is your hands. osimplay is a shell script of a
machete. Any competent campesino from anywhere can build Noah's Ark with
it. Also, osimplay isn't a violation of the historical unix ideal of
modularity to anything approaching the extent of the typical major
GNU/Linux distro.

Martin Richards wrote BCPL back in 1967 or so. In circa 1970 Thompson and
Ritchie bailed on a FORTRAN compiler for UNIX and settled for an
interpreted BCPL, B. Then Ritchie Pascalified BCPL into C. A little later
Richards wrote the predecessor of Amigados in BCPL, Tripos. Martin
Richards still works on a descendant of BCPL, MCPL. It has some nifty
ml-like "patterns" case-construct compiler stuff, which MCPL uses for most
of its program flow control, but it still doesn't have typed data ala C.
Richards had a better idea, which idea also found its way into the ANSI
Forth spec, cells. A machine has a cell size. That's your integer. Data
type game over. I wrote a 3-stack Forth called H3sm to have a
variable-size cell at the lowest level possible, i.e. demonstrably
feasible in hardware. In H3sm they are called pytes. In osimplay, they are
once again simply "cells", but they smooth over a lot of INTeL ugliness
about rmode/pmode, and I presume, IA64.

I'm more severely minimalist about some things than even Chuck Moore
though. Pytes reduce the overall namespace proliferation of Forth, which
is pretty bad. Also, I don't do do/while, for/next and so on in osimplay.
GOTO gets a bad rap, but it's what actually exists, and it's unambigious.
I don't believe the if/else/else issues are any worse in assembly than in
C. Or Forth. "if" is "when" in osimplay though, just to avoid a conflict
with the shell. I do provide an execution array widget in osimplay, and
it's pretty snappy. There are reentrant procedure thingies and so on also.

The idea of structured programming is nice. Somebody noticed that a few
particlar conditional constructs are a complete set, and decided to make
some hay trying to limit the world to those few constructs. Your PC is a
big jump-table though, known as the IDT, and the OS is the program that
deals with it. osimplay provides an execution array assembler with the
osimplay words xray and yarx. It's not structured. It screams.

Assembly is considered unportable and C is considered portable. I've
already noted that the portable parts of C are the less crucial parts, and
386 assembly is only 100% portable to several hundred million machines,
But, There's More. What machine is
= A to B
for? That's
osimplay for what is MOV %eax, %ebx in Gas. That can be emulated trivially
on any register machine with two or more registers. Among the machines the
386 is comparable to, the 386 constitutes a register subset that can be
mapped onto the other device easily. There are other issues and tricks to
solve them. What osimplay calls plurals, the REP thingies on the 386, can
easily be hidden, and so on. For another example of this sort of thing,
but going the other way, the Plan 9 assembler fakes COPY <memloc> to
<memloc> on the 386, so the assembler is more CISCy. Plan 9 seems to have
originated on a 68020. (The 386 only allows memory-to-memory in a few
circumstances, like where SI and DI are already set up for LODS).

I still think Chuck Moore has obsoleted register machines. I don't happen
to have a stack-machine PC yet, however. Hence Ha3sm. I like my pytes, in
H3sm. They will return to Ha3sm eventually, and Ha3sm will model the PC I
wish I had, on a clone, Lord willin and the river don't rise.

The bad news is, osimplay is of course ridiculously slow. It takes like 10
minutes to assemble a VGA font, with no high-ASCII glyphs. Converting a
binary string to a byte is not what Bash likes to do. A 1400 byte
femto-kernel takes like 30 seconds on a P166. Small price to pay for
significantly lower mental burdens while actually coding the stuff,
easily. Checkmate leaves no weaknesses. And things like fonts don't have
to be reassembled every 10 minutes when you're working on the IDT. Also,
since writing the preceding lines of this paragraph I made an array of
semi-graphic binary-like names for 0-255, and fonts assemble now about as
fast as code. 3 is $______II. The joy of scripting.

There are several defenses from the slowness of osimplay. A: In an OS
context, get onto the target machine as early as possible, with a Forth or
other machine monitor of some kind. B: The first predecessor of osimplay
was asmacs, m4 macros for gas. If you want to write a big app in osimplay
for a GNU/Linux, an asmacs won't bite you too hard. Less than installing
gcc. I'd rather deal with the slowness of sh though. C: osimplay doesn't
have a linker, but it could benefit tremendously from one that could link
to binaries that don't get reassembled on every development run, such as
fonts. There are some predecessors of a linker in the ELF stuff in
osimplay for Linux and the Cat thing at the end of Ha3sm/code/top. In
fact, it should be possible to only reassemble the parts of an osimplay
project that are currently under development, and keep those parts to
hundreds of bytes of code.

This blurb may come with several different subsets of the other things I
have in this directory, or I may just do the Ha3sm/osimplay funpack. In
that case you should get a target-systems-only osimplay, a Linux-apps
osimplay with ELF and syscalls, a couple demo utils for Linux, a couple
VGA fonts, a couple boot demos including a Forreal Mode demo and maybe a
Squeal Mode demo, html manpage-like osimplay docs, and my re-edit of
386INTEL.TXT, converted about halfway to my programming style, and
converted all the way to 80 columns or less, 7-bit ASCII only.


2003-07-28 20:44:59

by David Miller

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Mon, 28 Jul 2003 16:33:58 -0400
"Rick A. Hohensee" <[email protected]> wrote:

> Rick Hohensee July 2003
>
> Why, Rick? WHY?

Rick, I wish you luck finding another machine with lists to
infiltrate.

Because you're not going to do it on vger.kernel.org any more.
Bye bye.

2003-07-28 22:27:49

by Stephan von Krawczynski

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Mon, 28 Jul 2003 13:33:00 -0700
"David S. Miller" <[email protected]> wrote:

> On Mon, 28 Jul 2003 16:33:58 -0400
> "Rick A. Hohensee" <[email protected]> wrote:
>
> > Rick Hohensee July 2003
> >
> > Why, Rick? WHY?
>
> Rick, I wish you luck finding another machine with lists to
> infiltrate.
>
> Because you're not going to do it on vger.kernel.org any more.
> Bye bye.

Dave, I have to tell you I don't like your attitude shown in this case. Surely
you can argue Rick does not really stay on a specific topic, but on the other
hand he does not really flood the list, does he? I mean, compared to (name
deleted)s' PR bubbles he is really low volume.
Besides I have not read any complaints (1 pro) - only yours. Which leads me to
think you kill him only because you don't like the man - and not really because
of his writing - and because you _can_. This does not feel alright for me.
Don't get me wrong, I am no Rick-fan, I don't know him and have no idea why he
is really talking about his favourite topics. But I honour his right to speak
up just like anybody else, even if it looks more like a "brainstorming" than
constructive talking.

Regards,
Stephan

2003-07-28 22:34:16

by David Miller

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Tue, 29 Jul 2003 00:27:37 +0200
Stephan von Krawczynski <[email protected]> wrote:

> I have not read any complaints (1 pro)

People send me complaints about him every time he posts.
And I don't care if you don't like my attitude, my job as
list manager is not to be liked by people or to have them
like my attitude. My job is to keep the lists clean.

I told people last week that I was going to start cracking down on
this. And I was absolutely serious. I know that linux-kernel is
often a very unnice place to be subscribed, and I am going to change
that.

I publicly asked him NICELY to stop his postings, and he responded
with his description of why his x86 assembler written in bash is so
great. I have zero sympathy for people who act that way.

2003-07-28 22:58:05

by David D. Hagood

[permalink] [raw]
Subject: Re: The Well-Factored 386

David S. Miller wrote:
> And I don't care if you don't like my attitude, my job as
> list manager is not to be liked by people or to have them
> like my attitude. My job is to keep the lists clean.

I'd just like to say "BRAVO SIR!" I am glad to see you doing this, and I
support your actions 100%.

Anybody's right of freedom of speech ends when they force the unwilling
to listen - this troll was -10, Offtopic. He was not talking about the
kernel, any development of interest to the kernel, and I for one am glad
he is getting bounced.

Let him post his drivel-scribblings on Slashdot, along with goatse.cx,
the porn trolls, and the *BSD is dead trolls.


2003-07-28 23:11:43

by Al Viro

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Tue, Jul 29, 2003 at 12:27:37AM +0200, Stephan von Krawczynski wrote:

> Dave, I have to tell you I don't like your attitude shown in this case.

Tough.

> is really talking about his favourite topics. But I honour his right to speak
> up just like anybody else, even if it looks more like a "brainstorming" than
> constructive talking.

There is no right to speak using particular host. Dave _is_ admin of
vger and he is not, AFAIK, bound by any contract regarding l-k. If you
are unhappy with that - create and maintain a list of your own with
whatever policies you happen to like; if somebody else will want to
use it - more power to you.

2003-07-29 00:17:38

by Brian Raiter

[permalink] [raw]
Subject: Re: The Well-Factored 386

> Rick, I wish you luck finding another machine with lists to
> infiltrate.
>
> Because you're not going to do it on vger.kernel.org any more.
> Bye bye.

I've no doubt that his posts seemed off-topic for linux-kernel, I
would argue that they are certainly on-topic for linux-assembly. (I
also imagine the latter sees much less traffic than the former, thus
hp's comment.) I rather doubt that the complaints were coming from
both lists, given that his stuff is far more interesting that the
usual linux-assembly posts ("how do I write a number to screen without
using BIOS?!") Assuming this is true, perhaps it would make more sense
to allow him to continue posting to linux-assembly?

b

2003-07-29 00:34:13

by jw schultz

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Mon, Jul 28, 2003 at 03:30:55PM -0700, David S. Miller wrote:
> On Tue, 29 Jul 2003 00:27:37 +0200
> Stephan von Krawczynski <[email protected]> wrote:
>
> > I have not read any complaints (1 pro)
>
> People send me complaints about him every time he posts.
> And I don't care if you don't like my attitude, my job as
> list manager is not to be liked by people or to have them
> like my attitude. My job is to keep the lists clean.
>
> I told people last week that I was going to start cracking down on
> this. And I was absolutely serious. I know that linux-kernel is
> often a very unnice place to be subscribed, and I am going to change
> that.
>
> I publicly asked him NICELY to stop his postings, and he responded
> with his description of why his x86 assembler written in bash is so
> great. I have zero sympathy for people who act that way.

Good for you!

It took me a few minutes to figure out who you were talking
about because he's been in my killfile for a while. He
contributes NOTHING. Even RMS's cries in the wilderness on
BK and how we shouldn't call linux, linux have more value.

Now if we could cut off the threads about BK (as opposed to
bk servers) started by anyone other than Larry...

--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: [email protected]

Remember Cernan and Schmitt

2003-07-29 01:33:12

by Alan

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Maw, 2003-07-29 at 01:34, jw schultz wrote:
> Now if we could cut off the threads about BK (as opposed to
> bk servers) started by anyone other than Larry...

Even better - by Larry too, excepting when its kernel relevant like
downtimes, updates etc

2003-07-29 03:49:52

by Larry McVoy

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Tue, Jul 29, 2003 at 02:27:32AM +0100, Alan Cox wrote:
> On Maw, 2003-07-29 at 01:34, jw schultz wrote:
> > Now if we could cut off the threads about BK (as opposed to
> > bk servers) started by anyone other than Larry...
>
> Even better - by Larry too, excepting when its kernel relevant like
> downtimes, updates etc

Dave and Linus cc-ed me on the vger crackdown discussions and I offered
to unsubscribe from the kernel list if it would help. Dave's comment was
that I don't start the wars, which is probably true. I tend to respond
to attacks, not go looking for fights. I'd be curious to know when it is
that you think I've started a flame fest here, Alan.

I'm here for two reasons, I like OS topics and I want to support BK.
That latter one is a problem, the same character traits which make
me want to help people when they have problems are the ones that make
me participate in the BK flames. If the kernel community is ready to
operate on a lower level of support from us, I'll bow out. It hasn't
been pleasant being here for the last couple of years and I'd prefer
to be gone.
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm

2003-07-29 04:25:49

by Gene Heskett

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Monday 28 July 2003 23:49, Larry McVoy wrote:
>On Tue, Jul 29, 2003 at 02:27:32AM +0100, Alan Cox wrote:
>> On Maw, 2003-07-29 at 01:34, jw schultz wrote:
>> > Now if we could cut off the threads about BK (as opposed to
>> > bk servers) started by anyone other than Larry...
>>
>> Even better - by Larry too, excepting when its kernel relevant
>> like downtimes, updates etc
>
>Dave and Linus cc-ed me on the vger crackdown discussions and I
> offered to unsubscribe from the kernel list if it would help.
> Dave's comment was that I don't start the wars, which is probably
> true. I tend to respond to attacks, not go looking for fights.
> I'd be curious to know when it is that you think I've started a
> flame fest here, Alan.
>
>I'm here for two reasons, I like OS topics and I want to support BK.
>That latter one is a problem, the same character traits which make
>me want to help people when they have problems are the ones that
> make me participate in the BK flames. If the kernel community is
> ready to operate on a lower level of support from us, I'll bow out.
> It hasn't been pleasant being here for the last couple of years
> and I'd prefer to be gone.

As I've been lurking here for a while, I can appreciate that ones skin
gets a bit tender after a while Larry. OTOH, your replies have
helped a lot of us lurkers to see a much more balanced view of the
so-called argument. Without your input, there aren't too many other
voices to stand up and be counted. FWIW, (not much I'm afraid) I'm
on your side. If the others want to do a similar program then they
know what they want it to do and they should go ahead and write it,
but IMO the users interface shouldn't be beholden to *anything* BK
does. If their offering is a better offering than BK, so be it,
we'll have YACVS. But, do it from a clean room, based only on what
the programmer thinks is important, not on something that attacks
your program, and even depends on it to be usefull.

In other words, stick around and balance the scales from time to time.

--
Cheers, Gene
AMD K6-III@500mhz 320M
Athlon1600XP@1400mhz 512M
99.27% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com attornies please note, additions to this message
by Gene Heskett are:
Copyright 2003 by Maurice Eugene Heskett, all rights reserved.

2003-07-29 04:42:20

by jw schultz

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Mon, Jul 28, 2003 at 08:49:41PM -0700, Larry McVoy wrote:
> On Tue, Jul 29, 2003 at 02:27:32AM +0100, Alan Cox wrote:
> > On Maw, 2003-07-29 at 01:34, jw schultz wrote:
> > > Now if we could cut off the threads about BK (as opposed to
> > > bk servers) started by anyone other than Larry...
> >
> > Even better - by Larry too, excepting when its kernel relevant like
> > downtimes, updates etc
>
> Dave and Linus cc-ed me on the vger crackdown discussions and I offered
> to unsubscribe from the kernel list if it would help. Dave's comment was
> that I don't start the wars, which is probably true. I tend to respond
> to attacks, not go looking for fights. I'd be curious to know when it is
> that you think I've started a flame fest here, Alan.
>
> I'm here for two reasons, I like OS topics and I want to support BK.
> That latter one is a problem, the same character traits which make
> me want to help people when they have problems are the ones that make
> me participate in the BK flames. If the kernel community is ready to
> operate on a lower level of support from us, I'll bow out. It hasn't
> been pleasant being here for the last couple of years and I'd prefer
> to be gone.

As the one who made the comment that Alan (tongue in cheek,
i hope) reacted to, let me say that your posts have been
welcome except when someone is pushing your buttons. When
the topic has been about code your comments have been
informative. Perhaps if the BK and licensing flame-fests
are interdicted things will become a bit more pleasant for
you.

--
________________________________________________________________
J.W. Schultz Pegasystems Technologies
email address: [email protected]

Remember Cernan and Schmitt

2003-07-29 07:46:16

by hp

[permalink] [raw]
Subject: Re: The Well-Factored 386

David S. Miller am Montag, 28. Juli 2003 23:30:
> On Tue, 29 Jul 2003 00:27:37 +0200
>
> Stephan von Krawczynski <[email protected]> wrote:
> > I have not read any complaints (1 pro)
>
> People send me complaints about him every time he posts.
> And I don't care if you don't like my attitude, my job as
> list manager is not to be liked by people or to have them
> like my attitude. My job is to keep the lists clean.
>
> I told people last week that I was going to start cracking down on
> this. And I was absolutely serious. I know that linux-kernel is

would you, please, explain what you have to do with the 'linux-assembly'
mailing list?!

Date: Mon, 28 Jul 2003 15:30:55 -0700
From: "David S. Miller" <[email protected]>
To: Stephan von Krawczynski <[email protected]>
Cc: [email protected],
[email protected],
[email protected]
Subject: Re: The Well-Factored 386



> often a very unnice place to be subscribed, and I am going to change
> that.
>
> I publicly asked him NICELY to stop his postings, and he responded
> with his description of why his x86 assembler written in bash is so
> great. I have zero sympathy for people who act that way.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly"
> in the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
FAQ(s) + DOCs at http://linuxassembly.org
pse, reply to << lx -at- lxhp -dot- in-berlin -dot- de >>

2003-07-29 12:11:05

by Alan

[permalink] [raw]
Subject: Re: The Well-Factored 386

On Maw, 2003-07-29 at 04:49, Larry McVoy wrote:
> Dave and Linus cc-ed me on the vger crackdown discussions and I offered
> to unsubscribe from the kernel list if it would help. Dave's comment was
> that I don't start the wars, which is probably true. I tend to respond
> to attacks, not go looking for fights. I'd be curious to know when it is
> that you think I've started a flame fest here, Alan.

I'd agree entirely with that comment.



2003-07-29 14:21:50

by Timothy Miller

[permalink] [raw]
Subject: Re: The Well-Factored 386



David D. Hagood wrote:
> David S. Miller wrote:
>
>> And I don't care if you don't like my attitude, my job as
>> list manager is not to be liked by people or to have them
>> like my attitude. My job is to keep the lists clean.
>
>
> I'd just like to say "BRAVO SIR!" I am glad to see you doing this, and I
> support your actions 100%.
>
> Anybody's right of freedom of speech ends when they force the unwilling
> to listen - this troll was -10, Offtopic. He was not talking about the
> kernel, any development of interest to the kernel, and I for one am glad
> he is getting bounced.
>
> Let him post his drivel-scribblings on Slashdot, along with goatse.cx,
> the porn trolls, and the *BSD is dead trolls.


I personally have made more than my fair share of off-topic posts. Some
of them have been filtered, which really doesn't bother me, because,
well, they were off-topic.

Sometimes, I get carried away, but I do keep in mind that off-topic
posts can be very rude. I remind myself of this out of respect for
others on the list.

2003-07-29 14:44:43

by Timothy Miller

[permalink] [raw]
Subject: Re: The Well-Factored 386



Larry McVoy wrote:
> If the kernel community is ready to
> operate on a lower level of support from us, I'll bow out. It hasn't
> been pleasant being here for the last couple of years and I'd prefer
> to be gone.

I'd rather you stayed.

2003-07-29 16:23:51

by hp

[permalink] [raw]
Subject: Re: The Well-Factored 386

could you pse keep that 'discussion' to where it belongs?!
it is definitely 'off topic' in the "linux-assembly" mailing list.

and, it is ridiculous, since it already generated much (M U C H) more traffic
than the messages you're just complaining about. - so you should eliminate
yourself, consequently, from that 'clean' list of yours -???-

you complaint it is un-just - or did you, for instance, eliminate the owner of
<[email protected]> from your lk-devel list, too? who already emanated so many
messages which have nothing to do with linux kernel devel that Rick would
never be able to make up for that much of nonsense.

best,
hp

Timothy Miller am Dienstag, 29. Juli 2003 15:32:
> David D. Hagood wrote:
> > David S. Miller wrote:
> >> And I don't care if you don't like my attitude, my job as
> >> list manager is not to be liked by people or to have them
> >> like my attitude. My job is to keep the lists clean.
> >
> > I'd just like to say "BRAVO SIR!" I am glad to see you doing this, and I
> > support your actions 100%.
> >
> > Anybody's right of freedom of speech ends when they force the unwilling
> > to listen - this troll was -10, Offtopic. He was not talking about the
> > kernel, any development of interest to the kernel, and I for one am glad
> > he is getting bounced.
> >
> > Let him post his drivel-scribblings on Slashdot, along with goatse.cx,
> > the porn trolls, and the *BSD is dead trolls.
>
> I personally have made more than my fair share of off-topic posts. Some
> of them have been filtered, which really doesn't bother me, because,
> well, they were off-topic.
>
> Sometimes, I get carried away, but I do keep in mind that off-topic
> posts can be very rude. I remind myself of this out of respect for
> others on the list.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-assembly"
> in the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de
FAQ(s) + DOCs at http://linuxassembly.org
pse, reply to << lx -at- lxhp -dot- in-berlin -dot- de >>