delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/06/30/08:02:40

Message-ID: <19990630140207.12975@atrey.karlin.mff.cuni.cz>
Date: Wed, 30 Jun 1999 14:02:07 +0200
From: Jan Hubicka <hubicka AT atrey DOT karlin DOT mff DOT cuni DOT cz>
To: djgpp-workers AT delorie DOT com
Subject: Regparm patch.
Mime-Version: 1.0
X-Mailer: Mutt 0.84
Reply-To: djgpp-workers AT delorie DOT com

Hi
Here is the patch for current CVS to make djgpp mregparm ready. I've got
rid of all those __asmlinkages present in previous patch except those for
dpmi wrappers. Because I don't see any clean way how to make current asm stubs
to work with regparm and c/asm statement replacements looks horribly ugly here,
I would like to wait. Until rest of thinks stabilizes and do this job later.

I've changed lots of asm functions into C code in cases where I expected they
will look well. Gcc seems to do good job when generating this functions, because
libc.a size increases just for 50 bytes. When I was looking for the purpose, it
was often causes by choosing faster and longer opcode. -Os reverses this 
comarison.
Also some of these asm statements are short enought that they might be put
into inlines macros..

Some asm function I've changed to handle both conventions using __REGPARM macro
that is defined by spec file or linkage.h or old setup. For the sbrk function
I've made c wrapper, that is used for higher regparms.
(it is called from crt0 asm code, that I would like to keep untouched).

Note that I've not tested all the invidiual rewrites, so there can be trivial
mistakes in them, but I've went trought tests/libc programs and didn't noticed
anything unusual in mregparm setup. (behaviour of all program was unchanged when
compared to original one.)

So what I need to do to get this into oficial source tree?

Let me know about all problems...
Honza

diff -urN orig/src/libc/ansi/setjmp/longjmp.s djgpp/src/libc/ansi/setjmp/longjmp.s
--- orig/src/libc/ansi/setjmp/longjmp.s	Tue Jun 29 06:13:32 1999
+++ djgpp/src/libc/ansi/setjmp/longjmp.s	Wed Jun 30 12:29:32 1999
@@ -18,11 +18,19 @@
 **	 eax ebx ecx edx esi edi ebp esp eip fl cs ds es fs gs ss
 **	 0   4   8   12  16  20  24  28  32  36 40 42 44 46 48 50
 */
-
+#include <linkage.h>
 	.globl	_longjmp /* jmp_buf, int */
 _longjmp:
+#if __REGPARM==0
 	movl	4(%esp),%edi	/* get jmp_buf */
 	movl	8(%esp),%eax	/* store retval in j->eax */
+#elif __REGPARM==1
+	movl	%eax,%edi	/* get jmp_buf */
+	movl	4(%esp),%eax	/* store retval in j->eax */
+#else
+	movl	%eax,%edi	/* get jmp_buf */
+	movl	%edx,%eax	/* store retval in j->eax */
+#endif
 	movl	%eax,0(%edi)
 
 	movw	46(%edi),%fs
diff -urN orig/src/libc/ansi/setjmp/setjmp.s djgpp/src/libc/ansi/setjmp/setjmp.s
--- orig/src/libc/ansi/setjmp/setjmp.s	Tue Jun 29 06:13:32 1999
+++ djgpp/src/libc/ansi/setjmp/setjmp.s	Wed Jun 30 12:30:12 1999
@@ -18,14 +18,18 @@
 **	 eax ebx ecx edx esi edi ebp esp eip fl cs ds es fs gs ss
 **	 0   4   8   12  16  20  24  28  32  36 40 42 44 46 48 50
 */
-
+#include <linkage.h>
 	.globl	_setjmp /* jmp_buf */
 _setjmp:
 	pushl	%ebp
 	movl	%esp,%ebp
 
 	pushl	%edi
+#if __REGPARM==0
 	movl	8(%ebp),%edi
+#else
+	movl	%eax,%edi
+#endif
 
 	movl	%eax, (%edi)
 	movl	%ebx,4(%edi)
diff -urN orig/src/libc/ansi/string/makefile djgpp/src/libc/ansi/string/makefile
--- orig/src/libc/ansi/string/makefile	Tue Jun 29 06:13:40 1999
+++ djgpp/src/libc/ansi/string/makefile	Wed Jun 30 03:11:16 1999
@@ -3,9 +3,9 @@
 
 SRC += memchr.c
 SRC += memcmp.c
-SRC += memcpy.S
-SRC += memmove.S
-SRC += memset.S
+SRC += memcpy.c
+SRC += memmove.c
+SRC += memset.c
 SRC += strcat.c
 SRC += strchr.c
 SRC += strcmp.c
diff -urN orig/src/libc/ansi/string/memcpy.c djgpp/src/libc/ansi/string/memcpy.c
--- orig/src/libc/ansi/string/memcpy.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/ansi/string/memcpy.c	Wed Jun 30 03:11:18 1999
@@ -0,0 +1,11 @@
+#include <string.h>
+void 
+*memcpy(void *d, const void *s, size_t n)
+{  
+  int tmp;
+  __asm__ __volatile__ ("call ___dj_movedata"
+ 			: "=D" (tmp), "=S" (s), "=c" (n)
+			: "D" (d),"S" (s),"c" (n)
+			: "memory");
+  return d;
+}
diff -urN orig/src/libc/ansi/string/memcpy.s djgpp/src/libc/ansi/string/memcpy.s
--- orig/src/libc/ansi/string/memcpy.s	Tue Jun 29 06:13:40 1999
+++ djgpp/src/libc/ansi/string/memcpy.s	Thu Jan  1 00:00:00 1970
@@ -1,20 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-	.file "memcpy.s"
-	.text
-	.align	4
-	.globl	_memcpy
-_memcpy:
-	pushl	%ebp
-	movl	%esp,%ebp
-	pushl	%esi
-	pushl	%edi
-	movl	8(%ebp),%edi
-	movl	12(%ebp),%esi
-	movl	16(%ebp),%ecx
-	call	___dj_movedata
-	popl	%edi
-	popl	%esi
-	movl	8(%ebp),%eax
-	leave
-	ret
-
diff -urN orig/src/libc/ansi/string/memmove.c djgpp/src/libc/ansi/string/memmove.c
--- orig/src/libc/ansi/string/memmove.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/ansi/string/memmove.c	Wed Jun 30 03:11:18 1999
@@ -0,0 +1,20 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+void *
+memmove (void *d, const void *s, size_t n)
+{
+  int tmp;
+  __asm__ __volatile__ ("jecxz	2f	\n\t"
+			"cmpl	%%esi,%%edi\n\t"
+			"jb	3f	\n\t"
+			"call	___dj_movedata_rev\n\t"
+			"jmp	2f	\n\t"
+			"3:		\n\t"
+			"call	___dj_movedata\n\t"
+			"2:		\n\t"
+			"cld		\n\t"
+   : "=D" (tmp),"=S" (s),"=c" (n)
+   : "D" (d),"S" (s),"c" (n)
+   : "memory");
+   return d;
+}
diff -urN orig/src/libc/ansi/string/memmove.s djgpp/src/libc/ansi/string/memmove.s
--- orig/src/libc/ansi/string/memmove.s	Tue Jun 29 06:13:40 1999
+++ djgpp/src/libc/ansi/string/memmove.s	Thu Jan  1 00:00:00 1970
@@ -1,29 +0,0 @@
-/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-	.file "memmove.s"
-	.globl	_memmove
-_memmove:
-	pushl	%ebp
-	movl	%esp,%ebp
-	pushl	%esi
-	pushl	%edi
-	movl	8(%ebp),%edi
-	movl	12(%ebp),%esi
-	movl	16(%ebp),%ecx
-	jecxz	L2
-
-	cmpl	%esi,%edi
-	jb	L3
-
-	call    ___dj_movedata_rev
-	jmp     L2
-L3:
-	call    ___dj_movedata
-
-L2:
-	cld
-	popl	%edi
-	popl	%esi
-	movl	8(%ebp),%eax
-	leave
-	ret
diff -urN orig/src/libc/ansi/string/memset.c djgpp/src/libc/ansi/string/memset.c
--- orig/src/libc/ansi/string/memset.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/ansi/string/memset.c	Wed Jun 30 03:11:18 1999
@@ -0,0 +1,47 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <string.h>
+
+void *memset(void *s, int c, size_t n)
+{
+	int tmp;
+        asm volatile ("
+	cld
+
+	# We will handle memsets of <= 15 bytes one byte at a time.
+	# This avoids some extra overhead for small memsets, and
+	# knowing we are setting > 15 bytes eliminates some annoying
+	# checks in the \"long move\" case.
+	cmpl	$15,%%ecx
+	jle	3f
+
+	# Otherwise, tile the byte value out into eax.
+	# 0x41 -> 0x41414141, etc.
+	movb	%%al,%%ah
+	movl	%%eax,%%edx
+	sall	$16,%%eax
+	movw	%%dx,%%ax
+	jmp	2f
+
+	# Handle any cruft necessary to get edi long-aligned.
+1:	stosb
+	decl	%%ecx
+2:	testl	$3,%%edi
+	jnz	1b
+
+	# Now slam out all of the longs.
+	movl	%%ecx,%%edx
+	shrl	$2,%%ecx
+	rep
+	stosl
+
+	# Finally, handle any trailing cruft.  We know the high three bytes
+	# of ecx must be zero, so just put the \"slop count\" in the low byte.
+	movb	%%dl,%%cl
+	andb	$3,%%cl
+3:	rep
+	stosb
+        ":"=a"(c),"=c"(n),"=D"(tmp)
+         :"a"(c),"c"(n),"D"(s)
+         :"memory");
+	return s;
+}
diff -urN orig/src/libc/ansi/string/memset.s djgpp/src/libc/ansi/string/memset.s
--- orig/src/libc/ansi/string/memset.s	Tue Jun 29 06:13:40 1999
+++ djgpp/src/libc/ansi/string/memset.s	Thu Jan  1 00:00:00 1970
@@ -1,51 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-	.file "memset.s"
-	.text
-	.align	4
-	.globl	_memset
-_memset:
-	pushl	%ebp
-	movl	%esp,%ebp
-	pushl	%edi
-	movl	8(%ebp),%edi
-	movl	12(%ebp),%eax
-	movl	16(%ebp),%ecx
-	cld
-
-	# We will handle memsets of <= 15 bytes one byte at a time.
-	# This avoids some extra overhead for small memsets, and
-	# knowing we are setting > 15 bytes eliminates some annoying
-	# checks in the "long move" case.
-	cmpl	$15,%ecx
-	jle	L3
-
-	# Otherwise, tile the byte value out into %eax.
-	# 0x41 -> 0x41414141, etc.
-	movb	%al,%ah
-	movl	%eax,%edx
-	sall	$16,%eax
-	movw	%dx,%ax
-	jmp	L2
-
-	# Handle any cruft necessary to get %edi long-aligned.
-L1:	stosb
-	decl	%ecx
-L2:	testl	$3,%edi
-	jnz	L1
-
-	# Now slam out all of the longs.
-	movl	%ecx,%edx
-	shrl	$2,%ecx
-	rep
-	stosl
-
-	# Finally, handle any trailing cruft.  We know the high three bytes
-	# of %ecx must be zero, so just put the "slop count" in the low byte.
-	movb	%dl,%cl
-	andb	$3,%cl
-L3:	rep
-	stosb
-	popl	%edi
-	movl	8(%ebp),%eax
-	leave
-	ret
diff -urN orig/src/libc/compat/string/ffs.s djgpp/src/libc/compat/string/ffs.s
--- orig/src/libc/compat/string/ffs.s	Tue Jun 29 06:13:54 1999
+++ djgpp/src/libc/compat/string/ffs.s	Wed Jun 30 12:23:30 1999
@@ -1,8 +1,13 @@
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <linkage.h>
 	.global	_ffs
 _ffs:
+#if __REGPARM > 0
+	bsfl	%eax, %eax
+#else
 	bsfl	4(%esp), %eax
+#endif
 	jnz	.Lzero
 	movl	$-1,%eax
 .Lzero:
diff -urN orig/src/libc/crt0/brk.c djgpp/src/libc/crt0/brk.c
--- orig/src/libc/crt0/brk.c	Tue Jun 29 06:14:02 1999
+++ djgpp/src/libc/crt0/brk.c	Wed Jun 30 03:11:22 1999
@@ -1,7 +1,8 @@
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 #include <unistd.h>
+#include <linkage.h>
 
-extern int __brk(void *);
+__asmlinkage extern int __brk(void *);
 
 int
 brk(void *_heaptop)
diff -urN orig/src/libc/crt0/makefile djgpp/src/libc/crt0/makefile
--- orig/src/libc/crt0/makefile	Tue Jun 29 06:14:04 1999
+++ djgpp/src/libc/crt0/makefile	Wed Jun 30 03:11:22 1999
@@ -4,6 +4,7 @@
 
 SRC += _main.c
 SRC += brk.c
+SRC += sbrk.c
 SRC += c1args.c
 SRC += c1loadef.c
 SRC += c1pglob.c
diff -urN orig/src/libc/crt0/rfinfo.c djgpp/src/libc/crt0/rfinfo.c
--- orig/src/libc/crt0/rfinfo.c	Tue Jun 29 06:14:04 1999
+++ djgpp/src/libc/crt0/rfinfo.c	Wed Jun 30 03:11:22 1999
@@ -1,5 +1,6 @@
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
-void __register_frame_info(void *begin __attribute__((unused)),
+#include "linkage.h"
+__asmlinkage void __register_frame_info(void *begin __attribute__((unused)),
                            void *object __attribute__((unused)) );
 void __register_frame_info(void *begin __attribute__((unused)),
                            void *object __attribute__((unused)) )
diff -urN orig/src/libc/crt0/sbrk.c djgpp/src/libc/crt0/sbrk.c
--- orig/src/libc/crt0/sbrk.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/crt0/sbrk.c	Wed Jun 30 03:11:22 1999
@@ -0,0 +1,15 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <unistd.h>
+#include <linkage.h>
+
+__asmlinkage extern void * __sbrk(int);
+
+#if __REGPARM > 0 
+void *
+sbrk(int delta)
+{
+  return __sbrk (delta);
+}
+#else
+asm("_sbrk: jmp ___sbrk");
+#endif
diff -urN orig/src/libc/dos/dos/int86.c djgpp/src/libc/dos/dos/int86.c
--- orig/src/libc/dos/dos/int86.c	Tue Jun 29 06:14:10 1999
+++ djgpp/src/libc/dos/dos/int86.c	Wed Jun 30 03:11:24 1999
@@ -5,8 +5,9 @@
 #include <dos.h>
 #include <go32.h>
 #include <dpmi.h>
+#include <linkage.h>
 
-int _int86(int ivec, union REGS *in, union REGS *out);
+__asmlinkage int _int86(int ivec, union REGS *in, union REGS *out);
 
 #define tbsize _go32_info_block.size_of_transfer_buffer
 
diff -urN orig/src/libc/dos/dos/int86x.s djgpp/src/libc/dos/dos/int86x.s
--- orig/src/libc/dos/dos/int86x.s	Tue Jun 29 06:14:10 1999
+++ djgpp/src/libc/dos/dos/int86x.s	Wed Jun 30 03:11:24 1999
@@ -1,4 +1,5 @@
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <linkage.h>
 	.data
 s_es:	.word	0
 s_ds:	.word	0
@@ -8,7 +9,9 @@
 	.text
 	.globl	_int86x
 _int86x:
+#if __MREGPARM==0
 	movl	16(%esp), %eax
+#endif
 
 	movl	(%eax), %ecx		/* Do both es & ds at same time */
 	movl	%ecx, s_es
diff -urN orig/src/libc/pc_hw/endian/htonl.c djgpp/src/libc/pc_hw/endian/htonl.c
--- orig/src/libc/pc_hw/endian/htonl.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/endian/htonl.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,13 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <machine/endian.h>
+
+unsigned 
+long htonl (unsigned long p)
+{
+  __asm__ ("xchgb	%h0, %b0\n\t"
+	   "rorl 	$16, %0\n\t"
+	   "xchgb	%h0, %b0\n\t"
+           : "=r" (p)
+           : "r" (p));
+  return p;
+}
diff -urN orig/src/libc/pc_hw/endian/htonl.s djgpp/src/libc/pc_hw/endian/htonl.s
--- orig/src/libc/pc_hw/endian/htonl.s	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/endian/htonl.s	Thu Jan  1 00:00:00 1970
@@ -1,10 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_htonl)
-
-	movl	4(%esp), %eax
-	xchgb	%ah, %al
-	rorl	$16, %eax
-	xchgb	%ah, %al
-	ret
diff -urN orig/src/libc/pc_hw/endian/htons.c djgpp/src/libc/pc_hw/endian/htons.c
--- orig/src/libc/pc_hw/endian/htons.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/endian/htons.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,9 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <machine/endian.h>
+
+unsigned 
+short htons (unsigned short p)
+{
+  __asm__ ("xchgb	%h0, %b0" : "=r" (p): "r" (p));
+  return p;
+}
diff -urN orig/src/libc/pc_hw/endian/htons.s djgpp/src/libc/pc_hw/endian/htons.s
--- orig/src/libc/pc_hw/endian/htons.s	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/endian/htons.s	Thu Jan  1 00:00:00 1970
@@ -1,8 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_htons)
-
-	movl	4(%esp), %eax
-	xchgb	%ah, %al
-	ret
diff -urN orig/src/libc/pc_hw/endian/makefile djgpp/src/libc/pc_hw/endian/makefile
--- orig/src/libc/pc_hw/endian/makefile	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/endian/makefile	Wed Jun 30 03:11:30 1999
@@ -1,9 +1,9 @@
 # Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details
 TOP=../..
 
-SRC += htonl.S
-SRC += htons.S
-SRC += ntohl.S
-SRC += ntohs.S
+SRC += htonl.c
+SRC += htons.c
+SRC += ntohl.c
+SRC += ntohs.c
 
 include $(TOP)/../makefile.inc
diff -urN orig/src/libc/pc_hw/endian/ntohl.c djgpp/src/libc/pc_hw/endian/ntohl.c
--- orig/src/libc/pc_hw/endian/ntohl.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/endian/ntohl.c	Wed Jun 30 03:11:30 1999
@@ -0,0 +1,13 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <machine/endian.h>
+
+unsigned 
+long ntohl (unsigned long p)
+{
+  __asm__ ("xchgb	%h0, %b0\n\t"
+	   "rorl 	$16, %0\n\t"
+	   "xchgb	%h0, %b0\n\t"
+           : "=r" (p)
+           : "r" (p));
+  return p;
+}
diff -urN orig/src/libc/pc_hw/endian/ntohl.s djgpp/src/libc/pc_hw/endian/ntohl.s
--- orig/src/libc/pc_hw/endian/ntohl.s	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/endian/ntohl.s	Thu Jan  1 00:00:00 1970
@@ -1,10 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_ntohl)
-
-	movl	4(%esp), %eax
-	xchgb	%ah, %al
-	rorl	$16, %eax
-	xchgb	%ah, %al
-	ret
diff -urN orig/src/libc/pc_hw/endian/ntohs.c djgpp/src/libc/pc_hw/endian/ntohs.c
--- orig/src/libc/pc_hw/endian/ntohs.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/endian/ntohs.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,9 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <machine/endian.h>
+
+unsigned 
+short ntohs (unsigned short p)
+{
+  __asm__ ("xchgb	%h0, %b0" : "=r" (p): "r" (p));
+  return p;
+}
diff -urN orig/src/libc/pc_hw/endian/ntohs.s djgpp/src/libc/pc_hw/endian/ntohs.s
--- orig/src/libc/pc_hw/endian/ntohs.s	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/endian/ntohs.s	Thu Jan  1 00:00:00 1970
@@ -1,8 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_ntohs)
-
-	movl	4(%esp), %eax
-	xchgb	%ah, %al
-	ret
diff -urN orig/src/libc/pc_hw/fpu/cntrl87.c djgpp/src/libc/pc_hw/fpu/cntrl87.c
--- orig/src/libc/pc_hw/fpu/cntrl87.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/fpu/cntrl87.c	Wed Jun 30 12:18:14 1999
@@ -0,0 +1,16 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <float.h>
+
+unsigned int _control87(unsigned int newcw, unsigned int mask)
+{
+  unsigned int cw, oldcw, lvalue;
+  __asm__ __volatile__ ("fstcw %0		\n\t"
+			"fwait			\n\t"
+			: "=m" (lvalue));
+  oldcw = lvalue & 0xffff;
+  cw = (oldcw & ~mask) | (mask & newcw);
+  __asm__ __volatile__ ("fldcw %0		\n\t"
+			"fwait			\n\t"
+			: : "m" (cw));
+  return oldcw;
+}
diff -urN orig/src/libc/pc_hw/fpu/cntrl87.s djgpp/src/libc/pc_hw/fpu/cntrl87.s
--- orig/src/libc/pc_hw/fpu/cntrl87.s	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/fpu/cntrl87.s	Thu Jan  1 00:00:00 1970
@@ -1,27 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-	
-	.text
-
-	FUNC(__control87)
-	ENTER
-
-	pushl	%eax		/* make room on stack */
-	fstcw	(%esp)
-	fwait
-	popl	%eax
-	andl	$0xffff, %eax	/* OK;  we have the old value ready */
-
-	movl	ARG2, %ecx
-	notl	%ecx
-	andl	%eax, %ecx	/* the bits we want to keep */
-
-	movl	ARG2, %edx
-	andl	ARG1, %edx	/* the bits we want to change */
-
-	orl	%ecx, %edx	/* the new value */
-	pushl	%edx
-	fldcw	(%esp)
-	popl	%edx
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/fpu/makefile djgpp/src/libc/pc_hw/fpu/makefile
--- orig/src/libc/pc_hw/fpu/makefile	Tue Jun 29 06:14:24 1999
+++ djgpp/src/libc/pc_hw/fpu/makefile	Wed Jun 30 03:11:32 1999
@@ -2,7 +2,7 @@
 TOP=../..
 
 SRC += clear87.S
-SRC += cntrl87.S
+SRC += cntrl87.c
 SRC += fpreset.S
 SRC += stat87.S
 
diff -urN orig/src/libc/pc_hw/io/ib.c djgpp/src/libc/pc_hw/io/ib.c
--- orig/src/libc/pc_hw/io/ib.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/ib.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,12 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+
+unsigned char
+inportb (unsigned short _port)
+{
+  unsigned char rv;
+  __asm__ __volatile__ ("inb %1, %0"
+	  : "=a" (rv)
+	  : "dN" (_port));
+  return rv;
+}
diff -urN orig/src/libc/pc_hw/io/ib.s djgpp/src/libc/pc_hw/io/ib.s
--- orig/src/libc/pc_hw/io/ib.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/ib.s	Thu Jan  1 00:00:00 1970
@@ -1,11 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_inportb)
-	ENTER
-
-	movl	ARG1,%edx
-	inb	%dx,%al
-	movzbl	%al,%eax
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/il.c djgpp/src/libc/pc_hw/io/il.c
--- orig/src/libc/pc_hw/io/il.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/il.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,12 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+
+unsigned long
+inportl (unsigned short _port)
+{
+  unsigned long rv;
+  __asm__ __volatile__ ("inl %1, %0"
+	  : "=a" (rv)
+	  : "dN" (_port));
+  return rv;
+}
diff -urN orig/src/libc/pc_hw/io/il.s djgpp/src/libc/pc_hw/io/il.s
--- orig/src/libc/pc_hw/io/il.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/il.s	Thu Jan  1 00:00:00 1970
@@ -1,10 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_inportl)
-	ENTER
-
-	movl	ARG1,%edx
-	inl	%dx,%eax
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/isb.c djgpp/src/libc/pc_hw/io/isb.c
--- orig/src/libc/pc_hw/io/isb.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/isb.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,11 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+void
+inportsb (unsigned short port, unsigned char *buf, unsigned len)
+{
+  __asm__ __volatile__ ("cld\n\t"
+			"rep ; insb"
+			: "=d" (port), "=c" (len), "=D" (buf)
+			: "d" (port), "c" (len), "D" (buf)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/io/isb.s djgpp/src/libc/pc_hw/io/isb.s
--- orig/src/libc/pc_hw/io/isb.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/isb.s	Thu Jan  1 00:00:00 1970
@@ -1,15 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(_inportsb)		/* port buffer length */
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%edi
-	movl	ARG3,%ecx
-	cld
-	rep
-	insb
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/isl.c djgpp/src/libc/pc_hw/io/isl.c
--- orig/src/libc/pc_hw/io/isl.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/isl.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,11 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+void
+inportsb (unsigned short port, unsigned char *buf, unsigned len)
+{
+  __asm__ __volatile__ ("cld\n\t"
+			"rep ; insl"
+			: "=d" (port), "=c" (len), "=D" (buf)
+			: "d" (port), "c" (len), "D" (buf)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/io/isl.s djgpp/src/libc/pc_hw/io/isl.s
--- orig/src/libc/pc_hw/io/isl.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/isl.s	Thu Jan  1 00:00:00 1970
@@ -1,15 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(_inportsl)		/* port buffer length */
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%edi
-	movl	ARG3,%ecx
-	cld
-	rep
-	insl
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/isw.c djgpp/src/libc/pc_hw/io/isw.c
--- orig/src/libc/pc_hw/io/isw.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/isw.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,11 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+void
+inportsb (unsigned short port, unsigned char *buf, unsigned len)
+{
+  __asm__ __volatile__ ("cld\n\t"
+			"rep ; insw"
+			: "=d" (port), "=c" (len), "=D" (buf)
+			: "d" (port), "c" (len), "D" (buf)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/io/isw.s djgpp/src/libc/pc_hw/io/isw.s
--- orig/src/libc/pc_hw/io/isw.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/isw.s	Thu Jan  1 00:00:00 1970
@@ -1,15 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(_inportsw)		/* port buffer length */
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%edi
-	movl	ARG3,%ecx
-	cld
-	rep
-	insw
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/iw.c djgpp/src/libc/pc_hw/io/iw.c
--- orig/src/libc/pc_hw/io/iw.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/iw.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,12 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+
+unsigned short
+inportw (unsigned short _port)
+{
+  unsigned short rv;
+  __asm__ __volatile__ ("inw %1, %0"
+	  : "=a" (rv)
+	  : "dN" (_port));
+  return rv;
+}
diff -urN orig/src/libc/pc_hw/io/iw.s djgpp/src/libc/pc_hw/io/iw.s
--- orig/src/libc/pc_hw/io/iw.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/iw.s	Thu Jan  1 00:00:00 1970
@@ -1,11 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_inportw)
-	ENTER
-
-	movl	ARG1,%edx
-	inw	%dx,%ax
-	movzwl	%ax,%eax
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/makefile djgpp/src/libc/pc_hw/io/makefile
--- orig/src/libc/pc_hw/io/makefile	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/makefile	Wed Jun 30 03:11:32 1999
@@ -1,23 +1,23 @@
 # Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details
 TOP=../..
 
-SRC += ib.S
-SRC += il.S
+SRC += ib.c
+SRC += il.c
 SRC += inb.S
 SRC += inp.S
 SRC += inpw.S
-SRC += isb.S
-SRC += isl.S
-SRC += isw.S
-SRC += iw.S
-SRC += ob.S
-SRC += ol.S
-SRC += osb.S
-SRC += osl.S
-SRC += osw.S
+SRC += isb.c
+SRC += isl.c
+SRC += isw.c
+SRC += iw.c
+SRC += ob.c
+SRC += ol.c
+SRC += osb.c
+SRC += osl.c
+SRC += osw.c
 SRC += outb.S
 SRC += outp.S
 SRC += outpw.S
-SRC += ow.S
+SRC += ow.c
 
 include $(TOP)/../makefile.inc
diff -urN orig/src/libc/pc_hw/io/ob.c djgpp/src/libc/pc_hw/io/ob.c
--- orig/src/libc/pc_hw/io/ob.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/ob.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,16 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+
+void
+outportb (unsigned short _port, unsigned char _data)
+{
+  /* This hack is necessary to avoid gcc bug.  */
+  __asm__ __volatile__ (""
+		        : "=g"(_port),"=g"(_data)
+			: "0"(_port), "1"(_data));
+
+  __asm__ __volatile__ ("outb %1, %0"
+	  :
+	  : "dN" (_port),
+	    "a" (_data));
+}
diff -urN orig/src/libc/pc_hw/io/ob.s djgpp/src/libc/pc_hw/io/ob.s
--- orig/src/libc/pc_hw/io/ob.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/ob.s	Thu Jan  1 00:00:00 1970
@@ -1,11 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_outportb)
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%eax
-	outb	%al,%dx
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/ol.c djgpp/src/libc/pc_hw/io/ol.c
--- orig/src/libc/pc_hw/io/ol.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/ol.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,16 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+
+void
+outportl (unsigned short _port, unsigned long _data)
+{
+  /* This hack is necessary to avoid gcc bug.  */
+  __asm__ __volatile__ (""
+		        : "=g"(_port),"=g"(_data)
+			: "0"(_port), "1"(_data));
+
+  __asm__ __volatile__ ("outl %1, %0"
+	  :
+	  : "dN" (_port),
+	    "a" (_data));
+}
diff -urN orig/src/libc/pc_hw/io/ol.s djgpp/src/libc/pc_hw/io/ol.s
--- orig/src/libc/pc_hw/io/ol.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/ol.s	Thu Jan  1 00:00:00 1970
@@ -1,11 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_outportl)
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%eax
-	outl	%eax,%dx
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/osb.c djgpp/src/libc/pc_hw/io/osb.c
--- orig/src/libc/pc_hw/io/osb.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/osb.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,10 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+void
+inportsb (unsigned short port, unsigned char *buf, unsigned len)
+{
+  __asm__ __volatile__ ("cld\n\t"
+			"rep ; outsb"
+			: "=d" (port), "=c" (len), "=S" (buf)
+			: "d" (port), "c" (len), "S" (buf));
+}
diff -urN orig/src/libc/pc_hw/io/osb.s djgpp/src/libc/pc_hw/io/osb.s
--- orig/src/libc/pc_hw/io/osb.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/osb.s	Thu Jan  1 00:00:00 1970
@@ -1,16 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-
-#include <libc/asmdefs.h>
-
-	FUNC(_outportsb)	/* port buffer length */
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%esi
-	movl	ARG3,%ecx
-	cld
-	rep
-	outsb
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/osl.c djgpp/src/libc/pc_hw/io/osl.c
--- orig/src/libc/pc_hw/io/osl.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/osl.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,10 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+void
+inportsb (unsigned short port, unsigned char *buf, unsigned len)
+{
+  __asm__ __volatile__ ("cld\n\t"
+			"rep ; outsl"
+			: "=d" (port), "=c" (len), "=S" (buf)
+			: "d" (port), "c" (len), "S" (buf));
+}
diff -urN orig/src/libc/pc_hw/io/osl.s djgpp/src/libc/pc_hw/io/osl.s
--- orig/src/libc/pc_hw/io/osl.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/osl.s	Thu Jan  1 00:00:00 1970
@@ -1,16 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-
-#include <libc/asmdefs.h>
-
-	FUNC(_outportsl)	/* port buffer length */
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%esi
-	movl	ARG3,%ecx
-	cld
-	rep
-	outsl
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/osw.c djgpp/src/libc/pc_hw/io/osw.c
--- orig/src/libc/pc_hw/io/osw.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/osw.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,10 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+void
+inportsb (unsigned short port, unsigned char *buf, unsigned len)
+{
+  __asm__ __volatile__ ("cld\n\t"
+			"rep ; outsw"
+			: "=d" (port), "=c" (len), "=S" (buf)
+			: "d" (port), "c" (len), "S" (buf));
+}
diff -urN orig/src/libc/pc_hw/io/osw.s djgpp/src/libc/pc_hw/io/osw.s
--- orig/src/libc/pc_hw/io/osw.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/osw.s	Thu Jan  1 00:00:00 1970
@@ -1,16 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-
-#include <libc/asmdefs.h>
-
-	FUNC(_outportsw)	/* port buffer length */
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%esi
-	movl	ARG3,%ecx
-	cld
-	rep
-	outsw
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/io/ow.c djgpp/src/libc/pc_hw/io/ow.c
--- orig/src/libc/pc_hw/io/ow.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/io/ow.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,16 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <pc.h>
+
+void
+outportw (unsigned short _port, unsigned short _data)
+{
+  /* This hack is necessary to avoid gcc bug.  */
+  __asm__ __volatile__ (""
+		        : "=g"(_port),"=g"(_data)
+			: "0"(_port), "1"(_data));
+
+  __asm__ __volatile__ ("outw %1, %0"
+	  :
+	  : "dN" (_port),
+	    "a" (_data));
+}
diff -urN orig/src/libc/pc_hw/io/ow.s djgpp/src/libc/pc_hw/io/ow.s
--- orig/src/libc/pc_hw/io/ow.s	Tue Jun 29 06:14:26 1999
+++ djgpp/src/libc/pc_hw/io/ow.s	Thu Jan  1 00:00:00 1970
@@ -1,11 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <libc/asmdefs.h>
-
-	FUNC(_outportw)
-	ENTER
-
-	movl	ARG1,%edx
-	movl	ARG2,%eax
-	outw	%ax,%dx
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/mem/makefile djgpp/src/libc/pc_hw/mem/makefile
--- orig/src/libc/pc_hw/mem/makefile	Tue Jun 29 06:14:28 1999
+++ djgpp/src/libc/pc_hw/mem/makefile	Wed Jun 30 03:11:32 1999
@@ -13,8 +13,8 @@
 SRC += dmpl.c
 SRC += dmpw.c
 SRC += md.S
-SRC += mdb.S
-SRC += mdl.S
-SRC += mdw.S
+SRC += mdb.c
+SRC += mdl.c
+SRC += mdw.c
 
 include $(TOP)/../makefile.inc
diff -urN orig/src/libc/pc_hw/mem/md.c djgpp/src/libc/pc_hw/mem/md.c
--- orig/src/libc/pc_hw/mem/md.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/mem/md.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,22 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <sys/movedata.h>
+void __movedata(unsigned src_sel, unsigned src_ofs, unsigned dest_sel, 
+		unsigned dest_ofs, size_t len);
+
+void 
+__movedata(unsigned src_sel, unsigned src_ofs, unsigned dest_sel, 
+	   unsigned dest_ofs, size_t len)
+{
+  __asm__ __volatile__ ("pushw %%ds	\n\t"
+			"pushw %%es	\n\t"
+			"movw %w4, %%es  \n\t"
+			"movw %w3, %%ds  \n\t"
+			"call ___dj_movedata\n\t"
+			"popw %%es	\n\t"
+			"popw %%ds	\n\t"
+			: "=S" (src_ofs), "=D" (dest_ofs), "=c" (len)
+			: "r" (src_sel), "r" (dest_sel), "S" (src_ofs),
+			  "D" (dest_ofs), "c" (len)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/mem/md.s djgpp/src/libc/pc_hw/mem/md.s
--- orig/src/libc/pc_hw/mem/md.s	Tue Jun 29 06:14:28 1999
+++ djgpp/src/libc/pc_hw/mem/md.s	Thu Jan  1 00:00:00 1970
@@ -1,25 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(___movedata)	/* src_sel, src_ofs, dest_sel, dest_ofs, len */
-	ENTER
-
-	pushw	%ds
-	pushw	%es
-
-	movw	ARG1,%ds
-	movw	ARG3,%es
-
-	movl	ARG2,%esi
-	movl	ARG4,%edi
-	movl	ARG5,%ecx
-
-	call	___dj_movedata
-
-	popw	%es
-	popw	%ds
-
-	LEAVE
-
diff -urN orig/src/libc/pc_hw/mem/mdb.c djgpp/src/libc/pc_hw/mem/mdb.c
--- orig/src/libc/pc_hw/mem/mdb.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/mem/mdb.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,20 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <sys/movedata.h>
+void 
+_movedatab(unsigned src_sel, unsigned src_ofs, unsigned dest_sel, 
+           unsigned dest_ofs, size_t len)
+{
+  __asm__ __volatile__ ("pushw %%ds     \n\t"
+			"pushw %%es     \n\t"
+			"movw %w4, %%es \n\t"
+			"movw %w3, %%ds \n\t"
+			"cld            \n\t"
+			"rep ; movsb    \n\t"
+			"popw %%es      \n\t"
+			"popw %%ds      \n\t"
+			: "=S" (src_ofs), "=D" (dest_ofs), "=c" (len)
+			: "r" (src_sel), "r" (dest_sel), "S" (src_ofs),
+			  "D" (dest_ofs), "c" (len)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/mem/mdb.old djgpp/src/libc/pc_hw/mem/mdb.old
--- orig/src/libc/pc_hw/mem/mdb.old	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/mem/mdb.old	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,28 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#define USE_ESI
+#define USE_EDI
+#include <libc/asmdefs.h>
+
+	FUNC(__movedatab)	/* src_sel, src_ofs, dest_sel, dest_ofs, len */
+	ENTER
+
+	pushw	%ds
+	pushw	%es
+
+	movl	ARG1,%eax
+	movw	%ax,%ds
+	movl	ARG2,%esi
+
+	movl	ARG3,%eax
+	movw	%ax,%es
+	movl	ARG4,%edi
+
+	movl	ARG5,%ecx
+	cld
+	rep
+	movsb
+
+	popw	%es
+	popw	%ds
+
+	LEAVE
diff -urN orig/src/libc/pc_hw/mem/mdb.s djgpp/src/libc/pc_hw/mem/mdb.s
--- orig/src/libc/pc_hw/mem/mdb.s	Tue Jun 29 06:14:28 1999
+++ djgpp/src/libc/pc_hw/mem/mdb.s	Thu Jan  1 00:00:00 1970
@@ -1,28 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(__movedatab)	/* src_sel, src_ofs, dest_sel, dest_ofs, len */
-	ENTER
-
-	pushw	%ds
-	pushw	%es
-
-	movl	ARG1,%eax
-	movw	%ax,%ds
-	movl	ARG2,%esi
-
-	movl	ARG3,%eax
-	movw	%ax,%es
-	movl	ARG4,%edi
-
-	movl	ARG5,%ecx
-	cld
-	rep
-	movsb
-
-	popw	%es
-	popw	%ds
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/mem/mdl.c djgpp/src/libc/pc_hw/mem/mdl.c
--- orig/src/libc/pc_hw/mem/mdl.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/mem/mdl.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,20 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <sys/movedata.h>
+void 
+_movedatal(unsigned src_sel, unsigned src_ofs, unsigned dest_sel, 
+           unsigned dest_ofs, size_t len)
+{
+  __asm__ __volatile__ ("pushw %%ds     \n\t"
+			"pushw %%es     \n\t"
+			"movw %w4, %%es \n\t"
+			"movw %w3, %%ds \n\t"
+			"cld            \n\t"
+			"rep ; movsl    \n\t"
+			"popw %%es      \n\t"
+			"popw %%ds      \n\t"
+			: "=S" (src_ofs), "=D" (dest_ofs), "=c" (len)
+			: "r" (src_sel), "r" (dest_sel), "S" (src_ofs),
+			  "D" (dest_ofs), "c" (len)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/mem/mdl.s djgpp/src/libc/pc_hw/mem/mdl.s
--- orig/src/libc/pc_hw/mem/mdl.s	Tue Jun 29 06:14:28 1999
+++ djgpp/src/libc/pc_hw/mem/mdl.s	Thu Jan  1 00:00:00 1970
@@ -1,28 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(__movedatal)	/* src_sel, src_ofs, dest_sel, dest_ofs, len */
-	ENTER
-
-	pushw	%ds
-	pushw	%es
-
-	movl	ARG1,%eax
-	movw	%ax,%ds
-	movl	ARG2,%esi
-
-	movl	ARG3,%eax
-	movw	%ax,%es
-	movl	ARG4,%edi
-
-	movl	ARG5,%ecx
-	cld
-	rep
-	movsl
-
-	popw	%es
-	popw	%ds
-
-	LEAVE
diff -urN orig/src/libc/pc_hw/mem/mdw.c djgpp/src/libc/pc_hw/mem/mdw.c
--- orig/src/libc/pc_hw/mem/mdw.c	Thu Jan  1 00:00:00 1970
+++ djgpp/src/libc/pc_hw/mem/mdw.c	Wed Jun 30 03:11:32 1999
@@ -0,0 +1,20 @@
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
+#include <sys/movedata.h>
+void 
+_movedataw(unsigned src_sel, unsigned src_ofs, unsigned dest_sel, 
+           unsigned dest_ofs, size_t len)
+{
+  __asm__ __volatile__ ("pushw %%ds     \n\t"
+			"pushw %%es     \n\t"
+			"movw %w4, %%es \n\t"
+			"movw %w3, %%ds \n\t"
+			"cld            \n\t"
+			"rep ; movsw    \n\t"
+			"popw %%es      \n\t"
+			"popw %%ds      \n\t"
+			: "=S" (src_ofs), "=D" (dest_ofs), "=c" (len)
+			: "r" (src_sel), "r" (dest_sel), "S" (src_ofs),
+			  "D" (dest_ofs), "c" (len)
+			: "memory");
+}
diff -urN orig/src/libc/pc_hw/mem/mdw.s djgpp/src/libc/pc_hw/mem/mdw.s
--- orig/src/libc/pc_hw/mem/mdw.s	Tue Jun 29 06:14:28 1999
+++ djgpp/src/libc/pc_hw/mem/mdw.s	Thu Jan  1 00:00:00 1970
@@ -1,28 +0,0 @@
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define USE_ESI
-#define USE_EDI
-#include <libc/asmdefs.h>
-
-	FUNC(__movedataw)	/* src_sel, src_ofs, dest_sel, dest_ofs, len */
-	ENTER
-
-	pushw	%ds
-	pushw	%es
-
-	movl	ARG1,%eax
-	movw	%ax,%ds
-	movl	ARG2,%esi
-
-	movl	ARG3,%eax
-	movw	%ax,%es
-	movl	ARG4,%edi
-
-	movl	ARG5,%ecx
-	cld
-	rep
-	movsw
-
-	popw	%es
-	popw	%ds
-
-	LEAVE
diff -urN orig/include/dpmi.h djgpp/include/dpmi.h
--- orig/include/dpmi.h	Tue Jun 29 06:13:18 1999
+++ djgpp/include/dpmi.h	Wed Jun 30 03:11:08 1999
@@ -2,6 +2,8 @@
 #ifndef __dj_include_dpmi_h_
 #define __dj_include_dpmi_h_
 
+#include <linkage.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -134,106 +136,106 @@
 
 /* Unless otherwise noted, all functions return -1 on error, setting __dpmi_error to the DPMI error code */
 
-void	__dpmi_yield(void);									/* INT 0x2F AX=1680 */
+__asmlinkage void	__dpmi_yield(void);									/* INT 0x2F AX=1680 */
 
-int	__dpmi_allocate_ldt_descriptors(int _count);						/* DPMI 0.9 AX=0000 */
-int	__dpmi_free_ldt_descriptor(int _descriptor);						/* DPMI 0.9 AX=0001 */
-int	__dpmi_segment_to_descriptor(int _segment);						/* DPMI 0.9 AX=0002 */
-int	__dpmi_get_selector_increment_value(void);						/* DPMI 0.9 AX=0003 */
-int	__dpmi_get_segment_base_address(int _selector, unsigned long *_addr);			/* DPMI 0.9 AX=0006 */
-int	__dpmi_set_segment_base_address(int _selector, unsigned long _address);			/* DPMI 0.9 AX=0007 */
-unsigned long __dpmi_get_segment_limit(int _selector);						/* LSL instruction  */
-int	__dpmi_set_segment_limit(int _selector, unsigned long _limit);				/* DPMI 0.9 AX=0008 */
-int	__dpmi_get_descriptor_access_rights(int _selector);					/* LAR instruction  */
-int	__dpmi_set_descriptor_access_rights(int _selector, int _rights);			/* DPMI 0.9 AX=0009 */
-int	__dpmi_create_alias_descriptor(int _selector);						/* DPMI 0.9 AX=000a */
-int	__dpmi_get_descriptor(int _selector, void *_buffer);					/* DPMI 0.9 AX=000b */
-int	__dpmi_set_descriptor(int _selector, void *_buffer);					/* DPMI 0.9 AX=000c */
-int	__dpmi_allocate_specific_ldt_descriptor(int _selector);					/* DPMI 0.9 AX=000d */
-
-int	__dpmi_get_multiple_descriptors(int _count, void *_buffer);				/* DPMI 1.0 AX=000e */
-int	__dpmi_set_multiple_descriptors(int _count, void *_buffer);				/* DPMI 1.0 AX=000f */
-
-int	__dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);			/* DPMI 0.9 AX=0100 */
-int	__dpmi_free_dos_memory(int _selector);							/* DPMI 0.9 AX=0101 */
-int	__dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);			/* DPMI 0.9 AX=0102 */
-
-int	__dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);		/* DPMI 0.9 AX=0200 */
-int	__dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);		/* DPMI 0.9 AX=0201 */
-int	__dpmi_get_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0202 */
-int	__dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0203 */
-int	__dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0204 */
-int	__dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0205 */
-
-int	__dpmi_get_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0210 */
-int	__dpmi_get_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0211 */
-int	__dpmi_set_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0212 */
-int	__dpmi_set_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0213 */
+__asmlinkage int	__dpmi_allocate_ldt_descriptors(int _count);						/* DPMI 0.9 AX=0000 */
+__asmlinkage int	__dpmi_free_ldt_descriptor(int _descriptor);						/* DPMI 0.9 AX=0001 */
+__asmlinkage int	__dpmi_segment_to_descriptor(int _segment);						/* DPMI 0.9 AX=0002 */
+__asmlinkage int	__dpmi_get_selector_increment_value(void);						/* DPMI 0.9 AX=0003 */
+__asmlinkage int	__dpmi_get_segment_base_address(int _selector, unsigned long *_addr);			/* DPMI 0.9 AX=0006 */
+__asmlinkage int	__dpmi_set_segment_base_address(int _selector, unsigned long _address);			/* DPMI 0.9 AX=0007 */
+__asmlinkage unsigned long __dpmi_get_segment_limit(int _selector);						/* LSL instruction  */
+__asmlinkage int	__dpmi_set_segment_limit(int _selector, unsigned long _limit);				/* DPMI 0.9 AX=0008 */
+__asmlinkage int	__dpmi_get_descriptor_access_rights(int _selector);					/* LAR instruction  */
+__asmlinkage int	__dpmi_set_descriptor_access_rights(int _selector, int _rights);			/* DPMI 0.9 AX=0009 */
+__asmlinkage int	__dpmi_create_alias_descriptor(int _selector);						/* DPMI 0.9 AX=000a */
+__asmlinkage int	__dpmi_get_descriptor(int _selector, void *_buffer);					/* DPMI 0.9 AX=000b */
+__asmlinkage int	__dpmi_set_descriptor(int _selector, void *_buffer);					/* DPMI 0.9 AX=000c */
+__asmlinkage int	__dpmi_allocate_specific_ldt_descriptor(int _selector);					/* DPMI 0.9 AX=000d */
+
+__asmlinkage int	__dpmi_get_multiple_descriptors(int _count, void *_buffer);				/* DPMI 1.0 AX=000e */
+__asmlinkage int	__dpmi_set_multiple_descriptors(int _count, void *_buffer);				/* DPMI 1.0 AX=000f */
+
+__asmlinkage int	__dpmi_allocate_dos_memory(int _paragraphs, int *_ret_selector_or_max);			/* DPMI 0.9 AX=0100 */
+__asmlinkage int	__dpmi_free_dos_memory(int _selector);							/* DPMI 0.9 AX=0101 */
+__asmlinkage int	__dpmi_resize_dos_memory(int _selector, int _newpara, int *_ret_max);			/* DPMI 0.9 AX=0102 */
+
+__asmlinkage int	__dpmi_get_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);		/* DPMI 0.9 AX=0200 */
+__asmlinkage int	__dpmi_set_real_mode_interrupt_vector(int _vector, __dpmi_raddr *_address);		/* DPMI 0.9 AX=0201 */
+__asmlinkage int	__dpmi_get_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0202 */
+__asmlinkage int	__dpmi_set_processor_exception_handler_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0203 */
+__asmlinkage int	__dpmi_get_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0204 */
+__asmlinkage int	__dpmi_set_protected_mode_interrupt_vector(int _vector, __dpmi_paddr *_address);	/* DPMI 0.9 AX=0205 */
+
+__asmlinkage int	__dpmi_get_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0210 */
+__asmlinkage int	__dpmi_get_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0211 */
+__asmlinkage int	__dpmi_set_extended_exception_handler_vector_pm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0212 */
+__asmlinkage int	__dpmi_set_extended_exception_handler_vector_rm(int _vector, __dpmi_paddr *_address);	/* DPMI 1.0 AX=0213 */
 
-int	__dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);			/* DPMI 0.9 AX=0300 */
-int	__dpmi_int(int _vector, __dpmi_regs *_regs); /* like above, but sets ss sp fl */	/* DPMI 0.9 AX=0300 */
+__asmlinkage int	__dpmi_simulate_real_mode_interrupt(int _vector, __dpmi_regs *_regs);			/* DPMI 0.9 AX=0300 */
+__asmlinkage int	__dpmi_int(int _vector, __dpmi_regs *_regs); /* like above, but sets ss sp fl */	/* DPMI 0.9 AX=0300 */
 extern short __dpmi_int_ss, __dpmi_int_sp, __dpmi_int_flags; /* default to zero */
-int	__dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);				/* DPMI 0.9 AX=0301 */
-int	__dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_words_to_copy, const void *stack_data); /* DPMI 0.9 AX=0301 */
-int	__dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);				/* DPMI 0.9 AX=0302 */
-int	__dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret); /* DPMI 0.9 AX=0303 */
-int	__dpmi_free_real_mode_callback(__dpmi_raddr *_addr);					/* DPMI 0.9 AX=0304 */
-int	__dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);		/* DPMI 0.9 AX=0305 */
-int	__dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);			/* DPMI 0.9 AX=0306 */
-
-int	__dpmi_get_version(__dpmi_version_ret *_ret);						/* DPMI 0.9 AX=0400 */
-
-int	__dpmi_get_capabilities(int *_flags, char *vendor_info);				/* DPMI 1.0 AX=0401 */
-
-int	__dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);			/* DPMI 0.9 AX=0500 */
-int	__dpmi_allocate_memory(__dpmi_meminfo *_info);						/* DPMI 0.9 AX=0501 */
-int	__dpmi_free_memory(unsigned long _handle);						/* DPMI 0.9 AX=0502 */
-int	__dpmi_resize_memory(__dpmi_meminfo *_info);						/* DPMI 0.9 AX=0503 */
-
-int	__dpmi_allocate_linear_memory(__dpmi_meminfo *_info, int _commit);			/* DPMI 1.0 AX=0504 */
-int	__dpmi_resize_linear_memory(__dpmi_meminfo *_info, int _commit);			/* DPMI 1.0 AX=0505 */
-int	__dpmi_get_page_attributes(__dpmi_meminfo *_info, short *_buffer);			/* DPMI 1.0 AX=0506 */
-int	__dpmi_set_page_attributes(__dpmi_meminfo *_info, short *_buffer);			/* DPMI 1.0 AX=0507 */
-int	__dpmi_map_device_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr);	/* DPMI 1.0 AX=0508 */
-int	__dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr); /* DPMI 1.0 AX=0509 */
-int	__dpmi_get_memory_block_size_and_base(__dpmi_meminfo *_info);				/* DPMI 1.0 AX=050a */
-int	__dpmi_get_memory_information(__dpmi_memory_info *_buffer);				/* DPMI 1.0 AX=050b */
-
-int	__dpmi_lock_linear_region(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0600 */
-int	__dpmi_unlock_linear_region(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0601 */
-int	__dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);			/* DPMI 0.9 AX=0602 */
-int	__dpmi_relock_real_mode_region(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0603 */
-int	__dpmi_get_page_size(unsigned long *_size);						/* DPMI 0.9 AX=0604 */
+__asmlinkage int	__dpmi_simulate_real_mode_procedure_retf(__dpmi_regs *_regs);				/* DPMI 0.9 AX=0301 */
+__asmlinkage int	__dpmi_simulate_real_mode_procedure_retf_stack(__dpmi_regs *_regs, int stack_words_to_copy, const void *stack_data); /* DPMI 0.9 AX=0301 */
+__asmlinkage int	__dpmi_simulate_real_mode_procedure_iret(__dpmi_regs *_regs);				/* DPMI 0.9 AX=0302 */
+__asmlinkage int	__dpmi_allocate_real_mode_callback(void (*_handler)(void), __dpmi_regs *_regs, __dpmi_raddr *_ret); /* DPMI 0.9 AX=0303 */
+__asmlinkage int	__dpmi_free_real_mode_callback(__dpmi_raddr *_addr);					/* DPMI 0.9 AX=0304 */
+__asmlinkage int	__dpmi_get_state_save_restore_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);		/* DPMI 0.9 AX=0305 */
+__asmlinkage int	__dpmi_get_raw_mode_switch_addr(__dpmi_raddr *_rm, __dpmi_paddr *_pm);			/* DPMI 0.9 AX=0306 */
+
+__asmlinkage int	__dpmi_get_version(__dpmi_version_ret *_ret);						/* DPMI 0.9 AX=0400 */
+
+__asmlinkage int	__dpmi_get_capabilities(int *_flags, char *vendor_info);				/* DPMI 1.0 AX=0401 */
+
+__asmlinkage int	__dpmi_get_free_memory_information(__dpmi_free_mem_info *_info);			/* DPMI 0.9 AX=0500 */
+__asmlinkage int	__dpmi_allocate_memory(__dpmi_meminfo *_info);						/* DPMI 0.9 AX=0501 */
+__asmlinkage int	__dpmi_free_memory(unsigned long _handle);						/* DPMI 0.9 AX=0502 */
+__asmlinkage int	__dpmi_resize_memory(__dpmi_meminfo *_info);						/* DPMI 0.9 AX=0503 */
+
+__asmlinkage int	__dpmi_allocate_linear_memory(__dpmi_meminfo *_info, int _commit);			/* DPMI 1.0 AX=0504 */
+__asmlinkage int	__dpmi_resize_linear_memory(__dpmi_meminfo *_info, int _commit);			/* DPMI 1.0 AX=0505 */
+__asmlinkage int	__dpmi_get_page_attributes(__dpmi_meminfo *_info, short *_buffer);			/* DPMI 1.0 AX=0506 */
+__asmlinkage int	__dpmi_set_page_attributes(__dpmi_meminfo *_info, short *_buffer);			/* DPMI 1.0 AX=0507 */
+__asmlinkage int	__dpmi_map_device_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr);	/* DPMI 1.0 AX=0508 */
+__asmlinkage int	__dpmi_map_conventional_memory_in_memory_block(__dpmi_meminfo *_info, unsigned long _physaddr); /* DPMI 1.0 AX=0509 */
+__asmlinkage int	__dpmi_get_memory_block_size_and_base(__dpmi_meminfo *_info);				/* DPMI 1.0 AX=050a */
+__asmlinkage int	__dpmi_get_memory_information(__dpmi_memory_info *_buffer);				/* DPMI 1.0 AX=050b */
+
+__asmlinkage int	__dpmi_lock_linear_region(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0600 */
+__asmlinkage int	__dpmi_unlock_linear_region(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0601 */
+__asmlinkage int	__dpmi_mark_real_mode_region_as_pageable(__dpmi_meminfo *_info);			/* DPMI 0.9 AX=0602 */
+__asmlinkage int	__dpmi_relock_real_mode_region(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0603 */
+__asmlinkage int	__dpmi_get_page_size(unsigned long *_size);						/* DPMI 0.9 AX=0604 */
 
-int	__dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);			/* DPMI 0.9 AX=0702 */
-int	__dpmi_discard_page_contents(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0703 */
+__asmlinkage int	__dpmi_mark_page_as_demand_paging_candidate(__dpmi_meminfo *_info);			/* DPMI 0.9 AX=0702 */
+__asmlinkage int	__dpmi_discard_page_contents(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0703 */
 
-int	__dpmi_physical_address_mapping(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0800 */
-int	__dpmi_free_physical_address_mapping(__dpmi_meminfo *_info);				/* DPMI 0.9 AX=0801 */
+__asmlinkage int	__dpmi_physical_address_mapping(__dpmi_meminfo *_info);					/* DPMI 0.9 AX=0800 */
+__asmlinkage int	__dpmi_free_physical_address_mapping(__dpmi_meminfo *_info);				/* DPMI 0.9 AX=0801 */
 
 /* These next four functions return the old state */
-int	__dpmi_get_and_disable_virtual_interrupt_state(void);					/* DPMI 0.9 AX=0900 */
-int	__dpmi_get_and_enable_virtual_interrupt_state(void);					/* DPMI 0.9 AX=0901 */
-int	__dpmi_get_and_set_virtual_interrupt_state(int _old_state);				/* DPMI 0.9 AH=09   */
-int	__dpmi_get_virtual_interrupt_state(void);						/* DPMI 0.9 AX=0902 */
-
-int	__dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);		/* DPMI 0.9 AX=0a00 */
-
-int	__dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);				/* DPMI 0.9 AX=0b00 */
-int	__dpmi_clear_debug_watchpoint(unsigned long _handle);					/* DPMI 0.9 AX=0b01 */
-int	__dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);		/* DPMI 0.9 AX=0b02 */
-int	__dpmi_reset_debug_watchpoint(unsigned long _handle);					/* DPMI 0.9 AX=0b03 */
-
-int	__dpmi_install_resident_service_provider_callback(__dpmi_callback_info *_info);		/* DPMI 1.0 AX=0c00 */
-int	__dpmi_terminate_and_stay_resident(int return_code, int paragraphs_to_keep);		/* DPMI 1.0 AX=0c01 */
-
-int	__dpmi_allocate_shared_memory(__dpmi_shminfo *_info);					/* DPMI 1.0 AX=0d00 */
-int	__dpmi_free_shared_memory(unsigned long _handle);					/* DPMI 1.0 AX=0d01 */
-int	__dpmi_serialize_on_shared_memory(unsigned long _handle, int _flags);			/* DPMI 1.0 AX=0d02 */
-int	__dpmi_free_serialization_on_shared_memory(unsigned long _handle, int _flags);		/* DPMI 1.0 AX=0d03 */
+__asmlinkage int	__dpmi_get_and_disable_virtual_interrupt_state(void);					/* DPMI 0.9 AX=0900 */
+__asmlinkage int	__dpmi_get_and_enable_virtual_interrupt_state(void);					/* DPMI 0.9 AX=0901 */
+__asmlinkage int	__dpmi_get_and_set_virtual_interrupt_state(int _old_state);				/* DPMI 0.9 AH=09   */
+__asmlinkage int	__dpmi_get_virtual_interrupt_state(void);						/* DPMI 0.9 AX=0902 */
+
+__asmlinkage int	__dpmi_get_vendor_specific_api_entry_point(char *_id, __dpmi_paddr *_api);		/* DPMI 0.9 AX=0a00 */
+
+__asmlinkage int	__dpmi_set_debug_watchpoint(__dpmi_meminfo *_info, int _type);				/* DPMI 0.9 AX=0b00 */
+__asmlinkage int	__dpmi_clear_debug_watchpoint(unsigned long _handle);					/* DPMI 0.9 AX=0b01 */
+__asmlinkage int	__dpmi_get_state_of_debug_watchpoint(unsigned long _handle, int *_status);		/* DPMI 0.9 AX=0b02 */
+__asmlinkage int	__dpmi_reset_debug_watchpoint(unsigned long _handle);					/* DPMI 0.9 AX=0b03 */
+
+__asmlinkage int	__dpmi_install_resident_service_provider_callback(__dpmi_callback_info *_info);		/* DPMI 1.0 AX=0c00 */
+__asmlinkage int	__dpmi_terminate_and_stay_resident(int return_code, int paragraphs_to_keep);		/* DPMI 1.0 AX=0c01 */
+
+__asmlinkage int	__dpmi_allocate_shared_memory(__dpmi_shminfo *_info);					/* DPMI 1.0 AX=0d00 */
+__asmlinkage int	__dpmi_free_shared_memory(unsigned long _handle);					/* DPMI 1.0 AX=0d01 */
+__asmlinkage int	__dpmi_serialize_on_shared_memory(unsigned long _handle, int _flags);			/* DPMI 1.0 AX=0d02 */
+__asmlinkage int	__dpmi_free_serialization_on_shared_memory(unsigned long _handle, int _flags);		/* DPMI 1.0 AX=0d03 */
 
-int	__dpmi_get_coprocessor_status(void);							/* DPMI 1.0 AX=0e00 */
-int	__dpmi_set_coprocessor_emulation(int _flags);						/* DPMI 1.0 AX=0e01 */
+__asmlinkage int	__dpmi_get_coprocessor_status(void);							/* DPMI 1.0 AX=0e00 */
+__asmlinkage int	__dpmi_set_coprocessor_emulation(int _flags);						/* DPMI 1.0 AX=0e01 */
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
 /* Backwards compatibility stuff						       */
diff -urN orig/include/linkage.h djgpp/include/linkage.h
--- orig/include/linkage.h	Thu Jan  1 00:00:00 1970
+++ djgpp/include/linkage.h	Wed Jun 30 13:18:54 1999
@@ -0,0 +1,9 @@
+#ifndef __dj_include_linkage_h_
+#define __dj_include_linkage_h_
+
+#ifndef __REGPARM
+#define __REGPARM 0
+#endif
+#define __asmlinkage __attribute__((regparm(0)))
+
+#endif /* !__dj_include_linkage_h_ */

- Raw text -


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