[comp.sys.ibm.pc.programmer] 386 Protected Mode Interrupt Table..HELP

shih@iris.ucdavis.edu (Alan S. Shih) (02/25/90)

   Are there anybody who know how to switch interrupt table from real
   mode to protected mode? I know that interrupt table is only
   relative with IDT, however, is the memory address for there bios
   routine still the same? 
   I am trying to write a OS for my 386 which hopefully will utilize
   my vga + multitasking.  Any advise is appreciated!

Alan Shih


\_______________________________________________________/
 |						        |
 |	Alan Shih					|
 |							|

harlow@plains.UUCP (Jay B. Harlow) (02/25/90)

In article <6840@ucdavis.ucdavis.edu> shih@iris.ucdavis.edu (Alan S. Shih) writes:
>
>   Are there anybody who know how to switch interrupt table from real
>   mode to protected mode? I know that interrupt table is only
>   relative with IDT, however, is the memory address for there bios
>   routine still the same? 
>   I am trying to write a OS for my 386 which hopefully will utilize
>   my vga + multitasking.  Any advise is appreciated!
>

Alan,
    in protected mode the Interrupt table becomes a table of gates,
which are 8 byte descriptors which discribe where your interrupt routine
is, who my use it (the privalage level needed to access it) how it is
accessed (task, trap, interrupt)
	task - a seperate task is envoked suspend the current task
	trap - interrupt flag is left alone
	interrupt - interrupt flag cleared ( for device IRQ's)
trying to use your bios in protected mode is going to be tricky
most bios'es are not designed to be run in protected mode, the segment
selectors are all different (you do know about segment selectors 
don't you) unless you have a PS/2 with ABIOS. I am setting up a small
protected mode system and ALL i/o i need to write myself a suggestion
is to write a register dump routine as soon as possible so you 
know where your program is hanging (i have one patched into ALL INT's
for now ;-) I hope this helps

			Jay
-- 
		Jay B. Harlow	<harlow@plains.nodak.edu>
	uunet!plains!harlow (UUCP)	harlow@plains (Bitnet)

Of course the above is personal opinion, And has no bearing on reality...

uucp@ucdavis.ucdavis.edu (uucp) (02/26/90)

     Jay:

	Thanx for your reply, I really appreciated.
	Is there any book that you can refere for looking up hw ports
	in order for me to write "pesudo-Bios" codes?
	Thanx.


-- 
 |	Alan Shih					|
 |	University California Davis EE			|
 |   :> smile, today is the first day			|
 |		of the rest of your life ;>		|

 |	Alan Shih					|
 |	University California Davis EE			|
 |   :> smile, today is the first day			|
 |		of the rest of your life ;>		|

harlow@plains.UUCP (Jay B. Harlow) (02/26/90)

In article <9002251653.AA12679@iris.ucdavis.edu> uucp@ucdavis.ucdavis.edu (uucp) writes:
>
>     Jay:
>	Thanx for your reply, I really appreciated.
>	Is there any book that you can refere for looking up hw ports
>	in order for me to write "pesudo-Bios" codes?
>	Thanx.

I had to refer to a number of books (plus my general knowledge) to set
up my I/O routines... some books that i find helpful are:

	"The Programmers's PC Source Book", Thom Hogan, MS Press 
		some useful information (keyboard tables...), sparatic

	"Programing the 80386", Crawford Gelsinger, SYBEX
		VERY GOOD book, gives C source for how instructions 
		and internals works

	"Inside the 80286", Ed Strauss, The Waite Group, Brady (Prentice
							Hall press)
		not as nice as above 386 book, but useful for 286 specific

	"Programmer's Guide to PC & PS/2 Vidio Systems",
			Richard Wilton, MS Press
		Good book on vidio displays

	"Keying on a Standard", Bob Smith, PC Tech Journal Vol 5 Num 7 P 134
		Good article on programming the Keyboard

Plus a number of other books and articles i have read over the years...
	( also a lot of 'BEATING' the machine to get it to work ;-)


A couple more hints,
	when i started out I would ask BIOS which vidio mode i was in
and tell it to go to a TEXT mode ie MGA = mode 7, CGA(EGA,VGA...)= mode 3
decide where my vidio buffer is ( MGA, CGA ) and do all the
I/O as text via a common segment selector (descriptor has base of vidio mem).
unlike MINIX which appears to have a selector for MGA, and a selector for CGA
then decides which one to use?? (i may be wrong on this)

			Jay
-- 
		Jay B. Harlow	<harlow@plains.nodak.edu>
	uunet!plains!harlow (UUCP)	harlow@plains (Bitnet)

Of course the above is personal opinion, And has no bearing on reality...

paula@bcsaic.UUCP (Paul Allen) (02/27/90)

In article <6840@ucdavis.ucdavis.edu> shih@iris.ucdavis.edu (Alan S. Shih) writes:
>
>   Are there anybody who know how to switch interrupt table from real
>   mode to protected mode? I know that interrupt table is only
>   relative with IDT, however, is the memory address for there bios
>   routine still the same? 
>   I am trying to write a OS for my 386 which hopefully will utilize
>   my vga + multitasking.  Any advise is appreciated!
>
>Alan Shih

If you want to hack the source for a 386 protected-mode operating system,
get Minix.  It's a Unix clone that runs on 80x86 PC's, Atari ST's, Macintoshes,
and others.  Minix is sold by Prentice-Hall.  The latest PC version from PH
(1.3) only runs in real mode, but the new version (1.5) as it will ship from
PH will run on a 286 or 386 in 286 protected-mode.  The changes to go to 386
protected-mode are fairly small.  You need a 32-bit compiler, which isn't
supplied by PH.  Bruce Evans has released binaries of his compiler that runs
in 16-bit mode and generates 32-bit object files.  I've used that and his
32-bit diffs to bootstrap a Minix kernel that runs in 32-bit mode.  Work is
in progress to port the GNU C compiler to this environment.  (I just compiled
and linked a "hello, world" program using gcc, gas, gnu-ld, and a libc.a
built from the Minix lib sources on a VAX.  The next step is to try to run
it on 32-bit Minix.)  My guess is that the 386 version of Minix will be a
reasonable alternative to the various 'real' Unix's for PC-class hardware
in another month or so.

PC Minix currently lacks any kind of graphics driver.  We need your help!
Check out comp.os.minix or ask for the Minix Information Sheet for more info.

Paul Allen

-- 
------------------------------------------------------------------------
Paul L. Allen                       | pallen@atc.boeing.com
Boeing Advanced Technology Center   | ...!uw-beaver!bcsaic!pallen