Mail Archives: djgpp-workers/2002/05/20/07:04:42
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 -