🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.intel
Article #74

Re: 386 Protected Mode

#74
From: Linus Torvalds
Date: Wed, 04 Nov 1992 13:08
45 lines
2703 bytes
In article <1d7nb7INN2ig@iskut.ucs.ubc.ca> rpjoyce@unixg.ubc.ca (Ron P Joyce) writes:
>I'm interested in learning about 386 protected mode programing for
>an Operating Systems course I'm taking.  If anyone has a good
>reference or some sample code it would be very helpful.
> 
>Specifically, I am (we are :-) interested in using the 386 protected
>mode to provide memory protection, and virtual memory, etc...

You might check out linux - it's 386-specific and does it all (assuming
you have an AT-compatible machine).  Anonymous ftp to tsx-11.mit.edu:
pub/linux.  You get a pretty complete unix system at the same time, but
if you stick to just the setup routines and some of the memory manager,
you might be able to find out what is going on. 

Linux uses both the 386 segmentation (for memory protection within a
task - user/kernel space) and paging features (for memory protection,
page sharing, virtual memory etc), as well as using the 386 tss for
task-switching (with IO protection, different page directories for
different tasks, lazy 387 state saving etc).  In fact linux uses about
every feature of the 386 I could find except the 286 segment mode (but
it does have V86-mode support). 

>Also, can I do this with Turbo Assembler?

Not fun.  I tested out Turbo Assembler for a while when I originally got
my 386, and it's possible but "nonoptimal" - at least for somebody like
me who isn't too happy about the braindead intel syntax.  Also, I found
it difficult to play with the segments, longjumps etc between real and
protected mode - but that might have been just the fact that I didn't
like the assembler. 

GNU C with the inline features is a nice package, augmented by GNU as
for those all-assembly files and as86 (a x86 assembler written by Bruce
Evans - not the DOS assembler) for the real-mode startup code. 

>PS  I have "Programming the 80386" by John Crawford and Patrick Gelsinger,
>    but it's not exactly "light" reading :-(

No, it's not "light" but it's definitely the best book out there on the
subject, at least as far as I've been able to find.  It may take a few
readings, but it does contain all the necessary info (not counting the
IBM PC/AT specific things).  Highly recommended for the not-so-faint-of-
hearted. 

		Linus
Technical Details
Message-ID: <1992Nov4.130845.16273@klaava.Helsinki.FI>
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!hydra!klaava!torvalds
References: <1d7nb7INN2ig@iskut.ucs.ubc.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!paladin.american.edu!news.univie.ac.at!hp4at!mcsun!news.funet.fi!hydra!klaava!torvalds
From: torvalds@klaava.Helsinki.FI (Linus Torvalds)
Newsgroups: comp.sys.intel
Subject: Re: 386 Protected Mode
Message-ID: <1992Nov4.130845.16273@klaava.Helsinki.FI>
Date: 4 Nov 92 13:08:45 GMT
References: <1d7nb7INN2ig@iskut.ucs.ubc.ca>
Organization: University of Helsinki
Lines: 45