Message-ID: <19990628010734.59338@atrey.karlin.mff.cuni.cz> Date: Mon, 28 Jun 1999 01:07:34 +0200 From: Jan Hubicka To: djgpp-workers AT delorie DOT com Subject: Regparm.... Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.84 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id TAA18250 Reply-To: djgpp-workers AT delorie DOT com Hi Thanks to Bernd Schmidt's work, the reload pass of compiler now don't generate incorrect code under the register pressure. The regparm feature can now be stable in the 2.95.x versions. It is not very well tested, but most of design flaws making it to generate incorrect code are gone. Only remaining problem I know of is bug in combiner that causes compiler to extend lifetimes of hard registers and crash occasionally (actually this may probably happen w/o regparm as well and it seems to be very infrequent, Bernd has made a patch for it, but it is not in the gcc yet). DJGPP seems to be ideal platform for testing this feature in wider audience. Because of lack of shared libraries it don't have so much problems with binarry compatibility as Linux and other operating systems w/o quotes. It would be IMO great if DJGPP used this convention, because it can bring some extra speed to it and can help to gcc development. Because of that I've decided to adopt DJGPP runtime environment to work when compiled with mregparm=x option. This is result of my first pass. I am now able to build djgpp libc with -mregparm=1..3 and it seems to work. I've tested only few simple programs I have around my hdd, but the simple hello world, zlib, pnglib and some other stuff seems to work well. There are problems with longjmp, profiling and debugging, but they was likely to happen. My goal was to bring running runtime as soon as possible, so don't expect finished work. There is major problem with asm functions. For now I've just changed headers to use __asmlinkage macro that set regparm to 0. This needs to be changed in future. Many of functions can be changed to asm statements, but I am not sure how you will like this solution. I've already done this for string functions, where this cange was necesary because gcc seems to ignore regparm for builtin functions so crt1 crashed. I was thinking about some sane preprocesor macros that can be used to write functions compilable for both calling convention but I still have no idea, so converting asm stuff will be most probably quite problem. Other work needs to be done on setjmp and similar stuff later. Also I am having problems with spec file. I've changed it to define __REGPARM macro with the actual value. This can be used for ASM macros and similar stuff. But there needs to be linked different library. My goal was to create subdirectories R1, R2 and R3 in the lib directory and place libraries there. But I am unable to change -L options in spec file accordingly. I will welcome any idea. Last problem is with makefiles. It would be probably nice to be able to build all versions of library at once. So here I am sending result of my one night hack. I would love to hear your comments and if there is possibility to include this into main distribution. I would preffer to include it even in such half finished form (well more finished than now), because it don't breaks anything and patches would become hard to maitain once they gets larger. Also third party libraries (such as allegro) will needs to be modified for calling conventions and sooner it happends, the better. So please let me know your ideas. Just last information that might interest you is the size of stripped libc compiled in various regparms: -mregparm=0 326kb -mregparm=1 323kb -mregparm=2 321kb -mregparm=3 320kb so gcc seems to generate best code for regparm=3 now. This has changed since the 2.7.2 times, that liked the regparm=1 the best... So maybe it will make sense to only use -mregparm=0 and -mregparm=3 code. My version of spec files and patch follows Honza *asm: *asm_final: *cpp: %{mregparm=0:-D__REGPARM=0} %{mregparm=1:-D__REGPARM=1} \ %{mregparm=2:-D__REGPARM=2} %{mregparm=3:-D__REGPARM=3} \ %{posix:-D_POSIX_SOURCE} *cc1: %{!m386:-m486 -malign-jumps=2 %{!m486:-malign-loops=2 -malign-functions=2}} *cc1plus: %{!m386:-m486 -malign-jumps=2 %{!m486:-malign-loops=2 -malign-functions=2}} *endfile: *link: *link_command: %{!c:%{!M:%{!MM:%{!E:%{!S:ld %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ %{mregparm=1:-L f:/gcc/lib/r1} \ %{mregparm=2:-L f:/gcc/lib/r2} %{mregparm=3:-L f:/gcc/lib/r3} \ %{r} %{s} %{t} %{u*} %{x} %{z}\ %{!A:%{!nostartfiles:%{!nostdlib:%S}}} %{static:}\ %{L*} %D %{T*} %o -Tdjgpp.djl\ %{!nostdlib:-lgcc %L -lgcc %{!A:%E}}}}}}} %{!c:%{!M:%{!MM:%{!E:%{!S:stubify %{v} %{o*:%*} %{!o*:a.out}}}}}} *lib: -lc *startfile: %{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} *switches_need_spaces: *signed_char: %{funsigned-char:-D__CHAR_UNSIGNED__} *predefines: -Dunix -Di386 -DGO32 -DMSDOS -DDJGPP=2 -DDJGPP_MINOR=2 *cross_compile: 0 diff -urN ../dj1/src/libc/ansi/string/makefile src/libc/ansi/string/makefile --- ../dj1/src/libc/ansi/string/makefile Fri Jun 16 05:03:22 1995 +++ src/libc/ansi/string/makefile Sun Jun 27 08:33:56 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 ../dj1/src/libc/ansi/string/memcpy.c src/libc/ansi/string/memcpy.c --- ../dj1/src/libc/ansi/string/memcpy.c Thu Jan 1 01:00:00 1970 +++ src/libc/ansi/string/memcpy.c Sun Jun 27 08:34:15 1999 @@ -0,0 +1,10 @@ +#include +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; +} + \ No newline at end of file diff -urN ../dj1/src/libc/ansi/string/memcpy.s src/libc/ansi/string/memcpy.s --- ../dj1/src/libc/ansi/string/memcpy.s Sat Mar 11 03:38:38 1995 +++ src/libc/ansi/string/memcpy.s Thu Jan 1 01: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 ../dj1/src/libc/ansi/string/memmove.c src/libc/ansi/string/memmove.c --- ../dj1/src/libc/ansi/string/memmove.c Thu Jan 1 01:00:00 1970 +++ src/libc/ansi/string/memmove.c Sun Jun 27 08:34:39 1999 @@ -0,0 +1,29 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#include +void *memmove (void *d, const void *s, size_t n) +{ + int tmp; + asm volatile (" + jecxz L2 + cld + cmpl %%esi,%%edi + jb L3 + + std + addl %%ecx,%%esi + addl %%ecx,%%edi + decl %%esi + decl %%edi +L3: + rep + movsb + +L2: + cld + " + :"=D"(tmp),"=S"(s),"=c"(n) + :"D"(d),"S"(s),"c"(n) + :"memory"); + return d; +} + \ No newline at end of file diff -urN ../dj1/src/libc/ansi/string/memmove.s src/libc/ansi/string/memmove.s --- ../dj1/src/libc/ansi/string/memmove.s Tue Mar 28 04:14:46 1995 +++ src/libc/ansi/string/memmove.s Thu Jan 1 01:00:00 1970 @@ -1,33 +0,0 @@ -/* 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 - cld - cmpl %esi,%edi - jb L3 - - std - addl %ecx,%esi - addl %ecx,%edi - decl %esi - decl %edi -L3: - rep - movsb - -L2: - cld - popl %edi - popl %esi - movl 8(%ebp),%eax - leave - ret - diff -urN ../dj1/src/libc/ansi/string/memset.c src/libc/ansi/string/memset.c --- ../dj1/src/libc/ansi/string/memset.c Thu Jan 1 01:00:00 1970 +++ src/libc/ansi/string/memset.c Sun Jun 27 08:34:42 1999 @@ -0,0 +1,48 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#include + +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 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 + ":"=a"(c),"=c"(n),"=D"(tmp) + :"a"(c),"c"(n),"D"(s) + :"memory"); + return s; +} + \ No newline at end of file diff -urN ../dj1/src/libc/ansi/string/memset.s src/libc/ansi/string/memset.s --- ../dj1/src/libc/ansi/string/memset.s Tue Mar 28 04:14:46 1995 +++ src/libc/ansi/string/memset.s Thu Jan 1 01: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 ../dj1/src/libc/ansi/time/ctime.c src/libc/ansi/time/ctime.c --- ../dj1/src/libc/ansi/time/ctime.c Thu Jan 1 17:17:30 1998 +++ src/libc/ansi/time/ctime.c Sun Jun 27 03:58:54 1999 @@ -944,7 +944,7 @@ settzname(); } -void +static void tzsetwall(void) { lcl_is_set = TRUE; diff -urN ../dj1/src/libc/compat/mntent/mntent.c src/libc/compat/mntent/mntent.c --- ../dj1/src/libc/compat/mntent/mntent.c Sun Nov 15 14:20:56 1998 +++ src/libc/compat/mntent/mntent.c Sun Jun 27 04:01:20 1999 @@ -612,7 +612,7 @@ if (drive_number <= 2) { unsigned char buf[512]; - int bios_status, count = 0; + int bios_status = 0, count = 0; int drive_a_remapped = drive_a_mapping == 2; /* When biosdisk is called, Windows 9X pops up the ugly diff -urN ../dj1/src/libc/crt0/brk.c src/libc/crt0/brk.c --- ../dj1/src/libc/crt0/brk.c Tue Nov 7 22:23:20 1995 +++ src/libc/crt0/brk.c Sun Jun 27 04:10:40 1999 @@ -1,7 +1,8 @@ /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ #include +#include -extern int __brk(void *); +__asmlinkage extern int __brk(void *); int brk(void *_heaptop) diff -urN ../dj1/src/libc/crt0/rfinfo.c src/libc/crt0/rfinfo.c --- ../dj1/src/libc/crt0/rfinfo.c Sun Jul 12 16:23:16 1998 +++ src/libc/crt0/rfinfo.c Sun Jun 27 04:53:06 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 ../dj1/src/libc/dos/dos/int86.c src/libc/dos/dos/int86.c --- ../dj1/src/libc/dos/dos/int86.c Mon Nov 3 00:01:44 1997 +++ src/libc/dos/dos/int86.c Sun Jun 27 04:34:32 1999 @@ -5,8 +5,9 @@ #include #include #include +#include -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 /f/gcc/include1/dos.h include/dos.h --- /f/gcc/include1/dos.h Sun Jun 27 03:01:42 1999 +++ include/dos.h Sun Jun 27 04:14:24 1999 @@ -3,6 +3,8 @@ #ifndef __dj_include_dos_h_ #define __dj_include_dos_h_ +#include + #ifndef __dj_ENFORCE_ANSI_FREESTANDING #ifndef __STRICT_ANSI__ @@ -136,7 +138,7 @@ int int86(int ivec, union REGS *in, union REGS *out); -int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg); +__asmlinkage int int86x(int ivec, union REGS *in, union REGS *out, struct SREGS *seg); int intdos(union REGS *in, union REGS *out); int intdosx(union REGS *in, union REGS *out, struct SREGS *seg); int bdos(int func, unsigned dx, unsigned al); diff -urN /f/gcc/include1/dpmi.h include/dpmi.h --- /f/gcc/include1/dpmi.h Sun Jun 27 03:01:42 1999 +++ include/dpmi.h Sun Jun 27 04:14:30 1999 @@ -2,6 +2,8 @@ #ifndef __dj_include_dpmi_h_ #define __dj_include_dpmi_h_ +#include + #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_bytes_to_copy, const void *stack_bytes); /* 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_bytes_to_copy, const void *stack_bytes); /* 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 /f/gcc/include1/float.h include/float.h --- /f/gcc/include1/float.h Sun Jun 27 03:01:42 1999 +++ include/float.h Sun Jun 27 04:14:40 1999 @@ -2,6 +2,8 @@ #ifndef __dj_include_float_h_ #define __dj_include_float_h_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -98,7 +100,7 @@ #define IC_PROJECTIVE 0x0000 /* -Inf == +Inf */ unsigned int _clear87(void); -unsigned int _control87(unsigned int newcw, unsigned int mask); +__asmlinkage unsigned int _control87(unsigned int newcw, unsigned int mask); void _fpreset(void); unsigned int _status87(void); diff -urN /f/gcc/include1/libtext.h include/libtext.h --- /f/gcc/include1/libtext.h Sun Jun 27 03:01:44 1999 +++ include/libtext.h Sun Jan 31 18:11:40 1999 @@ -1,9 +1,9 @@ -#include "textfont.h" -#include "textmode.h" -#include "txcontext.h" -#include "txblit.h" -#include "txcursor.h" -#include "txget---.h" -#include "txinit.h" -#include "txmode.h" -#include "txput---.h" +#include "textfont.h" +#include "textmode.h" +#include "txcontext.h" +#include "txblit.h" +#include "txcursor.h" +#include "txget---.h" +#include "txinit.h" +#include "txmode.h" +#include "txput---.h" diff -urN /f/gcc/include1/linkage.h include/linkage.h --- /f/gcc/include1/linkage.h Thu Jan 1 01:00:00 1970 +++ include/linkage.h Sun Jun 27 03:54:58 1999 @@ -0,0 +1,6 @@ +#ifndef __dj_include_linkage_h_ +#define __dj_include_linkage_h_ + +#define __asmlinkage __attribute__((regparm(0))) + +#endif /* !__dj_include_linkage_h_ */ diff -urN /f/gcc/include1/machine/endian.h include/machine/endian.h --- /f/gcc/include1/machine/endian.h Sun Jun 27 03:01:42 1999 +++ include/machine/endian.h Sun Jun 27 04:14:12 1999 @@ -37,6 +37,8 @@ #ifndef _MACHINE_ENDIAN_H_ #define _MACHINE_ENDIAN_H_ +#include + /* * Definitions for byte order, according to byte significance from low * address to high. @@ -50,10 +52,10 @@ #include __BEGIN_DECLS -unsigned long htonl __P((unsigned long)); -unsigned short htons __P((unsigned short)); -unsigned long ntohl __P((unsigned long)); -unsigned short ntohs __P((unsigned short)); +__asmlinkage unsigned long htonl __P((unsigned long)); +__asmlinkage unsigned short htons __P((unsigned short)); +__asmlinkage unsigned long ntohl __P((unsigned long)); +__asmlinkage unsigned short ntohs __P((unsigned short)); __END_DECLS /* diff -urN /f/gcc/include1/netinet/in.h include/netinet/in.h --- /f/gcc/include1/netinet/in.h Sun Jun 27 03:01:42 1999 +++ include/netinet/in.h Sun Jun 27 04:14:18 1999 @@ -3,6 +3,8 @@ #ifndef __dj_include_netinet_in_h_ #define __dj_include_netinet_in_h_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -13,10 +15,10 @@ #ifndef _POSIX_SOURCE -unsigned long htonl(unsigned long _val); -unsigned long ntohl(unsigned long _val); -unsigned short htons(unsigned short _val); -unsigned short ntohs(unsigned short _val); +__asmlinkage unsigned long htonl(unsigned long _val); +__asmlinkage unsigned long ntohl(unsigned long _val); +__asmlinkage unsigned short htons(unsigned short _val); +__asmlinkage unsigned short ntohs(unsigned short _val); #endif /* !_POSIX_SOURCE */ #endif /* !__STRICT_ANSI__ */ diff -urN /f/gcc/include1/pc.h include/pc.h --- /f/gcc/include1/pc.h Sun Jun 27 03:01:42 1999 +++ include/pc.h Sun Jun 27 04:14:46 1999 @@ -3,6 +3,8 @@ #ifndef __dj_include_pc_h_ #define __dj_include_pc_h_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -13,23 +15,23 @@ #ifndef _POSIX_SOURCE -unsigned char inportb (unsigned short _port); -unsigned short inportw (unsigned short _port); -unsigned long inportl (unsigned short _port); -void inportsb (unsigned short _port, unsigned char *_buf, unsigned _len); -void inportsw (unsigned short _port, unsigned short *_buf, unsigned _len); -void inportsl (unsigned short _port, unsigned long *_buf, unsigned _len); -void outportb (unsigned short _port, unsigned char _data); -void outportw (unsigned short _port, unsigned short _data); -void outportl (unsigned short _port, unsigned long _data); -void outportsb(unsigned short _port, const unsigned char *_buf, unsigned _len); -void outportsw(unsigned short _port, const unsigned short *_buf, unsigned _len); -void outportsl(unsigned short _port, const unsigned long *_buf, unsigned _len); - -unsigned char inp(unsigned short _port); -unsigned short inpw(unsigned short _port); -void outp(unsigned short _port, unsigned char _data); -void outpw(unsigned short _port, unsigned short _data); +__asmlinkage unsigned char inportb (unsigned short _port); +__asmlinkage unsigned short inportw (unsigned short _port); +__asmlinkage unsigned long inportl (unsigned short _port); +__asmlinkage void inportsb (unsigned short _port, unsigned char *_buf, unsigned _len); +__asmlinkage void inportsw (unsigned short _port, unsigned short *_buf, unsigned _len); +__asmlinkage void inportsl (unsigned short _port, unsigned long *_buf, unsigned _len); +__asmlinkage void outportb (unsigned short _port, unsigned char _data); +__asmlinkage void outportw (unsigned short _port, unsigned short _data); +__asmlinkage void outportl (unsigned short _port, unsigned long _data); +__asmlinkage void outportsb(unsigned short _port, const unsigned char *_buf, unsigned _len); +__asmlinkage void outportsw(unsigned short _port, const unsigned short *_buf, unsigned _len); +__asmlinkage void outportsl(unsigned short _port, const unsigned long *_buf, unsigned _len); + +__asmlinkage unsigned char inp(unsigned short _port); +__asmlinkage unsigned short inpw(unsigned short _port); +__asmlinkage void outp(unsigned short _port, unsigned char _data); +__asmlinkage void outpw(unsigned short _port, unsigned short _data); int kbhit(void); int getkey(void); /* ALT's have 0x100 set */ int getxkey(void); /* ALT's have 0x100 set, 0xe0 sets 0x200 */ diff -urN /f/gcc/include1/setjmp.h include/setjmp.h --- /f/gcc/include1/setjmp.h Sun Jun 27 03:01:42 1999 +++ include/setjmp.h Sun Jun 27 04:14:50 1999 @@ -2,6 +2,8 @@ #ifndef __dj_include_setjmp_h_ #define __dj_include_setjmp_h_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -18,15 +20,15 @@ unsigned char __fpu_state[108]; /* for future use */ } jmp_buf[1]; -void longjmp(jmp_buf env, int val); -int setjmp(jmp_buf env); +__asmlinkage void longjmp(jmp_buf env, int val); +__asmlinkage int setjmp(jmp_buf env); #ifndef __STRICT_ANSI__ typedef jmp_buf sigjmp_buf; -int sigsetjmp(sigjmp_buf env, int savemask); -int siglongjmp(sigjmp_buf env, int val); +__asmlinkage int sigsetjmp(sigjmp_buf env, int savemask); +__asmlinkage int siglongjmp(sigjmp_buf env, int val); #ifndef _POSIX_SOURCE diff -urN /f/gcc/include1/string.h include/string.h --- /f/gcc/include1/string.h Sun Jun 27 03:01:42 1999 +++ include/string.h Sun Jun 27 05:37:24 1999 @@ -3,6 +3,8 @@ #ifndef __dj_include_string_h_ #define __dj_include_string_h_ +#include + #ifdef __cplusplus extern "C" { #endif diff -urN /f/gcc/include1/stubinfo.h include/stubinfo.h --- /f/gcc/include1/stubinfo.h Sun Jun 27 03:01:42 1999 +++ include/stubinfo.h Sun Jun 27 08:10:12 1999 @@ -2,8 +2,8 @@ #ifndef __dj_include_stub_h__ #define __dj_include_stub_h__ -#define STUBINFO_MAGIC 0 #define STUBINFO 0 +#define STUBINFO_MAGIC 0 #define STUBINFO_SIZE 0x10 #define STUBINFO_MINSTACK 0x14 #define STUBINFO_MEMORY_HANDLE 0x18 diff -urN /f/gcc/include1/sys/movedata.h include/sys/movedata.h --- /f/gcc/include1/sys/movedata.h Sun Jun 27 03:01:42 1999 +++ include/sys/movedata.h Sun Jun 27 04:13:34 1999 @@ -3,6 +3,8 @@ #ifndef __dj_include_sys_movedata_h_ #define __dj_include_sys_movedata_h_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -37,14 +39,14 @@ /* This length is in bytes, optimized for speed */ -void movedata(unsigned _source_selector, unsigned _source_offset, +__asmlinkage void movedata(unsigned _source_selector, unsigned _source_offset, unsigned _dest_selector, unsigned _dest_offset, size_t _length); /* The lengths here are in TRANSFERS, not bytes! */ -void _movedatab(unsigned, unsigned, unsigned, unsigned, size_t); -void _movedataw(unsigned, unsigned, unsigned, unsigned, size_t); -void _movedatal(unsigned, unsigned, unsigned, unsigned, size_t); +__asmlinkage void _movedatab(unsigned, unsigned, unsigned, unsigned, size_t); +__asmlinkage void _movedataw(unsigned, unsigned, unsigned, unsigned, size_t); +__asmlinkage void _movedatal(unsigned, unsigned, unsigned, unsigned, size_t); #endif /* !_POSIX_SOURCE */ #endif /* !__STRICT_ANSI__ */ diff -urN /f/gcc/include1/unistd.h include/unistd.h --- /f/gcc/include1/unistd.h Sun Jun 27 03:01:42 1999 +++ include/unistd.h Sun Jun 27 06:28:12 1999 @@ -3,6 +3,8 @@ #ifndef __dj_include_unistd_h_ #define __dj_include_unistd_h_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -135,7 +137,7 @@ int getpagesize(void); char * getwd(char *__buffer); int nice(int _increment); -void * sbrk(int _delta); +__asmlinkage void * sbrk(int _delta); int symlink (const char *, const char *); int sync(void); int truncate(const char*, off_t);