User Tools

Site Tools


blog:pushbx:2023:0807_early_august_work

Early August work

2023-08-06

Some developments happened this week.

FreeDOS kernel changes for WIN31SUPPORT build option

In response to a stackexchange question on running MSWindows 3.11 in 386 Enhanced mode, I wanted to prepare a build of the latest kernel revision with its WIN31SUPPORT build option enabled.

However, I found that the sources with this option enabled used seg and wrt terms that NASM's elf output format does not support.

I added some conditional code to work around this. In kernel.asm this adds more variables and makes those and another global. In the interrupt 2Fh handler, the three new variables are filled with the segmented address parts they need.

I did check the result, but I do not know entirely that it is correct.

In one of the places, I found that a segmented far pointer is stored with the segment first. I do not know whether this is correct, but I left it as is.

FreeDOS mailing list reply on booting FreeDOS off an 8088 machine

I prepared a long reply to the freedos-devel mailing list on how to boot off a CF card on an 8088 machine, but preparing the card on another machine. I basically presented three options:

  • Using SYS /FORCE:CHS to install the 8086-compatible, CHS FAT32 loader
  • Installing my lDOS boot loaders using the FreeDOS load protocol with the instsect application, which are all 8086-compatible.
  • Installing bootable lDebug, the boot loaders for which are also all 8086-compatible. Once the debugger is loaded it can be used to load and run the FreeDOS kernel.

Bonus

A while ago I wrote about how to install FreeDOS to a logical partition and/or a partition that is not DOS's drive C:.

lDebug work

A bug in the S command accessing a byte behind its sss_silent_count_used variable was fixed.

The S command's SILENT keyword clause was documented.

The S command's data dump's displacement display was documented.

The /A= switch was documented.

A new flag was introduced which controls whether serial I/O is used. Prior to that, the DCO option was directly used to control this. Besides being a shoddy design, this led to a bug when running a command like install serial,timer,amis. When this bug happened, the INSTALL command's output would try to use the buffers for serial output that were not initialised yet. This would make the debugger corrupt parts of its process as the pointers happened to be zero.

The /A= switch is now also supported when loading as a device driver. Largely this shares the code used for adjusting the history segment and the code segments for the application mode /A= switch. However, it also needs to rewrite a convenience signature at the end of the debugger's allocation and adjust the device driver size in one debugger variable as well as in the device request header passed by the DOS.

The RH command keyword COUNT allows to display the RH step number for every displayed step, in hexadecimal and decimal.

There are more places which accept commas as separators.

There is a new command, CLEAR, to attempt to clear the screen. This is done by emitting two escape sequences. If the output is to a ROM-BIOS int 10h interface and the application is not running in a -dumb mode dosemu2 then one of the escape sequences is translated into int 10h calls to blank the screen and reset the cursor position.

Finally, the D strings commands were changed to buffer their outputs into line_out instead of calling getc for every single byte. This improves the performance, but also allows the debugger's escape sequences for inverting the display attributes and for clearing the screen to be used by the D strings commands' output. (These escape sequences must be passed in full to a single puts call in order to be recognised.)

Discussion

C. MaslochC. Masloch, 2023-08-07 21:09:32 +0200 Aug Mon

Regarding the /A= switch, both for the application mode and for device mode the re-allocation of the auxiliary buffer to a larger than minimum size involves relocating and re-initialising a bunch of things, namely the history segment, sometimes the code1 and code2 sections, as well as several variables used for indicating the size of the final debugger allocation. The history segment only needs its contents moved up and the reference to it updated. If the code1 and code2 sections live behind the auxiliary buffer (layout 2) then they also need to be moved and then the references updated. However, if dual code is in effect and _PM=0 then all the segment relocations for far calls need to be updated as well. Furthermore, if fault areas are used with the debugger as a client then their linear addresses also need to be updated.

This is not ideal, but it was the simplest way to add resizing of the auxiliary buffer after parsing the command line. Let's just hope we didn't miss any references to update.

C. MaslochC. Masloch, 2023-08-07 21:14:21 +0200 Aug Mon

In a dosemu2 issue created based on a discussion I opened, dosemu2 had the possibility added to pass General Protection Faults and Stack Faults to the Virtual 86 Mode interrupt handlers, in the style implemented by Real 86 Mode by default.

lDebug needs to be built with the build options -D_CATCHINT0C -D_CATCHINT0D to intercept these faults. Both of these handlers default to check for a corresponding IRQ, chaining to the next handler if the In-Service Register of the PIC indicates that an IRQ is being serviced.

I'm considering to add these two handlers to default lDebug builds, either as is or with the run time option to disable them (much like the AMIS, timer, and serial interrupt handlers).

C. MaslochC. Masloch, 2023-08-07 21:15:45 +0200 Aug Mon

Hmm, what happens if an IRQ handler causes a fault? Our handlers will still detect the IRQ as being in service, leading to (re-)enter the handler stored in the debugger's downlink. A failure case to consider.

You could leave a comment if you were logged in.
blog/pushbx/2023/0807_early_august_work.txt · Last modified: 2023-08-07 21:04:08 +0200 Aug Mon by ecm