Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 1997 14:38:47 +0930 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        rhh@ct.picker.com (Randall Hopper)
Cc:        pgiffuni@fps.biblos.unal.edu.co, emulation@FreeBSD.ORG
Subject:   Re: Fun with DOSCMD (was Re: modifying boot mgrs FROM FREEBSD)g
Message-ID:  <199708120508.OAA06051@genesis.atrad.adelaide.edu.au>
In-Reply-To: <19970807194755.37948@ct.picker.com> from Randall Hopper at "Aug 7, 97 07:47:55 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Randall Hopper stands accused of saying:
> 
> Ok.  Mostly I just wanted to step through some of it to help get a faster
> line on how the internals work.  I figured it'd be a easier than picking
> through the source and printfs.

Not really.  Getting gdb into a poition to talk to the doscmd kernel
is fairly tough (as you will have seen).

> Is there a rough architecture overview or some notes/scribbles lying around
> anywhere on-line that might give someone a head start with this?

Here (points at self). 8)

doscmd runs in two separate modes, with slightly different sets of
behaviour.

In "boot" mode (the simplest), it establishes the memory footprint as
the BIOS would during initialisation, reads the bootsector from the
boot medium into the standard location, and then calls it in vm86 mode.

In "dos" mode, it additionally establishes a pile of DOS data
structures and adds interrupt handlers for the DOS "system calls",
then loads the DOS executable and runs that in vm86 mode.

In any case, vm86 mode is managed as follows :

 - Signal delivery on a separate (no-application) stack is requested.
 - A signal handler is established for the signal indicating a vm86 trap.
 - A repeating SIGALRM signal is arranged to allow for the simulation 
   of time-related events.
 - vm86 mode is entered by constructing a phony stackframe for 
   sigreturn() which sets the PSL_VM bit in the processor's status word.

Execution returns to the emulator when the emulated process executes
an instrution that results in a vm86 trap.  See trap.c for the handler
code for this, but note that some traps are handled directly in the
kernel.

The remainder of the guts of doscmd are simply handlers for these traps.

> Randall

-- 
]] Mike Smith, Software Engineer        msmith@gsoft.com.au             [[
]] Genesis Software                     genesis@gsoft.com.au            [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708120508.OAA06051>