Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

"Your butt is mine." -- Michael Jackson, Bad


devel / comp.lang.asm.x86 / OW compiler bug?

SubjectAuthor
* OW compiler bug?Paul Edwards
+- OW compiler bug?Paul Edwards
`* OW compiler bug?Paul Edwards
 `- OW compiler bug?Paul Edwards

1
OW compiler bug?

<384e9d30-5f71-442a-ae64-628e538ff60dn@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=841&group=comp.lang.asm.x86#841

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!rocksolid2!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@nospicedham.gmail.com (Paul Edwards)
Newsgroups: comp.lang.asm.x86
Subject: OW compiler bug?
Date: Mon, 21 Nov 2022 20:29:18 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 187
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <384e9d30-5f71-442a-ae64-628e538ff60dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Tue, 22 Nov 2022 04:29:19 +0000
Injection-Info: reader01.eternal-september.org; posting-host="bfc77ce1877e7429d034847c5c5d3a89";
logging-data="44511"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+0vEvBvrLi8yXMBP2mAGBZafMYg/apdcE="
User-Agent: G2/1.0
Cancel-Lock: sha1:Of0QedzYMpmbgR8f0fQiEIMWOmA=
 by: Paul Edwards - Tue, 22 Nov 2022 04:29 UTC

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_

Re: OW compiler bug?

<a492931e-81c3-4f9a-b063-ca90f0a85ec3n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=842&group=comp.lang.asm.x86#842

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@nospicedham.gmail.com (Paul Edwards)
Newsgroups: comp.lang.asm.x86
Subject: Re: OW compiler bug?
Date: Mon, 21 Nov 2022 20:57:27 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 10
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <a492931e-81c3-4f9a-b063-ca90f0a85ec3n@googlegroups.com>
References: <384e9d30-5f71-442a-ae64-628e538ff60dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Tue, 22 Nov 2022 04:57:28 +0000
Injection-Info: reader01.eternal-september.org; posting-host="bfc77ce1877e7429d034847c5c5d3a89";
logging-data="47802"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18qgT3fBRWUZhS5mTXcSQ9NUaNQrPKVr2U="
User-Agent: G2/1.0
Cancel-Lock: sha1:YA4hYtpa3jeNDtyKlUhSKfbZkJM=
 by: Paul Edwards - Tue, 22 Nov 2022 04:57 UTC

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.

Re: OW compiler bug?

<f6435928-20e2-43a4-9341-60bc6e01c5c2n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=843&group=comp.lang.asm.x86#843

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@nospicedham.gmail.com (Paul Edwards)
Newsgroups: comp.lang.asm.x86
Subject: Re: OW compiler bug?
Date: Mon, 21 Nov 2022 21:09:12 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 39
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <f6435928-20e2-43a4-9341-60bc6e01c5c2n@googlegroups.com>
References: <384e9d30-5f71-442a-ae64-628e538ff60dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Tue, 22 Nov 2022 05:09:12 +0000
Injection-Info: reader01.eternal-september.org; posting-host="bfc77ce1877e7429d034847c5c5d3a89";
logging-data="48286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ncG5MTtT7jDKaaoxGlJ51NqGe6kQPypg="
User-Agent: G2/1.0
Cancel-Lock: sha1:JOO83jtdy9to/iKY1rCq9tSxFuo=
 by: Paul Edwards - Tue, 22 Nov 2022 05:09 UTC

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..........

Re: OW compiler bug?

<648e6e1e-e518-4e0f-8d01-0a3bcc0046f2n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=844&group=comp.lang.asm.x86#844

  copy link   Newsgroups: comp.lang.asm.x86
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: mutazilah@nospicedham.gmail.com (Paul Edwards)
Newsgroups: comp.lang.asm.x86
Subject: Re: OW compiler bug?
Date: Tue, 22 Nov 2022 04:32:23 -0800 (PST)
Organization: A noiseless patient Spider
Lines: 11
Approved: fbkotler@myfairpoint.net - comp.lang.asm.x86 moderation team.
Message-ID: <648e6e1e-e518-4e0f-8d01-0a3bcc0046f2n@googlegroups.com>
References: <384e9d30-5f71-442a-ae64-628e538ff60dn@googlegroups.com> <f6435928-20e2-43a4-9341-60bc6e01c5c2n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Date: Tue, 22 Nov 2022 12:32:24 +0000
Injection-Info: reader01.eternal-september.org; posting-host="bfc77ce1877e7429d034847c5c5d3a89";
logging-data="113109"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TXecayoKZL27xH33MeZ8SNKkZvRWZ/s4="
User-Agent: G2/1.0
Cancel-Lock: sha1:+0pJRCZ3elXXIq/LYxqIHmWfeQo=
 by: Paul Edwards - Tue, 22 Nov 2022 12:32 UTC

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.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor