LH share.com crashes older dosemu2
Closed this issue · 3 comments
I just rebuilt gcc ia16 (with some test failures) and compiled SHARE with that. Using (FreeCOM) LH makes share.com crash the machine. This is true even if SHARE is already installed, so the crash appears to occur early, before actually installing the resident program.
This is on dosemu2 Build 2.0pre8-20190827-1234-g0984731c9
and using the following FreeCOM and FreeDOS kernel:
FreeCom version 0.85a - WATCOMC - XMS_Swap [Jul 10 2021 19:28:06]
DOS version 7.10
FreeDOS kernel - SVN (build 2042 OEM:0xfd) [compiled Jan 24 2020]
Using the same SHARE, kernel, and shell on Build 2.0pre8-20210410-2880-g65853ec95
results in no crash, LH for SHARE works as expected.
(I would report this to dosemu2 but the newer revision appears to work as expected.)
@andrewbird do you have any idea what this may be about? I uploaded my build of share.com with #6
The error appears to be in the first relocation early on. Working in newer dosemu2:
Welcome to dosemu2!
Build 2.0pre8-20210410-2880-g65853ec95
E:\>lh ldebug share.com
-r
AX=0000 BX=0000 CX=0F5A DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=C309 ES=C309 SS=C309 CS=C309 IP=0100 NV UP EI PL ZR NA PE NC
C309:0100 E9150A jmp 0B18
-t
AX=0000 BX=0000 CX=0F5A DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000
DS=C309 ES=C309 SS=C309 CS=C309 IP=0B18 NV UP EI PL ZR NA PE NC
C309:0B18 BE5810 mov si, 1058
-
AX=0000 BX=0000 CX=0F5A DX=0000 SP=FFFE BP=0000 SI=1058 DI=0000
DS=C309 ES=C309 SS=C309 CS=C309 IP=0B1B NV UP EI PL ZR NA PE NC
C309:0B1B BFDEFE mov di, FEDE
-
AX=0000 BX=0000 CX=0F5A DX=0000 SP=FFFE BP=0000 SI=1058 DI=FEDE
DS=C309 ES=C309 SS=C309 CS=C309 IP=0B1E NV UP EI PL ZR NA PE NC
C309:0B1E B99602 mov cx, 0296
-
AX=0000 BX=0000 CX=0296 DX=0000 SP=FFFE BP=0000 SI=1058 DI=FEDE
DS=C309 ES=C309 SS=C309 CS=C309 IP=0B21 NV UP EI PL ZR NA PE NC
C309:0B21 FD std
-
AX=0000 BX=0000 CX=0296 DX=0000 SP=FFFE BP=0000 SI=1058 DI=FEDE
DS=C309 ES=C309 SS=C309 CS=C309 IP=0B22 NV DN EI PL ZR NA PE NC
C309:0B22 F3A5 rep movsw
-tp
AX=0000 BX=0000 CX=0000 DX=0000 SP=FFFE BP=0000 SI=0B2C DI=F9B2
DS=C309 ES=C309 SS=C309 CS=C309 IP=0B24 NV DN EI PL ZR NA PE NC
C309:0B24 B430 mov ah, 30
-
Same run in the older dosemu crashes on the TP step (proceed past the repeated string operation):
Welcome to dosemu2!
Build 2.0pre8-20190827-1234-g0984731c9
G:\>lh ldebug share.com
-r
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=0000 DI=0000
DS=F068 ES=F068 SS=F068 CS=F068 IP=0100 NV UP EI PL ZR NA PE NC
F068:0100 E9150A jmp 0B18
-t
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=0000 DI=0000
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B18 NV UP EI PL ZR NA PE NC
F068:0B18 BE5810 mov si, 1058
-
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=1058 DI=0000
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B1B NV UP EI PL ZR NA PE NC
F068:0B1B BFDEFE mov di, FEDE
-
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=1058 DI=FEDE
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B1E NV UP EI PL ZR NA PE NC
F068:0B1E B99602 mov cx, 0296
-
AX=0000 BX=0000 CX=0296 DX=0000 SP=B97E BP=0000 SI=1058 DI=FEDE
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B21 NV UP EI PL ZR NA PE NC
F068:0B21 FD std
-
AX=0000 BX=0000 CX=0296 DX=0000 SP=B97E BP=0000 SI=1058 DI=FEDE
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B22 NV DN EI PL ZR NA PE NC
F068:0B22 F3A5 rep movsw
-tpERROR: unexpected CPU exception 0x06 err=0x00000000 cr2=bf1d273c while in vm86 (
DOS)
Real-mode state dump:
EIP: ffff:000015b5 ESP: 0361:0000b93c VFLAGS(b): 00011 00110000 10010010
EAX: 0000ffd0 EBX: 0000a250 ECX: 0000d606 EDX: 000036c9 VFLAGS(h): 00033092
ESI: 00000361 EDI: 00000361 EBP: 00004000 DS: 0361 ES: 0361 FS: 0000 GS: 0000
FLAGS: AF SF IF RF VM IOPL: 3
STACK: ca 36 00 40 61 03 61 03 b5 15 -> 50 a2 f7 0e 46 32 61 03 a4 a4
OPS : 0e 9e e9 1f fe e9 1c fe e9 19 -> fe b8 0c 81 5f 5e c9 cb c7 13
fe ffff:15b5 db FE
Terminated with signal 4
Does anyone spot anything here?
The address is different. Let me check whether the memory block is large enough.
Got it! The different UMB layout makes it so SHARE is loaded into a block smaller than 64 KiB. Here's the error:
Welcome to dosemu2!
Build 2.0pre8-20190827-1234-g0984731c9
G:\>lh ldebug share.com
-dm
PSP: F068
02B4 4D 0008 0019 400 B SD
02CE 4D 02CF 0091 2 KiB COMMAND
0360 4D 0361 1B34 108 KiB LDEBUG
1E95 4D 0000 8169 517 KiB
9FFF 4D 0008 3100 196 KiB SC
D100 4D 0008 1EFF 123 KiB SC
F000 4D 02CF 0040 1024 B COMMAND
F041 4D 0361 0012 288 B LDEBUG
F054 4D F068 0012 288 B SHARE
F067 5A F068 0B98 46 KiB SHARE
-r
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=0000 DI=0000
DS=F068 ES=F068 SS=F068 CS=F068 IP=0100 NV UP EI PL ZR NA PE NC
F068:0100 E9150A jmp 0B18
-t
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=0000 DI=0000
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B18 NV UP EI PL ZR NA PE NC
F068:0B18 BE5810 mov si, 1058
-
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=1058 DI=0000
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B1B NV UP EI PL ZR NA PE NC
F068:0B1B BFDEFE mov di, FEDE
-
AX=0000 BX=0000 CX=0F5A DX=0000 SP=B97E BP=0000 SI=1058 DI=FEDE
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B1E NV UP EI PL ZR NA PE NC
F068:0B1E B99602 mov cx, 0296
-
AX=0000 BX=0000 CX=0296 DX=0000 SP=B97E BP=0000 SI=1058 DI=FEDE
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B21 NV UP EI PL ZR NA PE NC
F068:0B21 FD std
-
AX=0000 BX=0000 CX=0296 DX=0000 SP=B97E BP=0000 SI=1058 DI=FEDE
DS=F068 ES=F068 SS=F068 CS=F068 IP=0B22 NV DN EI PL ZR NA PE NC
F068:0B22 F3A5 rep movsw
-h linear es:di+2
00100560 decimal: 1049952
-h linear f068+b98:0
000FC000 decimal: 1032192
-
The linear address behind the last-written word is in the HMA (at 10_0560h), extending fairly far behind the end of SHARE's MCB (at F_C000h). I will report this for the compiler, it really shouldn't assume it has 64 KiB available for a flat .COM style executable.