User Tools

Site Tools


blog:pushbx:2025:0224_mid_late_february_work

Mid late February work

2025-02-23

webecm

Add section on lDOS kernel.

lDebug

Allow to start a kernel command line with a semicolon after the second file specification. Doesn't always work: boot protocol ldos . .; append … and boot protocol ldos . //; append … are fine. boot protocol ldos . test\; append … doesn't work as intended.

List the errfix Extension for lDebug hooks, the no-inherit file open change, as well as the kernel command line change in the news-r10 section of the manual.

lDOS

fixmem

lmacros

Support the sub keyword as the second parameter to lenter, to make the code use a sub sp instruction rather than lea sp. This has no advantage, and clobbers the flags where lea does not, but it is added to support identicalising of applications.

ident86

Detect an xchg instruction with the same register twice as operands as a longer nop. (In 64-bit mode an xchg with a 32-bit register is not a nop, but we don't support that at all.) This helps to identicalise to TASM, which uses xchg bx, bx for longer alignment.

testfptr

Small test of NASM and ia16-elf-gcc interoperability with returning far pointers. Done as an exercise to prepare for SRDISK port.

FreeCOM

ecm-loadhigh PR to mostly fix LH on lDOS:

  • Do not leak memory on errors.
  • Accept empty MCB (eg lDOS's SD MCB) in the MCB walker.
  • Support lDOS S MCBs of type 30h, excluded UMA
  • Do not record a trailing UMB region if the last excluded UMCB is empty and a Z MCB.
  • Check for array overflows.

Set CY before calling 21.71 or 21.73 extended DOS functions, to ensure we can detect an error correctly on the expected error return (CF unchanged, AL = 00h).

In cswapc.c the code used an optimisation to pass the Extended Memory Move block as parameters to a varargs function in the correct order to pass along to the XMS function. Undo this because it didn't work as intended in ia16-elf-gcc.

FreeDOS kernel

Fix the MS-DOS v5 compatible HMA allocation functions to actually be compatible.

  • Reject allocation call that cannot be fully satisfied.
  • Align result to paragraph boundary.
  • Allow allocating including the last byte of the HMA.
  • Pass last allocated byte to AllocateHMASpace to avoid an overflow when allocating up to the end of the HMA.
  • Advance the firstAvailableBuf pointer to align it on a paragraph boundary.

dosemu2

Running an 21.7303 call on dosemu2 running lDOS running SRDISK caused dosemu2 to return an incorrect error code (CF unchanged, AX = unchanged 7303h) rather than what was expected (CF unchanged, AL = 00h).

Compiling an older build of dosemu2 I noticed that make generated a warning message reading "clock skew detected". It was caused by a date time stamp that didn't include a year. It seems to cause make to rebuild files that didn't need updating.

SRDISK

The ReSizeable RAMDisk, a project I found on the FreeDOS servers. License is GNU GPL any version. (The file headers do not specify a version of the GPL, which according to the GNU GPL v2 content means any version can be chosen.)

It appears that v2.09 is the only free software release of SRDISK. In the 1990s there were prior releases but the sources to those are likely lost.

The first task was to port the assembly language drivers to NASM. To facilitate this I expanded the macros used to split the code into separate files, so srdisk.inc now has all the code using conditional assembling. This helps both with porting to NASM and later when reading the NASM (trace) listing file.

I used fixmem.pl to do most of the porting work. After that the edits included macros, equates, defines, and converting the TASM stack frame directives to use the lframe macro collection instead. The final identicalising of srdxms.sys involved removing a CS: override on a variable and adding push cs to call a far function from a near caller. (The override was wrongly inserted by fixmem.pl after stripping an explicit DS: override.)

The stack segment added to srdisk.mac silences the warning generated by WarpLink. WarpLink's /C option (Create a .COM file) doesn't work because the driver files are assembled at origin zero.

The new keyword "sub" to lenter is used to identicalise srdxms.sys further.

STACKSIZE is added as an equate set to zero for the "small" device driver builds. The MEMORY_STR is changed from an equate to a define in all driver files. One case of a dotted label not caught by fixmem.pl as well as an istruc use within the definition of another structure using db 0 to fill needed to be fixed. Further, a port equate needed copying into another conditional assembly branch. After that all variants of the main driver did assemble and were identicalised.

The xmssize.asm source text's stack segment wasn't recognised by TLINK because of the CODE class name rather than STACK. I fixed this in the original file to match the identicalised port to it.

The remainder of the work was on the Makefile as well as major changes to port the srdisk.exe C sources to build with NASM and ia16-elf-gcc. I did come across some bugs during this work. A list of the bugs and other incompatibilities:

  • The buffer xfer function had its Carry Flag corrupted by an add sp to discard parameters from the stack.
  • The query for a reply didn't flush stdout before waiting for a keypress.
  • The handle size function (rarely used) swapped the XMS v2 and XMS v3 branches.
  • In one case it was expected that the EMS interface returns an error code in BL. Presumably it was mixed up with XMS conventions which do use BL. Also, BX was written to an output variable even in an error case.
  • The min function included in max.h was the wrong way around. It swapped both the condition and the returns as compared to max, making it effectively an alias of max.
  • Error A7h for XMS wasn't recognised.
  • Some function declarations and definitions disagreed on whether functions should be static or not.
  • In makenewf.c some fields were regarded as words that are actually only bytes. This caused spurious reconfiguration when nothing should have changed.
  • In one place min was used both as a variable name and as a function name.
  • _fstrncmp is not defined for ia16 gcc / libi86
  • The far string format %Fs isn't supported by ia16 gcc / libi86
  • The _seg pointer type seems to not be supported eiher. This includes combining a _seg pointer and a near pointer simply by adding two variables (used heavily in env.c).
  • Far function pointers seem to not be supported well.
  • In one spot a variable was declared only with the type keyword const, where it should be const int.
  • O_BINARY and FA_DIREC, FA_LABEL are not defined.
  • farmalloc and farcoreleft are not defined. The former can be aliased to _fmalloc. The latter turned out to be unnecessary.
You could leave a comment if you were logged in.
blog/pushbx/2025/0224_mid_late_february_work.txt · Last modified: 2025-02-24 17:22:27 +0100 Feb Mon by ecm