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


Groups > alt.os.development > #9983

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-25 18:45 -0400
Organization Aioe.org NNTP Server
Message-ID <20160825184541.025acb6b@_> (permalink)
References (12 earlier) <nph9i3$iho$1@dont-email.me> <20160823175057.5a05e728@_> <npjl0o$s2o$1@dont-email.me> <20160824070006.0ef4cbd1@_> <npmhpm$uml$1@dont-email.me>

Show all headers | View raw


On Thu, 25 Aug 2016 11:37:32 +0100
James Harris <james.harris.1@gmail.com> wrote:

> On 24/08/2016 12:00, Rod Pemberton wrote:
> > On Wed, 24 Aug 2016 09:14:08 +0100
> > James Harris <james.harris.1@gmail.com> wrote:
> >> On 23/08/2016 22:50, Rod Pemberton wrote:  
> >>> On Tue, 23 Aug 2016 11:46:20 +0100
> >>> James Harris <james.harris.1@gmail.com> wrote:  
...?

> > FYI, I'm making a really wild random guess here.  The
> > BIOS functions which wolfgang is discussing probably are on modern
> > processors that have SMM mode, which could work instead of 'unreal'
> > mode.  IIRC, SMM mode is like an unprotected RM with full machine
> > access.  
> 
> That's true but I don't see SMM as necessary. RM is also unprotected 
> with full machine access, just as SMM is. SMM is essentially RM
> running from hidden memory. Both begin with 16-bit registers etc.

It's true that if the BIOS is called in RM instead of PM, then it's
free to enter PM.  If not, it's "locked" out.

Wolfgang said that the BIOS checked for PM.  If the BIOS is in PM, how
could it access memory above 1MB?  The only possible way that I know of
is SMM.  It's possible, albeit unlikely, a BIOS would switch to SMM, if
it found itself locked out of entering PM.  That's all I was thinking
here.

> To start with I wanted to use the BIOS only to switch video modes. I 
> cannot think of any other portable way to change the screen
> resolution.

SVGA is portable.  It's just the VESA methods that are not.  Yes?
The higher level VESA mode numbers aren't standard either.

> I've always been suspicious of binary translators, querying whether
> they can really do the job in all circumstances - for example, in the 
> presence of self-modifying code and code which jumps to the middle of
> an instruction.

Does the BIOS or video BIOS have self-modifying code? ...
I would generally assume that code is clean.

> That said, there seem to be some successful binary translators out 
> there. QEMU?

Yes.  I'd have to dig through my old posts around 2007 or Google.

> In terms of running 16-bit code under a LM OS it looks to be
> possible. All that would be needed would be to duplicate some of the
> LM code (especially interrupt handling) into PM. Then, to dispatch a
> 16-bit piece of code the CPU would be switched into PM. It would be
> switched back to LM to run other code.

If the BIOS goes from RM16 to PM32 (directly or temporarily for
'unreal' mode), but the BIOS is called from CM16, might the BIOS switch
from CM16 to CM32 ... ?  CS.ar.D gets set like a RM16 to PM32 switch.
CS.ar.L is clear for this. CS.ar.L is ignored for older processors, but
probably clear or cleared by default.  IUIC, EFER.LMA is only
accessible via RDMSR and WRMSR via protected mode.  So, since this
is set for CM16, this should remain set, when calling BIOS from CM16.
One issue is that CR0.PE is set for CM16.  The BIOS can't set CR0.PE
for PM32 from PM16, but maybe it can do so without issue for CM16 to
CM32?  It's unlikely, but work a look.  If so, then everything might
work out, if there are no traps, exceptions, or faults triggered.

It's too bad that we can't confirm that the BIOS is 16-bit clean.
Wolfgang said the video BIOS isn't (anymore?).  Each one of the 16-bit
modes has a corresponding 32-bit mode which can address above 1MB.
Switching from one to the other is orthogonal, i.e., set CS.ar.D.  We'd
need to be able to confirm that BIOSes consistently used that method to
access memory above 1MB.  If confirmed, then you'd only need to switch
out of PM64 to one of the 16-bit modes (RM16, PM16, or CM16) and the
BIOS would switch to a 32-bit mode (RM32, PM32, or CM32) for you to
access above 1MB.  However, my current understanding is that BIOSes
switch from RM16 to PM32 (either directly or temporarily for 'unreal'
mode) to access above 1MB, but I don't have any BIOS documentation
other than RBIL.

> > DJGPP (GCC for DOS) does a *large* amount of switching from PM to RM
> > via a DPMI host, like well over 95% of an apps' execution time.
> > It's hardly noticeable.  
> 
> I don't understand that. How can 95% of an app's execution time be 
> "hardly noticeable"?

If the code finishes in what seems like a reasonable amount of time,
how do you tell that it's slow?  It's just like starting a 386 machine
or a modern machine.  DOS starts up quickly on both.  The same is true
of apps running quickly.  You can notice that they are faster on the new
machine, but you can't notice how slow it actually is.  The code must be
compiled and executed on another OS, and run on the same machine, in
order to obtain a reference as to how much overhead the app has on the
OS in question.  As I said, even under Windows 98/SE, they run somewhat
faster, but not amazingly so.  Of course, more cores, less OS overhead,
and a 32-bit/64-bit OS, probably makes a bigger advantage.

> > Why wouldn't you be able to maintain execution control?  The BIOS
> > code is trusted and shouldn't call non-BIOS code, but will call
> > other interrupts.  
> 
> In increasing order of untrustability:
> 
> - The BIOS is on the motherboard and could be buggy.

Anything specific that concerns you for this or just speculative loss of
control?   e.g., random bug, BIOS virus, NT flag set by malware, saved
stack address changed for RET or IRET, stack overflow/underflow, ... ?

> - The video BIOS may have come from a plug-in graphics card.

Ditto.

> - Something may have hooked the IVT before our OS started. That is 
> especially a problem if we have been started from DOS or a boot
> manager.

The best option is to just save a clean copy of the default BIOS to
disk and load when needed.  I think we may have discussed this in the
past, or I did with someone ...  Anyway, you can restore vectors.  Many
are saved by both the BIOS and DOS, while others have specific values.
I'll start another thread as there is much data to post.

> > You have full control over the BIOS IVT values. You
> > can set them or change them.  
> 
> Yes, but we cannot reset them to those the BIOS originally used. Say 
> something has hooked INT 0x10. We cannot know what that vector should
> be set back to. Nor can we know what video card has legitimately
> hooked it. The whole thing is a large minefield of uncertainty.

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.


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