Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.development > #10001

Re: FYSOS: The Graphical User Interface

From Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam>
Newsgroups alt.os.development
Subject Re: FYSOS: The Graphical User Interface
Date 2016-08-27 19:11 -0400
Organization Aioe.org NNTP Server
Message-ID <20160827191155.2fbacf86@_> (permalink)
References (14 earlier) <npjl0o$s2o$1@dont-email.me> <20160824070006.0ef4cbd1@_> <npmhpm$uml$1@dont-email.me> <20160825184541.025acb6b@_> <npsgtt$97c$1@dont-email.me>

Show all headers | View raw


On Sat, 27 Aug 2016 17:59:41 +0100
James Harris <james.harris.1@gmail.com> wrote:

> On 25/08/2016 23:45, Rod Pemberton wrote:
> > James Harris <james.harris.1@gmail.com> wrote:  

> > [...]
> Unfortunately, it seems we must use the BIOS to adjust video modes.

We may only have to use it once.  Call the VESA routine in V86 mode.
V86 can trap port I/O calls.  Record the ports and values written.
A while back Alexei Frounze pointed out that this may not work due to
timing issues, either of gathering the ports or replaying the port
writes.

> IIRC, one text I read recently said that changing mode could update
> 50 different registers in a CRTC. That's not something we can
> feasibly do in our code. So the BIOS seems to be the only option -
> however it is run.

I program the CRTC for setting 80x25 text mode without the BIOS.  It
has four arrays of byte data which are written to ports for the
controller, and my C code has 15 writes to ports, some of which are
repeated port numbers, with four loops for each array, and some other
standalone writes.  There is roughly 60 bytes of sent data for the four
arrays.  (I think I may have miscounted.)

I.e., it can be done as long as you know what to do.  The length of the
process only means more work and time much be invested.

> For me, it's about portability and warrantability.

Ok.  Then, avoid untrusted code or any which is unknown.

In that situation, you'd might want to do a few things for security.

When the OS is known to be clean, you may want to checksum both the IVT
and VBIOS shadowed in ROM.  Make sure the checksum indicates that there
are no modifications.  If the IVT has changed, reset it.  If the VBIOS
code is modified, don't call it.

In theory, you'd want to lock the code so that only the video bios call
and nothing else can execute.  That's not possible without an emulator,
but something you could do is to blank the IVT and then call the VBIOS
routine.  If the VBIOS is not self-contained, i.e., it calls other BIOS
interrupts, this will go off into the weeds.  Of course, you don't want
that to happen.  You want to trap this to find out which interrupts
the routine calls.  So, you'd set the entire IVT to point to a trap
interrupt.  Each time an interrupt is called, you'd open up that
interrupt by resetting the vector in the IVT and calling it.
Eventually, you'd know all the interrupts the VBIOS calls for that
routine (and their sequence).  All the other interrupts can remain
blocked out in the IVT. This would limit exposure to other interrupts.
This, of course, assumes a known good state, just like saving and
restoring the IVT.

You could also call the VBIOS routine in V86 mode and record the ports
used, but instead of recreating the VBIOS routine for those ports,
simply always call the routine from V86 mode, but blocking all I/O
ports _not_ used by the VBIOS routine.  This would provide a measure of
port control, e.g., malware couldn't stuff keyboard or mouse input
because the ports are blocked for them.

Also, you'd want to make sure 40:67h 40:72h and CMOS 0Fh flag are set
correctly.

There is probably some way to implement x86's privilege levels or
rings to maintain control too, but I'm not up to date on that.

> > Jim Leonard (aka "Trixter") has the Flopper project to boot from
> > DOS, old PC games that booted directly from floppy without
> > executing DOS. DOS obviously has hooked a bunch of interrupts that
> > need to be reset. So, the default BIOS vectors must be restored to
> > boot the game as it was intended to run without DOS.  This was why
> > I looked into this some years ago.  
> 
> Do you mean he worked out a portable way (i.e. one that works on any
> PC) to reset the IVT after something has hooked it? How did he find
> the original IVT vectors?

I don't recall how his worked.  It's included in the Flopper package.
His code didn't work on my machine.  After quick check, it looks like
his code boots, saves the IVT, reboots.  So, the answer to your
question is, "No."  I had to develop my own code to save the original
IVT and reload the IVT.  Afterwards, I fiddled around with recreating
an IVT from values saved by DOS, in BIOS, fixed entry points, moved
vectors etc.

link to Flopper on right hand side
http://www.oldskool.org/

my 2006 post for saving/restoring IVT
https://trixter.oldskool.org/2006/04/24/programming/#comment-174


Rod Pemberton

Back to alt.os.development | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

FYSOS: The Graphical User Interface "Benjamin David Lunt" <zfysz@fysnet.net> - 2016-07-08 11:52 -0700
  Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-16 11:00 +0200
    Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-16 11:14 +0100
      Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-16 19:07 +0200
        Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-16 19:42 +0100
          Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-16 21:32 +0200
            Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-16 23:22 -0400
              Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-17 13:50 +0200
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-18 01:41 -0400
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-18 10:47 +0200
            Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-17 08:45 +0100
              Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-17 13:57 +0200
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-18 01:47 -0400
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-18 10:59 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-18 11:37 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-18 17:38 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-19 10:03 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-19 22:34 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-22 17:43 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-22 19:04 +0200
    Re: FYSOS: The Graphical User Interface "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2016-08-16 04:18 -0700
      Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-16 12:25 +0100
        Re: FYSOS: The Graphical User Interface "Rick C. Hodgin" <rick.c.hodgin@gmail.com> - 2016-08-16 04:41 -0700
        Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-16 19:19 +0200
      Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-16 19:14 +0200
    Re: FYSOS: The Graphical User Interface "Benjamin David Lunt" <zfysz@fysnet.net> - 2016-08-16 19:24 -0700
      Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-17 12:26 +0200
        Re: FYSOS: The Graphical User Interface "Mike Gonta" <mikegonta@gmail.com> - 2016-08-17 10:42 -0400
          Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-18 01:16 +0200
            Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-18 12:17 +0100
              Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-18 19:23 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-19 17:29 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-19 22:55 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-22 17:18 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-22 19:23 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-23 11:46 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-23 23:44 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-24 08:29 +0100
                Re: FYSOS: The Graphical User Interface "Alexei A. Frounze" <alexfrunews@gmail.com> - 2016-08-24 02:39 -0700
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-24 17:43 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-24 11:25 +0200
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-23 17:50 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-24 09:14 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-24 12:39 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-25 10:46 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-25 12:40 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-25 12:10 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-25 14:43 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-27 13:56 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-27 15:59 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-27 17:03 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-27 22:43 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-28 09:22 +0100
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-28 11:51 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-28 13:08 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-27 19:12 -0400
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-28 10:41 +0200
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-28 08:48 -0400
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-27 19:12 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-28 10:16 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-28 08:46 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-28 18:45 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-28 17:51 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-29 07:55 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-29 06:40 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-31 06:43 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-24 07:00 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-25 11:37 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-25 18:45 -0400
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-26 10:00 +0200
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-26 16:16 -0400
                Re: FYSOS: The Graphical User Interface "wolfgang kern" <nowhere@never.at> - 2016-08-27 15:10 +0200
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-27 17:59 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-27 19:11 -0400
                Re: FYSOS: The Graphical User Interface James Harris <james.harris.1@gmail.com> - 2016-08-28 10:56 +0100
                Re: FYSOS: The Graphical User Interface Rod Pemberton <NoHaveNotOne@zxdehrnyya.cam> - 2016-08-28 08:45 -0400
        Re: FYSOS: The Graphical User Interface "Benjamin David Lunt" <zfysz@fysnet.net> - 2016-08-17 20:12 -0700

csiph-web