User Tools

Site Tools


blog:pushbx:2023:0108_ldebug_work_in_december_and_early_january

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

blog:pushbx:2023:0108_ldebug_work_in_december_and_early_january [2023-01-08 16:36:12 +0100 Jan Sun] (current)
ecm created
Line 1: Line 1:
 +====== lDebug work in December and early January ======
 +
 +**2023-01-04**
 +
 +The end of December and the first days of January saw a lot of changes to the debugger.
 +
 +===== INSTALL and UNINSTALL commands =====
 +
 +These commands are in part to provide easier to memorise commands for installing and uninstalling interrupt hooks, namely the lDebugX interrupt 2Fh hook (to hook the DPMI entrypoint), the AMIS interrupt 2Dh hook, and the timer interrupt 8 hook.
 +
 +However, a new command added for lDDebugX/lCDebugX is ''INSTALL AREAS'', which installs the debuggable debugger's fault areas structures into another lDebugX (which must be discovered by its AMIS interface).
 +
 +The newly named ''putrunint'' function handles fault areas in lDebugX now, displaying the appropriate message. If the fault area message starts with a linebreak and the areas server debugger is controlled via serial I/O, then the linebreak is skipped. This is because the linebreak is intended to separate the debugger output from a partial line written prior to the fault. If the server debugger is controlled by serial I/O we assume that its output is on another terminal than the debuggee's.
 +
 +
 +===== Convenience entrypoints to cmd3 loop =====
 +
 +The first of these has been provided for a while already: The assembly makes sure to place ''cmd3'', the command loop entrypoint, at offset 0 within the lDEBUG_CODE segment. So a debuggable debugger can be recovered (eg from a fault) by entering a ''G=0'' command to the outer debugger.
 +
 +The second convenience entrypoint is a slight variation: If ''cmd3'' is entered at offset 1, it will additionally display a linebreak early on. This is intended in case the outer debugger is controlled by serial I/O, and the debuggable debugger has displayed a partial line last. As the outer debugger won't write to the same terminal as the debuggable one, the partial line will still be the last text visible there.
 +
 +Finally, if dual code segments are in use, then the convenience entries at offsets 0 and 1 will be duplicated to the lDEBUG_CODE2 segment as well. This allows to use a simple ''G=0'' or ''G=1'' command even when the ''cs'' is pointing to the second code segment.
 +
 +Finally, the ''BU'' command now breaks within the ''cmd4'' dispatcher instead of in its own function. This allows to enter ''G ip'' to skip until the next instruction is dispatched, instead of requiring ''T'' then ''G ip - 2''.
 +
 +
 +===== Disassembler changes =====
 +
 +If string instruction simulation is disabled, the access variables will be calculated with an assumed count of 1 instead of ''(e)cx''. This is more consistent with other decisions for access variables.
 +
 +An ''osize'' prefix for ''push'' and ''pop'' with a segment register is now considered part of the instruction.
 +
 +No repeated string instruction simulation occurs when running the U command now.
 +
 +
 +===== Test changes =====
 +
 +The test script ''test.py'' now accepts two environment variable to change the sleep durations. This allows to increase them from the command line without editing the test files. The most common cause of test failures is transient and timing-related.
 +
 +
 +===== Serial IRQ changes =====
 +
 +The big change is that the serial interrupt handler can now (and will by default) pass along calls to it to its downlink, enabling to share the IRQ with another program installed before the debugger's handler.
 +
 +It is assumed that the prior handler will issue an EOI. However, if during the KEEP prompt handling the debugger detects that its IRQ is still listed as in service within the In-Service Register, it will change an option of the debugger and issue an EOI. The option is to insure that the serial interrupt handler will issue EOIs going forward. If the IRQ sharing is also enabled then the prior handler will be called instead of chained to, and the EOI is issued after it returns.
 +
 +Further, the KEEP prompt handling will also check that the serial IRQ is still enabled in the PIC. If it is found to have been masked off, it is re-enabled and IRQ sharing is disabled. This is meant to catch the case where the default (or prior) handler masks the IRQ that it receives.
 +
 +With these three changes, the debugger will adapt to work on both older dosemu2, current dosemu2, and our 686 box, yet also enable shared IRQ use (eg for multiple serial ports).
 +
 +
 +===== Descriptor modification commands =====
 +
 +These commands allow to modify LDT descriptors in Protected Mode. They are inspired by the X commands for EMS modification. There's allocate, deallocate, set base, set limit, and set type commands. The allocate command writes to a result variable to allow scripting to access the allocated descriptor's selector.
 +
 +The base of an existing selector can be read using a ''LINEAR selector:0'' expression term. The type can be read using the new ''DESCTYPE selector'' expression term.
 +
 +
 +===== AMIS changes =====
 +
 +The new AMIS private function 33h is used to install fault areas structures. It is provided by lDebugX by default.
 +
 +DDebug/CDebug will now fill their downlinks with -1 while their interrupt handlers are not installed. This avoids the error for the DIL command otherwise encountered. Note that we do still return the not installed handlers in the AMIS interrupt list, which is not AMIS-compliant.
 +
 +
 +===== E command changes =====
 +
 +The E command can now be used without a parameter. It will continue after the last byte written or at the last byte displayed by a prior E command. This address is also available in the ''AES:AEO'' variable pair.
 +
 +Some 32-bit addressing bugs in the E command were also fixed.
 +
 +
 +===== Expression evaluator changes =====
 +
 +The ''DESCTYPE'' term has already been mentioned.
 +
 +The ''FL.xF'' variables allow to read the flag state of any of the arithmetic flags. The ''FL.'' prefix was chosen to avoid ambiguity with hexadecimal numbers.
 +
 +The RIxxy and PSP variables in lDebugX now save and restore the scratch selector, fixing bugs eg when writing a command like ''F cs:520 1 2 3 RI00P & FF''.
 +
 +The PSP variables as well as the TSR command were fixed to set the scratch selector limit, as ''getsegmented'' now sets up a limit of 0 (allowing to access only one byte). The TSR command had another bug in Protected Mode fixed.
 +
 +
 +===== Option 6 for ROM-BIOS I/O =====
 +
 +Option 6 flag 200h was changed to force only **output** to the ROM-BIOS interface (plus use of the ''rawinput'' line edit handler). That means Script for lDebug (.sld) files can still be run when this option is enabled. Another option flag was allocated for forcing Input and Output to both use the ROM-BIOS.
 +
 +
 +===== Boot load support for iniload query patch =====
 +
 +If the query patch flag 80h is set for a unit, bootable lDebug will now read the low 3 bits of the query patch and use them to set its ''BOOTUNITFLx'' variable for the corresponding unit. This allows to patch a single site of the debugger executable to achieve loading from a unit, including the SLD startup file.
 +
 +As a companion, INSTSECT now carries /U, /P, /Q, and /L options to patch respectively the unit, part info, query geometry, and LBA detection bits of the lDOS boot sector loaders. This allows to modify the first stage without any need for the assembler nor much of an understanding of the build process.
 +
 +
 +===== New sleep wait handling =====
 +
 +It was observed on the 686 machine that the debugger would wait too long, for example on the serial KEEP prompt. It turned out that with FDAPM installed with ''APMDOS'', the wait handling would need up to 3 ticks per iteration where it expected to need only 1 tick.
 +
 +The most important part of these patches is the ''SDELTALIMIT'' variable and its handling. This makes it so  rather than only detecting "a difference", the timer tick low word is actually subtracted to gain the tick delta. The delta limit specifies how large a delta is assumed to be accurate. A delta limit of 1 behaves as before. A delta limit of 2 to 6 is reasonable in order to improve the experience on the 686 box. A default of 5 was chosen after testing that it works on that machine.
 +
 +The value should not be too high to keep the skew at midnight low enough. At 24:00:00 the timer tick is stepped from 18_00AFh or 18_00B0h to 0. The delta limit handling ignores this transition, so it will detect the low word's delta as being very high at midnight. Higher precision timers should probably specifically handle midnight. For example, the Insight debugger's button press animation displays a button as pressed for only a fraction of a second. A nearly 1/3 second skew would be undesirable for this.
 +
 +{{tag>ldebug amis ldosboot instsect}}
 +
 +
 +~~DISCUSSION~~
  
blog/pushbx/2023/0108_ldebug_work_in_december_and_early_january.txt ยท Last modified: 2023-01-08 16:36:12 +0100 Jan Sun by ecm