*BSD News Article 19404


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!convex!convex!cs.utexas.edu!swrinde!gatech!prism!gt8134b
From: gt8134b@prism.gatech.EDU (Howlin' Bob)
Newsgroups: comp.os.386bsd.development
Subject: Re: V86 mode & the BIOS (was Need advice: Which OS to port to?)
Message-ID: <108457@hydra.gatech.EDU>
Date: 12 Aug 93 04:39:21 GMT
References: <3390@vall.dsv.su.se> <CB11pL.D12@imag.fr> <107181@hydra.gatech.EDU> <1993Aug4.073826.24956@fcom.cc.utah.edu> <107725@hydra.gatech.EDU> <245jrfINNrc0@bonnie.tcd-dresden.de>
Organization: Georgia Institute of Technology
Lines: 43

In <245jrfINNrc0@bonnie.tcd-dresden.de> j@bonnie.tcd-dresden.de (J Wunsch) writes:

>In <107725@hydra.gatech.EDU> gt8134b@prism.gatech.EDU (Howlin' Bob) writes:
>>can use them), but all this is done by the Linux ioperm() system
>>call, which makes use of the 386's TSS I/O bitmap field.

>Does this mean, you've a 64 K IO bitmap there? If so, process context
>switch must be terribly slow. If not, what do you do with those recent
>grafx adaptors that care to use IO ports above 0x3ff?

No, a 128 byte bitmap, which allows (as you surmised) direct control over
ports up to 0x3ff.  For ports above 0x3ff, what few there are, dosemu
provides another scheme:

  1. I/O accesses to an address above 0x3ff fault into the dosemu task
     which accessed it (more than one can be running :-)
  2. dosemu unravels the instruction, notices the port is above 0x3ff,
     and checks its internal list to see what sort of I/O is allowed
     to that port.
  3. If any is, dosemu sets IOPL to 3, does the appropriate I/O to/from
     that port.
  4. dosemu sets the IOPL back to 0.
  5. dosemu then applies any andmasking/ormasking as defined in the
     I/O permissions list, and puts the result into the appropriate
     register.
  6. dosemu advances IP and re-enters V86 mode.

I wouldn't mind a special case in the Linux kernel for the dosemu
task(s) to have the full 64k bitmaps, but that's a bit difficult
and not really necesary.  I don't think the ports above 0x3ff are
often used.

As for slow task switching, the 386 doesn't access the I/O permissions
bitmap until an I/O instruction occurs.  The size of the bitmap has
no effect on task switching performance.

Linux has rather zippy task switching, in my opinion.  

-- 
Robert Sanders
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt8134b
Internet: gt8134b@prism.gatech.edu