Message-Id: <5.0.2.1.0.20001229204927.00a7c6e0@pop5.banet.net> X-Sender: usbanet DOT farley3 AT pop5 DOT banet DOT net X-Mailer: QUALCOMM Windows Eudora Version 5.0.2 Date: Fri, 29 Dec 2000 20:51:46 -0500 To: djgpp-workers AT delorie DOT com From: "Peter J. Farley III" Subject: Re: fcntl locking changes #3: ljmp/lcall patches for gcc 2.952 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_10842542==_" Reply-To: djgpp-workers AT delorie DOT com --=====================_10842542==_ Content-Type: text/plain; charset="us-ascii"; format=flowed One more time -- right subject, wrong patch the last time. This is the replacement patch for the ljmp/lcall patches, using #define-style macros instead of inline tests. Sorry for the confusion. --=====================_10842542==_ Content-Type: text/plain; charset="us-ascii" diff -ruN djgpp-cvs/src/debug/common/dbgcom.c djgpp/src/debug/common/dbgcom.c --- djgpp-cvs/src/debug/common/dbgcom.c Mon Oct 11 07:34:18 1999 +++ djgpp/src/debug/common/dbgcom.c Fri Dec 29 19:57:58 2000 @@ -1,9 +1,20 @@ +/* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ /* exception handling support by Pierre Muller */ + +#if (GAS_MAJOR == 2) \ + && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5))) +#define LJMP(there) "ljmp " #there +#define LCALL(there) "lcall " #there +#else +#define LJMP(there) "ljmp *" #there +#define LCALL(there) "lcall *" #there +#endif + #include #include #include @@ -459,7 +470,7 @@ pushl %eax \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ popl %eax \n\ jc Lc31_set_flags_and_iret \n\ pushl %eax \n\ @@ -488,7 +499,7 @@ pop %es \n\ popl %eax \n\ .byte 0x2e \n\ - ljmp _old_i31 \n\ + " LJMP(_old_i31) " \n\ ret \n" ); @@ -563,7 +574,7 @@ movw $0x0003,%ax \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ movw %ax,%bx \n\ popl %eax \n\ pushl %eax \n\ @@ -692,7 +703,7 @@ je Lc31_resize_mem \n\ L_jmp_to_old_i31: \n\ .byte 0x2e \n\ - ljmp _old_i31 \n\ + " LJMP(_old_i31) " \n\ Lc31_set_flags_and_iret: \n\ pushl %eax \n\ pushf \n\ @@ -733,7 +744,7 @@ jne L_jmp_to_old_i31 \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ call ___djgpp_save_interrupt_regs \n\ call __clear_break_DPMI \n\ call __set_break_DPMI \n\ @@ -754,7 +765,7 @@ Lc31_alloc_mem: \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ jc Lc31_set_flags_and_iret \n\ pushf \n\ pushl %edx \n\ @@ -772,7 +783,7 @@ pushw %di \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ jc Lc31_resize_mem_error \n\ popl %eax \n\ push %edx \n\ @@ -786,7 +797,7 @@ pushw %di \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ jnc Lc31_resize_mem_ok \n\ Lc31_resize_mem_error: \n\ addl $4,%esp \n\ @@ -804,7 +815,7 @@ pushl %ecx \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ popl %ecx \n\ jc Lc31_set_flags_and_iret \n\ call _add_descriptors \n\ @@ -814,7 +825,7 @@ pushl %ebx \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ popl %eax \n\ jc Lc31_set_flags_and_iret \n\ push %edx \n\ @@ -826,7 +837,7 @@ Lc31_create_alias_descriptor: \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ jc Lc31_set_flags_and_iret \n\ pushl %eax \n\ push %edx \n\ @@ -840,7 +851,7 @@ Lc31_allocate_dos_memory: \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ jc Lc31_set_flags_and_iret \n\ pushl %eax \n\ xorl %eax,%eax \n\ @@ -852,7 +863,7 @@ pushl %edx \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ popl %eax \n\ jc Lc31_set_flags_and_iret \n\ xorw %dx,%dx \n\ @@ -866,7 +877,7 @@ pushl %edx \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ popl %edx \n\ popl %ecx \n\ popl %ebx \n\ @@ -875,7 +886,7 @@ call _change_exception_handler \n\ pushf \n\ .byte 0x2e \n\ - lcall _old_i31 \n\ + " LCALL(_old_i31) " \n\ jmp Lc31_set_flags_and_iret \n\ .balign 16,,7 \n\ .globl _dbgcom_hook_i21 \n\ @@ -885,7 +896,7 @@ je Lc21 \n\ Lc21_jmp_to_old: \n\ .byte 0x2e \n\ - ljmp _old_i21 \n\ + " LJMP(_old_i21) " \n\ Lc21: push %eax \n\ movl 8(%esp),%eax \n\ cs \n\ @@ -1003,7 +1014,7 @@ asm (".text .global ___dbgcom_kbd_hdlr ___dbgcom_kbd_hdlr: - ljmp %cs:___djgpp_old_kbd"); + " LJMP(%cs:___djgpp_old_kbd) ""); diff -ruN djgpp-cvs/src/libc/crt0/crt0.S djgpp/src/libc/crt0/crt0.S --- djgpp-cvs/src/libc/crt0/crt0.S Tue May 30 14:09:12 2000 +++ djgpp/src/libc/crt0/crt0.S Fri Dec 29 19:41:42 2000 @@ -16,6 +16,19 @@ #include "stubinfo.h" +#if (GAS_MAJOR == 2) \ + && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5))) +#define LJMP(there) \ + ljmp there +#define LCALL(there) \ + lcall there +#else +#define LJMP(there) \ + ljmp *there +#define LCALL(there) \ + lcall *there +#endif + .comm __stklen, 4 .comm __stubinfo, 4 .comm ___djgpp_base_address, 4 @@ -366,7 +379,7 @@ movw %cs, %bx /* Call exit procedure with BX=32-bit CS; SI+DI=32-bit handle; DL=exit status */ .byte 0x2e - ljmp sbrk16_api_ofs + LJMP(sbrk16_api_ofs) /*-----------------------------------------------------------------------------*/ @@ -455,7 +468,8 @@ int $0x31 pushl %eax - lcall sbrk16_api_ofs + LCALL(sbrk16_api_ofs) + setc %dl /* Save carry */ popl %eax /* restore interrupts */ diff -ruN djgpp-cvs/src/libc/go32/exceptn.S djgpp/src/libc/go32/exceptn.S --- djgpp-cvs/src/libc/go32/exceptn.S Tue May 30 14:14:08 2000 +++ djgpp/src/libc/go32/exceptn.S Fri Dec 29 18:39:26 2000 @@ -2,6 +2,19 @@ * This file maybe freely distributed and modified as long as copyright remains. */ +#if (GAS_MAJOR == 2) \ + && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5))) +#define LJMP(there) \ + ljmp there +#define LCALL(there) \ + lcall there +#else +#define LJMP(there) \ + ljmp *there +#define LCALL(there) \ + lcall *there +#endif + #define EAX 0 #define EBX 4 #define ECX 8 @@ -348,7 +361,7 @@ popl %ds popl %ebx popl %eax - ljmp %cs:___djgpp_old_kbd + LJMP(%cs:___djgpp_old_kbd) .balign 16,,7 .global ___djgpp_kbd_hdlr_pc98 @@ -400,7 +413,7 @@ .byte 0x2e /* CS: */ testb $4, ___djgpp_hwint_flags /* IRET or chain? */ jne 2f - ljmp %cs:___djgpp_old_timer + LJMP(%cs:___djgpp_old_timer) 2: pushl %eax movb $0x20,%al /* EOI the interrupt */ diff -ruN djgpp-cvs/src/makefile.inc djgpp/src/makefile.inc --- djgpp-cvs/src/makefile.inc Mon Sep 7 14:12:10 1998 +++ djgpp/src/makefile.inc Mon Dec 11 21:56:58 2000 @@ -1,3 +1,4 @@ +# Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details # Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details # -*- makefile -*- @@ -7,12 +8,58 @@ .SUFFIXES: .o .i .c .cc .s +# Set $(GCC{L}_OPT) here so they are defined before first use +# +ifeq ($(CROSS_BUILD),1) +GCC_OPT := $(shell cat $(TOP)/../gcc.opt) +GCCL_OPT := $(shell cat $(TOP)/../gcc-l.opt) +endif + +# Set $(AS) before first use +# +AS := $(shell $(CROSS_GCC) $(GCC_OPT) -print-prog-name=as) +AS := $(subst \,/,$(AS)) + +# These were suggested by Tim Van Holder +# but since $(CROSS_LD) is set in makefile.def and $(LD) is not used +# anywhere, they seem not very useful at this time. +# +#LD := $(shell $(CROSS_GCC) $(GCC_OPT) -print-prog-name=ld) +#LD := $(subst \,/,$(LD)) + +# Figure out GAS version for use in *.S and inline asm compile flags +# +GAS_VERSION := $(subst ., ,$(shell $(AS) --version)) +GAS_MAJOR := $(word 3,$(GAS_VERSION)) +GAS_MINOR := $(word 4,$(GAS_VERSION)) +GAS_MINORMINOR := $(word 5,$(GAS_VERSION)) + +# Defaults for GAS version numbers +ifeq ($(GAS_MAJOR),) +GAS_MAJOR := 0 +endif +ifeq ($(GAS_MINOR),) +GAS_MINOR := 0 +endif +ifeq ($(GAS_MINORMINOR),) +GAS_MINORMINOR := 0 +endif + +# Pass defines as compiler/assembler switches +CFLAGS += -DGAS_MAJOR=$(GAS_MAJOR) +CFLAGS += -DGAS_MINOR=$(GAS_MINOR) +CFLAGS += -DGAS_MINORMINOR=$(GAS_MINORMINOR) + +ASFLAGS += -DGAS_MAJOR=$(GAS_MAJOR) +ASFLAGS += -DGAS_MINOR=$(GAS_MINOR) +ASFLAGS += -DGAS_MINORMINOR=$(GAS_MINORMINOR) + +# Moved setting of $(GCC{L}_OPT) to top of file +# ifneq ($(CROSS_BUILD),1) XGCC = $(CROSS_GCC) @$(TOP)/../gcc.opt -I. -I- -I$(TOP)/../../include $(CFLAGS) XLGCC = $(CROSS_GCC) -s @$(TOP)/../gcc-l.opt -I. -I- -I$(TOP)/../../include $(CFLAGS) else -GCC_OPT := $(shell cat $(TOP)/../gcc.opt) -GCCL_OPT := $(shell cat $(TOP)/../gcc-l.opt) XGCC = $(CROSS_GCC) $(GCC_OPT) -I. -I- -I$(TOP)/../../include $(CFLAGS) XLGCC = $(CROSS_GCC) $(GCCL_OPT) -I. -I- -I$(TOP)/../../include $(CFLAGS) endif @@ -59,13 +106,13 @@ L = $(LIB)/libc.a ifeq ($(LIBGCCA),) -LIBGCCA := $(shell $(CROSS_GCC) -print-file-name=libgcc.a) +LIBGCCA := $(shell $(CROSS_GCC) $(GCC_OPT) -print-file-name=libgcc.a) LIBGCCA := $(subst \,/,$(LIBGCCA)) export LIBGCCA endif ifeq ($(DJGPP_DJL),) -DJGPP_DJL := $(shell $(CROSS_GCC) -print-file-name=djgpp.djl) +DJGPP_DJL := $(shell $(CROSS_GCC) $(GCC_OPT) -print-file-name=djgpp.djl) DJGPP_DJL := $(subst \,/,$(DJGPP_DJL)) export DJGPP_DJL endif --=====================_10842542==_ Content-Type: text/plain; charset="us-ascii"; format=flowed --------------------------------------------------------- Peter J. Farley III (pjfarley AT dorsai DOT org OR pjfarley AT banet DOT net) --=====================_10842542==_--