Browse Source

Merged revisions 5558,5671,5694 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r5558 | pierre | 2006-12-08 14:22:40 +0100 (Fri, 08 Dec 2006) | 5 lines

* fix compilation failure in 2.1 branch
reason is that cvar was .comm before and
is now .bss, you need to explicitly add public
to added the .globl that makes the assembler symbol
accessible in other objects.
........
r5671 | pierre | 2006-12-22 00:54:38 +0100 (Fri, 22 Dec 2006) | 4 lines

* in dpmi_longjmp, fix wrong parameter retrieving,
old code was based on assumption that parameters
are on stack. New code works in both cases.

........
r5694 | pierre | 2006-12-24 02:26:47 +0100 (Sun, 24 Dec 2006) | 3 lines

* try to correct the code for regcall convention.
* signal handlers need to have cdecl modifier to
be compatible with djgpp C code.
........

git-svn-id: branches/fixes_2_0@5859 -

pierre 19 years ago
parent
commit
475a293588
5 changed files with 88 additions and 41 deletions
  1. 8 2
      ide/Makefile
  2. 6 0
      ide/compiler/Makefile
  3. 71 36
      rtl/go32v2/dpmiexcp.pp
  4. 1 1
      rtl/go32v2/emu387.pp
  5. 2 2
      rtl/go32v2/profile.pp

+ 8 - 2
ide/Makefile

@@ -2,7 +2,7 @@
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/07]
 # Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/12/07]
 #
 #
 default: all
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 LIMIT83fs = go32v2 os2 emx watcom
@@ -1798,6 +1798,7 @@ override FPCOPT:=!FPCEXTCMD
 export FPCEXTCMD
 export FPCEXTCMD
 endif
 endif
 override COMPILER:=$(FPC) $(FPCOPT)
 override COMPILER:=$(FPC) $(FPCOPT)
+PREEXECPPAS=echo Calling FPC with FPCOPT  "$(FPCOPT)"
 ifeq (,$(findstring -s ,$(COMPILER)))
 ifeq (,$(findstring -s ,$(COMPILER)))
 EXECPPAS=
 EXECPPAS=
 else
 else
@@ -1842,15 +1843,19 @@ $(COMPILER_UNITTARGETDIR):
 $(COMPILER_TARGETDIR):
 $(COMPILER_TARGETDIR):
 	$(MKDIRTREE) $(COMPILER_TARGETDIR)
 	$(MKDIRTREE) $(COMPILER_TARGETDIR)
 %$(PPUEXT): %.pp
 %$(PPUEXT): %.pp
+	$(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(PPUEXT): %.pas
 %$(PPUEXT): %.pas
+	$(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(EXEEXT): %.pp
 %$(EXEEXT): %.pp
+	$(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(EXEEXT): %.pas
 %$(EXEEXT): %.pas
+	$(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(EXEEXT): %.lpr
 %$(EXEEXT): %.lpr
@@ -2346,7 +2351,8 @@ compiler_makefiles:
 	$(MAKE) -C compiler makefiles
 	$(MAKE) -C compiler makefiles
 compiler:
 compiler:
 	$(MAKE) -C compiler all
 	$(MAKE) -C compiler all
-.PHONY: compiler_all compiler_debug compiler_smart compiler_release compiler_units compiler_examples compiler_shared compiler_install compiler_sourceinstall compiler_exampleinstall compiler_distinstall compiler_zipinstall compiler_zipsourceinstall compiler_zipexampleinstall compiler_zipdistinstall compiler_clean compiler_distclean compiler_cleanall compiler_info compiler_makefiles compiler
+.PHONY: compiler_all compiler_debug compiler_smart compiler_release compiler_units compiler_examples compiler_shared compiler_install compiler_sourceinstall compiler_exampleinstall compiler_distinstall compiler_zipinstall compiler_zipsourceinstall
+.PHONY: compiler_zipexampleinstall compiler_zipdistinstall compiler_clean compiler_distclean compiler_cleanall compiler_info compiler_makefiles compiler
 endif
 endif
 debug: fpc_debug
 debug: fpc_debug
 smart: fpc_smart
 smart: fpc_smart

+ 6 - 0
ide/compiler/Makefile

@@ -1714,6 +1714,8 @@ ifdef ACROSSCOMPILE
 override FPCOPT+=$(CROSSOPT)
 override FPCOPT+=$(CROSSOPT)
 endif
 endif
 override COMPILER:=$(FPC) $(FPCOPT)
 override COMPILER:=$(FPC) $(FPCOPT)
+PREEXECPPAS=echo FPCOPT is "$FPCOPT"
+
 ifeq (,$(findstring -s ,$(COMPILER)))
 ifeq (,$(findstring -s ,$(COMPILER)))
 EXECPPAS=
 EXECPPAS=
 else
 else
@@ -1750,15 +1752,19 @@ $(COMPILER_UNITTARGETDIR):
 $(COMPILER_TARGETDIR):
 $(COMPILER_TARGETDIR):
 	$(MKDIRTREE) $(COMPILER_TARGETDIR)
 	$(MKDIRTREE) $(COMPILER_TARGETDIR)
 %$(PPUEXT): %.pp
 %$(PPUEXT): %.pp
+        $(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(PPUEXT): %.pas
 %$(PPUEXT): %.pas
+        $(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(EXEEXT): %.pp
 %$(EXEEXT): %.pp
+        $(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(EXEEXT): %.pas
 %$(EXEEXT): %.pas
+        $(PREEXECPPAS)
 	$(COMPILER) $<
 	$(COMPILER) $<
 	$(EXECPPAS)
 	$(EXECPPAS)
 %$(EXEEXT): %.lpr
 %$(EXEEXT): %.lpr

+ 71 - 36
rtl/go32v2/dpmiexcp.pp

@@ -109,31 +109,31 @@ const
   SIG_SETMASK = 2;
   SIG_SETMASK = 2;
   SIG_UNBLOCK = 3;
   SIG_UNBLOCK = 3;
 
 
-function SIG_DFL( x: longint) : longint;
+function SIG_DFL( x: longint) : longint;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifndef CREATE_C_FUNCTIONS}
 {$ifndef CREATE_C_FUNCTIONS}
-external name '___djgpp_SIG_DFL';
+external name '__djgpp_SIG_DFL';
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
-function SIG_ERR( x: longint) : longint;
+function SIG_ERR( x: longint) : longint;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifndef CREATE_C_FUNCTIONS}
 {$ifndef CREATE_C_FUNCTIONS}
-external name '___djgpp_SIG_ERR';
+external name '__djgpp_SIG_ERR';
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
-function SIG_IGN( x: longint) : longint;
+function SIG_IGN( x: longint) : longint;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifndef CREATE_C_FUNCTIONS}
 {$ifndef CREATE_C_FUNCTIONS}
-external name '___djgpp_SIG_IGN';
+external name '__djgpp_SIG_IGN';
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
 type
 type
-  SignalHandler  = function (v : longint) : longint;
+  SignalHandler  = function (v : longint) : longint;cdecl;
   PSignalHandler = ^SignalHandler; { to be compatible with linux.pp }
   PSignalHandler = ^SignalHandler; { to be compatible with linux.pp }
 
 
-function signal(sig : longint;func : SignalHandler) : SignalHandler;
+function signal(sig : longint;func : SignalHandler) : SignalHandler;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
-function _raise(sig : longint) : longint;
+function _raise(sig : longint) : longint;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 
 
 { Exceptions }
 { Exceptions }
@@ -149,13 +149,13 @@ type
     __fpu_state : array [0..108-1] of byte; {  for future use  }
     __fpu_state : array [0..108-1] of byte; {  for future use  }
   end;
   end;
 
 
-procedure djgpp_exception_toggle;
+procedure djgpp_exception_toggle;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifndef CREATE_C_FUNCTIONS}
 {$ifndef CREATE_C_FUNCTIONS}
 external name '___djgpp_exception_toggle';
 external name '___djgpp_exception_toggle';
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
-procedure djgpp_exception_setup;
+procedure djgpp_exception_setup;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifndef CREATE_C_FUNCTIONS}
 {$ifndef CREATE_C_FUNCTIONS}
 external name '___djgpp_exception_setup';
 external name '___djgpp_exception_setup';
@@ -164,11 +164,11 @@ external name '___djgpp_exception_setup';
 function  djgpp_exception_state : pexception_state;
 function  djgpp_exception_state : pexception_state;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 
 
-function  djgpp_set_ctrl_c(enable : boolean) : boolean;
+function  djgpp_set_ctrl_c(enable : boolean) : boolean;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 
 
 { Other }
 { Other }
-function dpmi_set_coprocessor_emulation(flag : longint) : longint;
+function dpmi_set_coprocessor_emulation(flag : longint) : longint;cdecl;
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 {$ifdef IN_SYSTEM}forward;{$endif IN_SYSTEM}
 
 
 function __djgpp_set_sigint_key(new_key : longint) : longint;cdecl;
 function __djgpp_set_sigint_key(new_key : longint) : longint;cdecl;
@@ -499,8 +499,9 @@ end;
 ****************************************************************************}
 ****************************************************************************}
 
 
 {$ifdef CREATE_C_FUNCTIONS}
 {$ifdef CREATE_C_FUNCTIONS}
-function c_setjmp(var rec : dpmi_jmp_buf) : longint;[public, alias : '_setjmp'];
+function c_setjmp(var rec : dpmi_jmp_buf) : longint;cdecl;[public, alias : '_setjmp'];
   begin
   begin
+{$ifndef REGCALL}
   { here we need to be subtle :
   { here we need to be subtle :
     - we need to return with the arg still on the stack
     - we need to return with the arg still on the stack
     - but we also need to jmp to FPC_setjmp and not to call it
     - but we also need to jmp to FPC_setjmp and not to call it
@@ -520,6 +521,27 @@ function c_setjmp(var rec : dpmi_jmp_buf) : longint;[public, alias : '_setjmp'];
         popl    %eax
         popl    %eax
         jmp     dpmi_setjmp
         jmp     dpmi_setjmp
      end;
      end;
+{$ELSE REGCALL}
+    { this is easier with regcall convention
+      because dpmi_setjmp expects rec arg in $eax }
+     asm
+        movl     rec,%eax
+        movl    %ebp,%esp
+        popl    %ebp
+        pushl   %eax
+        { stack is now:
+           (%esp): saved eax
+          4(%esp): return addr
+          8(%esp): rec addr
+          we need just
+          (%esp): return addr }
+        movl    4(%esp),%eax
+        movl    %eax,8(%esp)
+        popl    %eax
+        addl    $4,%esp
+        jmp     dpmi_setjmp
+     end;
+{$ENDIF REGCALL}
   end;
   end;
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
@@ -535,16 +557,27 @@ begin
         movl    %ecx,8(%edi)
         movl    %ecx,8(%edi)
         movl    %edx,12(%edi)
         movl    %edx,12(%edi)
         movl    %esi,16(%edi)
         movl    %esi,16(%edi)
+{$ifndef REGCALL}
         { load edi }
         { load edi }
         movl    -4(%ebp),%eax
         movl    -4(%ebp),%eax
+{$ELSE REGCALL}
+        { load edi }
+        movl    (%esp),%eax
+{$ENDIF REGCALL}
         { ... and store it }
         { ... and store it }
         movl    %eax,20(%edi)
         movl    %eax,20(%edi)
         { ebp ... }
         { ebp ... }
         movl    (%ebp),%eax
         movl    (%ebp),%eax
         movl    %eax,24(%edi)
         movl    %eax,24(%edi)
+{$ifndef REGCALL}
         { esp ... }
         { esp ... }
         movl    %esp,%eax
         movl    %esp,%eax
         addl    $12,%eax
         addl    $12,%eax
+{$ELSE REGCALL}
+        { for esp, use ebp ... }
+        movl    %ebp,%eax
+        addl    $8,%eax
+{$ENDIF REGCALL}
         movl    %eax,28(%edi)
         movl    %eax,28(%edi)
         { the return address }
         { the return address }
         movl    4(%ebp),%eax
         movl    4(%ebp),%eax
@@ -577,7 +610,7 @@ end;
 
 
 
 
 {$ifdef CREATE_C_FUNCTIONS}
 {$ifdef CREATE_C_FUNCTIONS}
-procedure c_longjmp(var  rec : dpmi_jmp_buf;return_value : longint);[public, alias : '_longjmp'];
+procedure c_longjmp(var  rec : dpmi_jmp_buf;return_value : longint);cdecl;[public, alias : '_longjmp'];
   begin
   begin
      dpmi_longjmp(rec,return_value);
      dpmi_longjmp(rec,return_value);
      { never gets here !! so pascal stack convention is no problem }
      { never gets here !! so pascal stack convention is no problem }
@@ -591,11 +624,13 @@ begin
   if (exception_level>0) then
   if (exception_level>0) then
     dec(exception_level);
     dec(exception_level);
   asm
   asm
+        { copy from longjmp.S }
+        { Adapted to avoid being sensitive to
+          argument being on stack or in registers 2006-12-21 PM }
+        movl    rec,%edi    { get dpmi_jmp_buf }
+        movl    return_value,%eax    { store retval in j->eax }
         { restore compiler shit }
         { restore compiler shit }
         popl    %ebp
         popl    %ebp
-        { copy from longjmp.S }
-        movl    4(%esp),%edi    { get dpmi_jmp_buf }
-        movl    8(%esp),%eax    { store retval in j->eax }
         movl    %eax,0(%edi)
         movl    %eax,0(%edi)
 
 
         movw    46(%edi),%fs
         movw    46(%edi),%fs
@@ -645,28 +680,28 @@ end;
 
 
 var
 var
   signal_list : Array[0..SIGMAX] of SignalHandler;cvar;
   signal_list : Array[0..SIGMAX] of SignalHandler;cvar;
-  {$ifndef CREATE_C_FUNCTIONS}external;{$endif}
+  {$ifndef CREATE_C_FUNCTIONS}external;{$else}public;{$endif}
 
 
 {$ifdef CREATE_C_FUNCTIONS}
 {$ifdef CREATE_C_FUNCTIONS}
-function SIG_ERR(x:longint):longint;[public,alias : '___djgpp_SIG_ERR'];
+function SIG_ERR(x:longint):longint;cdecl;[public,alias : '___djgpp_SIG_ERR'];
 begin
 begin
   SIG_ERR:=-1;
   SIG_ERR:=-1;
 end;
 end;
 
 
 
 
-function SIG_IGN(x:longint):longint;[public,alias : '___djgpp_SIG_IGN'];
+function SIG_IGN(x:longint):longint;cdecl;[public,alias : '___djgpp_SIG_IGN'];
 begin
 begin
   SIG_IGN:=-1;
   SIG_IGN:=-1;
 end;
 end;
 
 
 
 
-function SIG_DFL(x:longint):longint;[public,alias : '___djgpp_SIG_DFL'];
+function SIG_DFL(x:longint):longint;cdecl;[public,alias : '___djgpp_SIG_DFL'];
 begin
 begin
   SIG_DFL:=0;
   SIG_DFL:=0;
 end;
 end;
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
-function signal(sig : longint;func : SignalHandler) : SignalHandler;
+function signal(sig : longint;func : SignalHandler) : SignalHandler;cdecl;
 var
 var
   temp : SignalHandler;
   temp : SignalHandler;
 begin
 begin
@@ -713,7 +748,7 @@ begin
      errln('');
      errln('');
 end;
 end;
 
 
-function _raise(sig : longint) : longint;
+function _raise(sig : longint) : longint;cdecl;
 var
 var
   temp : SignalHandler;
   temp : SignalHandler;
 begin
 begin
@@ -1009,7 +1044,7 @@ end;
 var
 var
   _os_trueversion : word;external name '__os_trueversion';
   _os_trueversion : word;external name '__os_trueversion';
 
 
-procedure djgpp_exception_processor;[public,alias : '___djgpp_exception_processor'];
+procedure djgpp_exception_processor;cdecl;[public,alias : '___djgpp_exception_processor'];
 var
 var
   sig : longint;
   sig : longint;
 begin
 begin
@@ -1071,7 +1106,7 @@ var
   v2prt0_exceptions_on : longbool;external name '_v2prt0_exceptions_on';
   v2prt0_exceptions_on : longbool;external name '_v2prt0_exceptions_on';
 
 
 
 
-procedure djgpp_exception_toggle;
+procedure djgpp_exception_toggle;cdecl;
 [public,alias : '___djgpp_exception_toggle'];
 [public,alias : '___djgpp_exception_toggle'];
 var
 var
   _except : tseginfo;
   _except : tseginfo;
@@ -1161,7 +1196,7 @@ begin
 end;
 end;
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
-function dpmi_set_coprocessor_emulation(flag : longint) : longint;
+function dpmi_set_coprocessor_emulation(flag : longint) : longint;cdecl;
 var
 var
   res : longint;
   res : longint;
 begin
 begin
@@ -1189,7 +1224,7 @@ var
 const
 const
   STUBINFO_END = $54;
   STUBINFO_END = $54;
 
 
-procedure __maybe_fix_w2k_ntvdm_bug;[public,alias : '___maybe_fix_w2k_ntvdm_bug'];
+procedure __maybe_fix_w2k_ntvdm_bug;cdecl;[public,alias : '___maybe_fix_w2k_ntvdm_bug'];
 var
 var
   psp_sel : word;
   psp_sel : word;
 begin
 begin
@@ -1221,13 +1256,13 @@ begin
 end;
 end;
 
 
 
 
-procedure dpmiexcp_exit{(status : longint)};[public,alias : 'excep_exit'];
+procedure dpmiexcp_exit{(status : longint)};cdecl;[public,alias : 'excep_exit'];
 { We need to restore hardware interrupt handlers even if somebody calls
 { We need to restore hardware interrupt handlers even if somebody calls
   `_exit' directly, or else we crash the machine in nested programs.
   `_exit' directly, or else we crash the machine in nested programs.
   We only toggle the handlers if the original keyboard handler is intact
   We only toggle the handlers if the original keyboard handler is intact
   (otherwise, they might have already toggled them). }
   (otherwise, they might have already toggled them). }
 begin
 begin
-{
+(*
 void __maybe_fix_w2k_ntvdm_bug(void)
 void __maybe_fix_w2k_ntvdm_bug(void)
   if (_osmajor == 5 && _get_dos_version(1) == 0x532) /* Windows NT, 2000 or XP? */
   if (_osmajor == 5 && _get_dos_version(1) == 0x532) /* Windows NT, 2000 or XP? */
   {
   {
@@ -1249,7 +1284,7 @@ void __maybe_fix_w2k_ntvdm_bug(void)
                   : "g" (_stubinfo->psp_selector) /* input */
                   : "g" (_stubinfo->psp_selector) /* input */
                   : "ax", "bx" );                 /* regs */
                   : "ax", "bx" );                 /* regs */
   }
   }
-}
+*)
   if (exceptions_on) then
   if (exceptions_on) then
     djgpp_exception_toggle;
     djgpp_exception_toggle;
   _exception_exit:=nil;
   _exception_exit:=nil;
@@ -1264,14 +1299,14 @@ end;
   is already present in v2prt0.as  PM}
   is already present in v2prt0.as  PM}
 
 
 { used by dos.pp for swap vectors }
 { used by dos.pp for swap vectors }
-procedure dpmi_swap_in;[public,alias : 'swap_in'];
+procedure dpmi_swap_in;cdecl;[public,alias : 'swap_in'];
 begin
 begin
   if not (exceptions_on) then
   if not (exceptions_on) then
    djgpp_exception_toggle;
    djgpp_exception_toggle;
 end;
 end;
 
 
 
 
-procedure dpmi_swap_out;[public,alias : 'swap_out'];
+procedure dpmi_swap_out;cdecl;[public,alias : 'swap_out'];
 begin
 begin
   if (exceptions_on) then
   if (exceptions_on) then
    djgpp_exception_toggle;
    djgpp_exception_toggle;
@@ -1389,7 +1424,7 @@ begin
 end;
 end;
 
 
 
 
-procedure djgpp_exception_setup;
+procedure djgpp_exception_setup;cdecl;
 [public,alias : '___djgpp_exception_setup'];
 [public,alias : '___djgpp_exception_setup'];
 var
 var
   temp_kbd,
   temp_kbd,
@@ -1463,7 +1498,7 @@ end;
 {$endif CREATE_C_FUNCTIONS}
 {$endif CREATE_C_FUNCTIONS}
 
 
 
 
-function djgpp_set_ctrl_c(enable : boolean) : boolean;
+function djgpp_set_ctrl_c(enable : boolean) : boolean;cdecl;
 begin
 begin
   djgpp_set_ctrl_c:=(djgpp_hwint_flags and 1)=0;
   djgpp_set_ctrl_c:=(djgpp_hwint_flags and 1)=0;
   if enable then
   if enable then
@@ -1515,7 +1550,7 @@ end.
 {$else IN_SYSTEM}
 {$else IN_SYSTEM}
 const
 const
   FPU_ControlWord : word = $1332;
   FPU_ControlWord : word = $1332;
-function HandleException(sig : longint) : longint;
+function HandleException(sig : longint) : longint;cdecl;
 var
 var
   truesig : longint;
   truesig : longint;
   ErrorOfSig : longint;
   ErrorOfSig : longint;

+ 1 - 1
rtl/go32v2/emu387.pp

@@ -67,7 +67,7 @@ begin
 end;
 end;
 
 
 
 
-function nofpsig( sig : longint) : longint;
+function nofpsig( sig : longint) : longint;cdecl;
 const
 const
   last_eip : longint = 0;
   last_eip : longint = 0;
 var
 var

+ 2 - 2
rtl/go32v2/profile.pp

@@ -195,7 +195,7 @@ var
   doublecall,
   doublecall,
   reload          : longint; {=0}
   reload          : longint; {=0}
 
 
-function mcount_tick(x : longint) : longint;
+function mcount_tick(x : longint) : longint;cdecl;
 var
 var
   bin : longint;
   bin : longint;
 begin
 begin
@@ -220,7 +220,7 @@ end;
 var
 var
   ___djgpp_timer_countdown:longint;external name '___djgpp_timer_countdown';
   ___djgpp_timer_countdown:longint;external name '___djgpp_timer_countdown';
 
 
-function timer(x : longint) : longint;
+function timer(x : longint) : longint;cdecl;
 begin
 begin
    if reload>0 then
    if reload>0 then
     ___djgpp_timer_countdown:=RELOAD;
     ___djgpp_timer_countdown:=RELOAD;