www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/09/15:06:33

From: "Fredrik Hellman" <mrhellman AT telia DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <3A5A150E DOT E6EE5A6 AT telia DOT com> <200101081952 DOT OAA05184 AT envy DOT delorie DOT com> <Isp66.4145$AH6 DOT 725820 AT newsc DOT telia DOT net> <200101082101 DOT QAA05779 AT envy DOT delorie DOT com>
Subject: SV: SV: Strange function addresses
Lines: 73
Organization: Freli
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2314.1300
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Message-ID: <05H66.4381$AH6.751273@newsc.telia.net>
Date: Tue, 09 Jan 2001 16:35:08 GMT
NNTP-Posting-Host: 62.20.144.121
X-Complaints-To: abuse AT telia DOT com
X-Trace: newsc.telia.net 979058108 62.20.144.121 (Tue, 09 Jan 2001 17:35:08 CET)
NNTP-Posting-Date: Tue, 09 Jan 2001 17:35:08 CET
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

DJ Delorie <dj AT delorie DOT com> skrev i
diskussionsgruppsmeddelandet:200101082101 DOT QAA05779 AT envy DOT delorie DOT com...
>
> > I'll test that. But the strange thing is that the code doesn't work on a
> > 386DX.....
>
> DJGPP was originally written on a 386DX.  What, exactly, happens when
> you try to run it?

Here is the code:

  init_con(&main_con);        /* Init the main-console */
  cls();                                /* Clear the screen */
  asm("nop\nnop\nnop\n");  /* Debugging information */
  asm("nop\nnop\nnop\n");
  asm("nop\nnop\nnop\n");
  asm("nop\nnop\nnop\n");
  asm("nop\nnop\nnop\n");
  printsa("test before entering printk", 3, 3, 1);
  printk("||<Z<z<Z");            /* Printk the line to the active console */

While I was debugging the code, I put a line I know works in printk instead
of the ordinary ones:

printsa("hehehe", 2, 3, 4);

This call will write "hehehe" on pos. 2 x 3 in attribute 4. The line above
printk, is a call to printsa. I can see that line on the screen. The printk
doesn't write any "hehehe" on the screen at all.

I checked the line printsa above the printk line in the debugger. I found
this:

15F6:055D E876FF        CALL    04D6                 <= Call to printsa
15F6:0560 FFFF          ???     DI                            <= Continue of
the instruction above
15F6:0562 83C410        ADD     SP,+10
15F6:0565 83C4F4        ADD     SP,-0C
15F6:0568 68            DB      68
15F6:0569 1C05          SBB     AL,05
15F6:056B 0000          ADD     [BX+SI],AL
15F6:056D E8B609        CALL    0F26                 <= Call to printk
-u 4d6
15F6:04D6 0000          ADD     [BX+SI],AL        <= the call jumps here
15F6:04D8 55            PUSH    BP                        <= printsa's
beginning
15F6:04D9 89E5          MOV     BP,SP

Here is a sample cut from an objdump output:

 106: 6a 03                 push   $0x3
 108: 68 c5 00 00 00        push   $0xc5
 10d: e8 76 ff ff ff        call   88 <_printsa>            <= The printsa
call. The printsa function is in the same .o file while....
 112: 83 c4 10              add    $0x10,%esp
 115: 83 c4 f4              add    $0xfffffff4,%esp
 118: 68 cc 00 00 00        push   $0xcc
 11d: e8 de fe ff ff        call   0 <.text>                   <= ....printk
isn't
 122: 83 c4 10              add    $0x10,%esp

00000088 <_printsa>:
  88: 55                    push   %ebp
  89: 89 e5                 mov    %esp,%ebp
  8b: 83 ec 18              sub    $0x18,%esp
  8e: 8b 45 0c              mov    0xc(%ebp),%eax
  91: 8b 55 10              mov    0x10(%ebp),%edx

I don't really understand why the program is linked in this strange way...

Fredrik Hellman


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019