• Re: OW compiler bug?

    From Paul Edwards@21:1/5 to All on Mon Nov 21 21:09:12 2022
    The problem was triggered when I was debugging something
    completely unrelated in the OS with a printf. I tried removing
    that printf and DI is now set to something sensible and it is
    working.

    I'll see if I can figure out what's happening.

    There was a file open done, so maybe DI is not being
    preserved over that.

    BFN. Paul.



    instruction at that (new) address starts with cb
    hit enter to continue tracing, or monitor or stop or auto
    monitor
    current module loaded at 4870:0000, entry point 4870:B2B4
    enter a hex address or range, exit to exit, help for help
    zap 4870:c961 0xcc
    exit
    stop
    checking for exists of portinit.exe
    checking for exists of c:\dos\portinit.com
    tempbuf is 55D1:B8F4, ln2 is 15, exe is .exe .exe 55D1:0CF4 55D1:0CF4
    got a breakpoint
    AX 5500 BX 55D1 CX B903 DX B8F4
    SI 0CF8 DI B903 DS 55D1 ES 55D1
    BP BA04 CS 4870 IP C962 FLAGS 0246
    SS 55D1 SP B8EC
    module loaded at 4870:0000, entry point 4870:B2B4
    interrupt address is 4870:C962
    adjusting to 4870:C961
    current module loaded at 4870:0000, entry point 4870:B2B4
    enter a hex address or range, exit to exit, help for help
    55d1:b8f4-55d1:b910
    55D1:B8F4 633A5C64 6F735C70 6F727469 6E69742E c:\dos\portinit.
    6161:0004 65786500 CCAA0000 DA8A8B1D D4 exe..........

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Edwards@21:1/5 to All on Mon Nov 21 20:29:18 2022
    Does this code look wrong?

    (Generated by Open Watcom 1.6)

    es:di are not pointing to something sensible.

    Here is the source code:

    ln2 = t - s;
    memcpy(tempbuf, s ,ln2);

    if (ln2 != 0)
    {
    tempbuf[ln2++] = '\\';
    }

    strcpy(tempbuf + ln2, b);
    ln2 += strlen(b);
    strcpy(tempbuf + ln2, ".com");

    printf("checking for exists of %s\n", tempbuf);
    if (exists(tempbuf))
    {
    #ifdef __32BIT__
    strcpy(cmdt, tempbuf);
    strcat(cmdt, " ");
    strcat(cmdt, p);
    #endif
    PosExec(tempbuf, &parmblock);
    break;
    }

    printf("tempbuf is %p, ln2 is %d, exe is %s %s %p %p\n", tempbuf, ln2, ".exe", ".exe", ".exe", ".exe");
    strcpy(tempbuf + ln2 ,".exe");
    __brkpoint();

    printf("checking for exists of %s\n", tempbuf);


    I was alerted to the problem when tempbuf didn't change.

    Here is the PDOS/86 monitor:

    zap 4870:c961 0xcc
    exit
    stop
    checking for exists of portinit.com
    got a match for 192 bytes, allocated is 0
    got a match for 192 bytes, allocated is 0
    checking for exists of c:\dos\portinit.com
    got a match for 192 bytes, allocated is 0
    tempbuf is 55D1:B8F4, ln2 is 15, exe is .exe .exe 55D1:0CF4 55D1:0CF4
    got a breakpoint
    AX 5500 BX 55D1 CX B903 DX B8F4
    SI 0CF8 DI 0008 DS 55D1 ES 55D1
    BP BA04 CS 4870 IP C962 FLAGS 0246
    SS 55D1 SP B8EC
    module loaded at 4870:0000, entry point 4870:B2B4
    interrupt address is 4870:C962
    adjusting to 4870:C961
    current module loaded at 4870:0000, entry point 4870:B2B4
    enter a hex address or range, exit to exit, help for help
    55d1:b8f4-55d1:b913
    55D1:B8F4 633A5C64 6F735C70 6F727469 6E69742E c:\dos\portinit.
    6161:0004 636F6D00 FCAA0000 DA8A8C1D D7380CAB com..........8.. 55d1:0cf4-55d1:0cff
    55D1:0CF4 2E657865 0074656D 70627566 .exe.tempbuf


    And here is the generated code:

    166B L$199:
    166B 5F pop di
    166C 1F pop ds
    166D 8B BE EE FE mov di,word ptr -0x112[bp]
    1671 8E 86 EC FE mov es,word ptr -0x114[bp]
    1675 B9 FF FF mov cx,0xffff
    1678 33 C0 xor ax,ax
    167A F2 AE repne scasb
    167C F7 D1 not cx
    167E 49 dec cx
    167F 8C DE mov si,ds
    1681 01 4E FE add word ptr -0x2[bp],cx
    1684 8D 8E F0 FE lea cx,-0x110[bp]
    1688 B8 C6 0C mov ax,offset DGROUP:L$806
    168B 03 4E FE add cx,word ptr -0x2[bp]
    168E 16 push ss
    168F 07 pop es
    1690 89 CF mov di,cx
    1692 1E push ds
    1693 57 push di
    1694 96 xchg ax,si
    1695 8E D8 mov ds,ax
    1697 L$200:
    1697 8A 04 mov al,byte ptr [si]
    1699 26 88 05 mov byte ptr es:[di],al
    169C 3C 00 cmp al,0x00
    169E 74 11 je L$201
    16A0 8A 44 01 mov al,byte ptr 0x1[si]
    16A3 83 C6 02 add si,0x0002
    16A6 26 88 45 01 mov byte ptr es:0x1[di],al
    16AA 83 C7 02 add di,0x0002
    16AD 3C 00 cmp al,0x00
    16AF 75 E6 jne L$200
    16B1 L$201:
    16B1 5F pop di
    16B2 1F pop ds
    16B3 16 push ss
    16B4 8D 96 F0 FE lea dx,-0x110[bp]
    16B8 52 push dx
    16B9 1E push ds
    16BA B8 CB 0C mov ax,offset DGROUP:L$807
    16BD 50 push ax
    16BE 8C D2 mov dx,ss
    16C0 9A 00 00 00 00 call printf_
    16C5 8D 86 F0 FE lea ax,-0x110[bp]
    16C9 83 C4 08 add sp,0x0008
    16CC 8C D3 mov bx,ss
    16CE E8 00 00 call exists_
    16D1 85 C0 test ax,ax
    16D3 74 3A je L$204
    16D5 BB 00 00 mov bx,offset _parmblock
    16D8 8D 86 F0 FE lea ax,-0x110[bp]
    16DC 8C D9 mov cx,ds
    16DE 8C D2 mov dx,ss
    16E0 9A 00 00 00 00 call PosExec_
    16E5 L$202:
    16E5 C4 5E FA les bx,dword ptr -0x6[bp]
    16E8 26 80 3F 00 cmp byte ptr es:[bx],0x00
    16EC 75 1E jne L$203
    16EE FF B6 EC FE push word ptr -0x114[bp]
    16F2 FF B6 EE FE push word ptr -0x112[bp]
    16F6 1E push ds
    16F7 B8 29 0D mov ax,offset DGROUP:L$812
    16FA 50 push ax
    16FB 9A 00 00 00 00 call printf_
    1700 B8 01 00 mov ax,0x0001
    1703 83 C4 08 add sp,0x0008
    1706 89 EC mov sp,bp
    1708 5D pop bp
    1709 5F pop di
    170A 5E pop si
    170B C3 ret
    170C L$203:
    170C E9 F6 00 jmp L$213
    170F L$204:
    170F 1E push ds
    1710 B8 E6 0C mov ax,offset DGROUP:L$808
    1713 50 push ax
    1714 1E push ds
    1715 50 push ax
    1716 1E push ds
    1717 50 push ax
    1718 1E push ds
    1719 50 push ax
    171A FF 76 FE push word ptr -0x2[bp]
    171D 16 push ss
    171E 8D 96 F0 FE lea dx,-0x110[bp]
    1722 52 push dx
    1723 1E push ds
    1724 B8 EB 0C mov ax,offset DGROUP:L$809
    1727 50 push ax
    1728 8C DE mov si,ds
    172A 9A 00 00 00 00 call printf_
    172F B8 E6 0C mov ax,offset DGROUP:L$808
    1732 83 C4 1A add sp,0x001a
    1735 8E C3 mov es,bx
    1737 1E push ds
    1738 57 push di
    1739 96 xchg ax,si
    173A 8E D8 mov ds,ax
    173C L$205:
    173C 8A 04 mov al,byte ptr [si]
    173E 26 88 05 mov byte ptr es:[di],al
    1741 3C 00 cmp al,0x00
    1743 74 11 je L$206
    1745 8A 44 01 mov al,byte ptr 0x1[si]
    1748 83 C6 02 add si,0x0002
    174B 26 88 45 01 mov byte ptr es:0x1[di],al
    174F 83 C7 02 add di,0x0002
    1752 3C 00 cmp al,0x00
    1754 75 E6 jne L$205
    1756 L$206:
    1756 5F pop di
    1757 1F pop ds
    1758 9A 00 00 00 00 call __brkpoint_

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Edwards@21:1/5 to All on Mon Nov 21 20:57:27 2022
    One more thing - I don't trust any component.

    It could be a bug in PDPCLIB or PDOS/86 instead.
    Failing to preserve a register.

    I'm running under Bochs, which I hope is more
    reliable.

    BFN. Paul.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Paul Edwards@21:1/5 to All on Tue Nov 22 04:32:23 2022
    It took the whole day, but I finally figured it out.

    It was a build error and I was using a routine I shouldn't
    have been using in the OS, and the location where the
    OS (PDOS/86) was storing registers during an interrupt
    was being trashed by another interrupt.

    Sorry for the noise.

    Thanks. Paul.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)