Heading:qjk40(635)How to Use Midas with Piloty756qjk40\b27BPage Numbers: Yes  X: 527  Y: 10.5"qjk40XEROXPARC8 February 1982z18556l3033c\f2 5f0 1b5BTo:	Microcode FileFrom:	Jim Frandeen, Edward FialaSubject:	How to Use Midas with PilotFiled On:	[Indigo]<D0Docs>DebugPilotWithMidas.Bravo, .Pressz18556l3033(0,65535)(1,4960)\f1 3f0t2 1t0 16f1 5f0t2 1t0 28f1 8f0t2 1t0 28f1 10f0t2 1t0 50f1This is a short description of how to debug Pilot with Midas; it works for the Cedar variant of Pilot and handles any combination of microswitch/Star keyboards and CSL/LF monitors.  It assumes you already know how to use Midas.  Documentation for Midas can be found on [Indigo]<D0Docs>D0Midas.Press.  You will need a Midas disk to start with.z18556x4e12j(635)If you don't already have a Midas disk, you will need to build one:z18556x4e12j1. Spin up a clean disk on your Alto.  Boot the NetExec and invoke NewOS. Use the long installation dialog and erase the disk.2. Retrieve two files from [Idun]<WD0>:z18556l4268x4e12MidasDisk.doz18556l5538x4e12Do.runz18556l5538x4Type:z18556l4268x4e12Do MidasDiskz18556l5538x4e12This procedure will prompt you for the name of a file server where it can find Alto files.z18556l4268x4e123.	When you finish the above procedure, you will have a disk current as of the last SDD integration.  Then update to Ed Fiala's latest release by loading several FTP dump files:	[Indigo]<D0>D0MidasRun.Dm,	[Indigo]<D0Source>CedarUCode.Dm, and	[Indigo]<D0SOurce>InitialSources.Dm;then you retrieve [Indigo]<D0>Midas.Programs.z18556l4268x4e124.	Finally, call Ed Fiala or send message to Fiala.Pa for any special instructions.z18556l4268x4e12There are several important limitations to the ways in which Midas can be used to debug Pilot.  The first is that you must BEGIN with Midas.  If instead you attempt to attach to a machine which is in an interesting state, then Midas will boot the machine while activating its Kernel microcode, and all RM registers and the TPC's for the tasks will be reset (possibly storage will survive booting, however).z18591x4e12jThe second limitation is that the various microcode systems that you run must all reserve space for the Midas Kernel and have an appropriate linkage between the fault handler and the Midas Kernel.  Initial has an IMReserve for the Midas Kernel; if you assemble the Pilot microcode with WithMidas=1 in GlobalDefs.Mc, then Pilot also has an IMReserve for the Midas Kernel.  Pilot microcode at the present time is built with WithMidas=1, but the Cedar variant frequently is not built with WithMidas=1.  However, the normally released Alto emulator overwrites the Midas Kernel, so you will need to obtain a special debugging version of the Alto emulator before attempting the "Start From Alto" procedure discussed below.z18591x4e12jThe third limitation is that you cannot activate Pilot directly from Midas by loading and running .Mb files.  Instead, you must put the Pilot germ and microcode somewhere on the Dolphin, and then load the microcode by running either the Initial microcode or the Alto RunPilot subsystem.  There are two ways to start Pilot from Midas:. z18591x4e12j1.  Use Midas to boot Pilot directly.  For this method, you must have Pilot microcode and the Pilot Germ installed on your SA4000; generally speaking, the microcode installed on the SA4000 must be the SAME as that on your Midas debugging disk.  In addition, you must have a Physical Boot Volume set. z18591l4268x4e12j2.  Use Midas to boot Alto mode.  From the Alto Executive, type RunPilot.  For this method, you must have Pilot.Eb and the Pilot Germ installed on the Alto volume.  In addition, you must have a Physical Boot Volume set. ???What switch makes RunPilot take these from the Alto volume???z18591l4268x4e12jUsing Midas to Boot Pilot Directlyz18591e18j(2048)\b34BBoot the Midas disk and type Midas/i Pilot.  The Pilot.Midas command file will first load Initial.Mb, insert a breakpoint at RamLoaded, and start Initial at SAPilotStart.  If all goes properly, Initial will read the Pilot microcode and all of its overlays from your SA4000 into storage, and the breakpoint at RamLoaded will be hit after LoadRAM has loaded Pilot1 into the microstore; then Pilot1 symbols are loaded by RunProg and the RamLoaded breakpoint is reinserted in octal (at IMX 316); this is necessary because all previous symbols and breakpoint information (which pertained to Initial) have been flushed by Run-Prog; since the space occupied by the LoadRAM module in Initial has been IMReserved in Pilot, the RamLoaded symbol is no longer available.z18591e12jThe Pilot.Midas command file pauses at this point with a message saying that Pilot1 is loaded, and you may abort the command file or continue it.  If you continue the command file, it will pause again at BootEmulators in Initialize.Mc after comleting all device initialization but before loading the Pilot2 overlay.  If you continue from there, it will pause a final time after loading the Pilot2 overlay; if you continue from there, your physical boot volume will be started.z18591e12jAssuming that you abort the first time the Pilot.Midas command file pauses, then you have the following options:z18591e12ja) Kill the IMX 316 breakpoint and proceed, letting Pilot start normally.  After it is running, you can get control with Midas control-C and establish a suitable debugging context as discussed below.z18591e12jb) Insert any breakpoints in Pilot1 that you wish and continue.  This allows debugging initialization and other Pilot1 microcode.z18591e12jc) If you want to debug the terminal microcode, then the driver for the LF keyboard system is included in Pilot1, so you can insert breakpoints directly; for a CSL keyboard system (with either a CSL or LF monitor), you must proceed from the RamLoaded breakpoint--the next time you get to that breakpoint, the microcode for that terminal, obtained from the first or second overlay in PilotD0.Eb or CedarD0.Eb, will have been loaded into the microstore.  See below for establishing a debugging context.z18591e12jTo debug Pilot2 microcode, you should continue the command file until it indicates that Pilot2 has been loaded; then abort it. z18591e12jUsing Midas to Boot Alto Modez18591e18j\b29B1.  Obtain a special debugging version of the Alto emulator that contains an IMReserve for the Midas Kernel--normal Alto microcode overwrites the Kernel and cannot be used.  [Indigo]<D0>NewAMesa.Mb with CSL keyboards or [Indigo]<D0>LFAMesa.Mb with LF keyboards are suitable; put one of these on your Midas disk.z18591e12j2.  Boot the Midas disk and type "NewAMesa;L"; this loads the Alto microcode.  Start the Alto emulator with "EGO;G" "KGO;G" or "KGOP2;G" for ether boot, partition 1 boot, or partition 2 boot, respectively.  The Alto Executive will appear shortly on the screen.z18591e12j3.  Type RunPilot to the Alto Executive--this will use the installed pilot germ and microcode.  RunPilot also has options that allow the germ and microcode to be taken from files in the Alto file system; these options are described somewhere else.z18591e12j4.  When Pilot begins execution, you may abort it with the mouse button or control-C.  See below for how to establish the appropriate context for debugging after you have gotten control.z18591e12jDisplaying Appropriate Symbols From Midasz18591e18j\b41BWhen appropriate microcode is loaded, you can setup a debugging context by doing Run-Prog on PILOT1SYMBOLS, PILOT2SYMBOLS, CSLSYMBOLS, or CSLFSYMBOLS.  Run-Prog clears all previous symbols and breakpoints and loads symbols from one of the four Pilot overlays--it is impossible to have symbols from more than one overlay concurrently active.  PILOT1SYMBOLS and PILOT2SYMBOLS also setup the middle column of the Midas display with registers generally of interest when debugging Pilot emulator code; CSLSYMBOLS and CSLFSYMBOLS setup the middle column with registers generally interesting when debugging one of the display drivers.z18591e12jAt any time you can change the contents of the Midas display by doing Read-Cmds on a variety of files in the menu with suggestive names.  Among these are the following:z18591e12jBBREGS	Displays BitBlt registers in middle column.z18591l7056d3704e12j(0,7056)(1,65535)RDCREGS	Displays RDC registers in middle column.z18591l7056d3704e3jGCDEBUG	Displays CedarGC registers.z18591l7056d3704e3jMEMERRORS	Displays memory error registers in right column.z18591l7056d3704e3jTX*	Various TextBlt registers.z18591l7056d3704e3jLoading the Eprom Microcodez18591e18j(2048)\b27BTo load the microcode that is normally loaded from the EPROMs, use the EPROM command file:z18591e12j1. Select Run-Prog on the Midas menu.z18591e12j2. When the Run-Prog menu appears, select EPROM.z18591e12j3. When SA4000Boot is loaded and the next menu appears, select continue.  This will cause the D0 to be booted from the Initial Microcode file.z18591e12jLoading Initialz18591e18j\b15BTo load the Initial microcode, use the Initial command file:z18591e12j1. Select Run-Prog on the Midas menu.z18591e12j2. When the Run-Prog menu appears, select INITIAL.z18591e12jWhen the command file is finished, the display will show some symbols of interest for the MemInit.Mc module.  The various starting addresses are on pages 1 and 2 of Initial.Mc; they include the following:z18591e12jSAAltoStart	boots and starts AMesa from the SA4000.z18591l7056d3704e12j(0,7056)SAPilotStart	boots and starts Pilot from the SA4000.z18591l7056d3704e3jEtherAltoStart	boots and starts AMesa from the 3 mb Ethernet.z18591l7056d3704e3jEtherPilotStart	boots and starts Pilot from the 3 mb Ethernet.z18591l7056d3704e3jSome interesting breakpoints in Initial are the following:z18591e12j(2048)RamLoaded	(IMX 316) where LoadRAM finishes.z18591l7056d3704e12j(0,7056)IMap	beginning of the map and storage test.z18591l7056d3704e3jimRepeatStorageTest	after map test.; here you can change the contents of the SoftQThreshold register to 100b if you want to make the storage test put pages with correctable errors into service.z18591l7056d3704e3jMemInitDone	end of storage test.z18591l7056d3704e3jMicrocodeLoaded	after loading microcode into the VM block at 1400b.z18591l7056d3704e3j