delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/05/20/07:04:42

Date: Mon, 20 May 2002 12:48:39 +0100
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: The Bat! (v1.60h) UNREG / CD5BF9353B3B7091
X-Priority: 3 (Normal)
Message-ID: <74330986783.20020520124839@softhome.net>
To: sandmann AT clio DOT rice DOT edu (Charles Sandmann)
CC: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii), djgpp-workers AT delorie DOT com
Subject: Re: emacs under w2k
In-Reply-To: <10205192036.AA17719@clio.rice.edu>
References: <10205192036 DOT AA17719 AT clio DOT rice DOT edu>
MIME-Version: 1.0
X-OriginalArrivalTime: 20 May 2002 10:47:50.0041 (UTC) FILETIME=[C9295090:01C1FFEB]
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

OK, now I've got something more: the patch below moves ds alias base
setting into sbrk16.asm, and the results have changed:

1) Emacs _without_ unixy sbrk (which previously was failing at
startup) now works like a charm - not a single glitch yet.
2) Emacs _with_ unixy sbrk (which previously was failing randomly),
and any program which sets that bit now fail consistently at startup,
sometimes with SIGSEGV, sometimes taking down NTVDM.

The results without unixy sbrk are encouraging, and before I start
looking what happens with it, I'd like others to comment on my patch -
any stupidities or something?

(If the patch is OK, then the good thing about it is that now everyone
can take mine or Charles's test program and debug away... Emacs no
longer required :) Also it would be interesting to see how it behaves
under other platforms.

Laurynas

diff -up crt0.old/crt0.S crt0/crt0.S
--- crt0.old/crt0.S     2001-11-25 22:53:56.000000000 +0000
+++ crt0/crt0.S 2002-05-20 12:44:44.000000000 +0000
@@ -471,6 +471,8 @@ brk_common:
        movl    %eax, %ecx                                      /* size not limit */
        movl    %eax, %ebx                                      /* size not limit */
        shrl    $16, %ebx                                       /* BX:CX size */
+       movw    ___djgpp_ds_alias, %dx                          /* DX DS alias selector */
+
 
        movw    $0x0900, %ax                                    /* disable interrupts */
        int     $0x31
@@ -595,12 +597,6 @@ brk_common:
        movl    ___djgpp_ds_alias, %ebx
        int     $0x31
 3:
-       movw    $0x0007, %ax                                    /* reset DS alias base */
-       movl    ___djgpp_ds_alias, %ebx
-       movl    ___djgpp_base_address, %edx
-       movw    ___djgpp_base_address+2, %cx
-       int     $0x31
-
        movl    ___djgpp_selector_limit, %edx
 12:    incl    %edx                                            /* Size not limit */
        testb   $0x60, __crt0_startup_flags     /* include/crt0.h */
diff -up crt0.old/sbrk16.asm crt0/sbrk16.asm
--- crt0.old/sbrk16.asm 1994-12-13 03:24:32.000000000 +0000
+++ crt0/sbrk16.asm     2002-05-20 11:37:20.000000000 +0000
@@ -1,12 +1,6 @@
+; Copyright (C) 2002 DJ Delorie, see COPYING.DJ for details
 ; Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details
 ;
-; $Id: sbrk16.asm,v 1.1 1994/12/13 08:24:32 dj Exp $
-; $Log: sbrk16.asm,v $
-; Revision 1.1  1994/12/13 08:24:32  dj
-; import djgpp 2.00
-;
-; Revision 2.0  1994/03/14  00:47:04  dj
-; initial version
 ;
 ;
 
@@ -25,6 +19,7 @@
 ;
 ;  Call with:  BX:CX = new size
 ;              SI:DI = old handle
+;                  DX = DS alias selector  
 ;  Returns:    BX:CX = new base
 ;              SI:DI = new handle
 ;              all others trashed
@@ -72,15 +67,22 @@ sbrk_16_helper:
        int     0x31
        jc      error_return            ; bx:cx = base address
 
+       mov     bp, dx                  ; save ds alias selector
+       
        mov     dx, cx
        mov     cx, bx                  ; cx:dx = base address
        mov     bx, [cs_selector]
        mov     ax, 0x0007
        int     0x31                    ; set cs to new base
+       
        mov     bx, [ds_selector]
        mov     ax, 0x0007
        int     0x31                    ; set ds to new base
 
+       mov     bx, bp
+       mov     ax, 0x0007
+       int     0x31                    ; set ds alias base
+
        push    es                      ; reload es
        pop     es
        push    fs                      ; reload fs


- Raw text -


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