浏览代码

* regcall updates (untested)

peter 21 年之前
父节点
当前提交
e7c99a0e41
共有 4 个文件被更改,包括 113 次插入49 次删除
  1. 4 4
      rtl/os2/Makefile
  2. 26 19
      rtl/os2/doscalls.pas
  3. 7 3
      rtl/os2/ports.pas
  4. 76 23
      rtl/os2/system.pas

+ 4 - 4
rtl/os2/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 1.1 [2003/10/28]
+# Don't edit, this file is generated by FPCMake Version 1.1 [2003/11/01]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom
 MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom
@@ -1376,7 +1376,7 @@ crt$(PPUEXT) : crt.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
 objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 objects$(PPUEXT) : $(INC)/objects.pp dos$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
 printer$(PPUEXT) : printer.pas $(INC)/textrec.inc $(SYSTEMUNIT)$(PPUEXT)
 sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
 sysutils$(PPUEXT) : sysutils.pp $(wildcard $(OBJPASDIR)/sysutils/*.inc) \
-		    objpas$(PPUEXT) dos$(PPUEXT) doscalls$(PPUEXT)
+		    objpas$(PPUEXT) dos$(PPUEXT) doscalls$(PPUEXT) sysconst$(PPUEXT)
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
 	$(COMPILER) -Fi$(OBJPASDIR)/sysutils sysutils.pp
 classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
 classes$(PPUEXT) : classes.pp $(wildcard $(OBJPASDIR)/classes/*.inc) \
 		   sysutils$(PPUEXT) typinfo$(PPUEXT)
 		   sysutils$(PPUEXT) typinfo$(PPUEXT)
@@ -1391,8 +1391,8 @@ varutils$(PPUEXT) : $(OBJPASDIR)/cvarutil.inc $(OBJPASDIR)/varutils.inc \
 types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 types$(PPUEXT) : $(OBJPASDIR/types.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $(OBJPASDIR)/types.pp
 	$(COMPILER) $(OBJPASDIR)/types.pp
 rtlconst$(PPUEXT) : $(OBJPASDIR)/rtlconst.pp
 rtlconst$(PPUEXT) : $(OBJPASDIR)/rtlconst.pp
-        $(COMPILER) $(OBJPASDIR)/rtlconst.pp
-sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT)
+	$(COMPILER) $(OBJPASDIR)/rtlconst.pp
+sysconst$(PPUEXT) : $(OBJPASDIR)/sysconst.pp objpas$(PPUEXT) $(SYSTEMUNIT)$(PPUEXT)
 	$(COMPILER) $(OBJPASDIR)/sysconst.pp
 	$(COMPILER) $(OBJPASDIR)/sysconst.pp
 dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp
 dateutil$(PPUEXT) : $(OBJPASDIR)/dateutil.pp
 	$(COMPILER) $(OBJPASDIR)/dateutil.pp
 	$(COMPILER) $(OBJPASDIR)/dateutil.pp

+ 26 - 19
rtl/os2/doscalls.pas

@@ -79,7 +79,7 @@ function DosCreateThread (var TID: longint; Address: TThreadEntry;
 (* Overloaded version for compatibility. *)
 (* Overloaded version for compatibility. *)
 function DosCreateThread (var TID: longint; Address: pointer;
 function DosCreateThread (var TID: longint; Address: pointer;
                    AParam: Pointer; Flags, StackSize: longint): longint; cdecl;
                    AParam: Pointer; Flags, StackSize: longint): longint; cdecl;
-                       
+
 
 
 {Suspend a running thread.}
 {Suspend a running thread.}
 function DosSuspendThread(TID:longint):longint; cdecl;
 function DosSuspendThread(TID:longint):longint; cdecl;
@@ -316,7 +316,7 @@ const   DBG_C_Null              = 0;       { Null                         }
         DBG_X_FIRST_CHANCE        = 1;
         DBG_X_FIRST_CHANCE        = 1;
         DBG_X_LAST_CHANCE         = 2;
         DBG_X_LAST_CHANCE         = 2;
         DBG_X_STACK_INVALID       = 3;
         DBG_X_STACK_INVALID       = 3;
-     
+
         DBG_W_Local               = $0000001;
         DBG_W_Local               = $0000001;
         DBG_W_Global              = $0000002;
         DBG_W_Global              = $0000002;
         DBG_W_Execute             = $00010000;
         DBG_W_Execute             = $00010000;
@@ -328,7 +328,7 @@ for writing debuggers.}
 function DosDebug (DebugBuf: PDbgBuf):longint; cdecl;
 function DosDebug (DebugBuf: PDbgBuf):longint; cdecl;
 
 
 function DosDebug (var APDbgBuf: TDbgBuf): longint; cdecl;
 function DosDebug (var APDbgBuf: TDbgBuf): longint; cdecl;
-                  
+
 { codeTerminate values (also passed to ExitList routines) }
 { codeTerminate values (also passed to ExitList routines) }
 const   TC_exit         = 0;
 const   TC_exit         = 0;
         TC_harderror    = 1;
         TC_harderror    = 1;
@@ -377,7 +377,7 @@ const   deSync          = 0;    {Wait until program terminates.}
         EXEC_BACKGROUND    =deBackground;
         EXEC_BACKGROUND    =deBackground;
         EXEC_LOAD          =deSuspended;
         EXEC_LOAD          =deSuspended;
         EXEC_ASYNCRESULTDB =deAsyncResultDb;
         EXEC_ASYNCRESULTDB =deAsyncResultDb;
-        
+
 type    TResultCodes=record
 type    TResultCodes=record
             TerminateReason,        {0 = Normal termionation.
             TerminateReason,        {0 = Normal termionation.
                                      1 = Critical error.
                                      1 = Critical error.
@@ -654,7 +654,7 @@ type    TgEA = record
 const       doOpened        =  1;
 const       doOpened        =  1;
             doCreated       =  2;
             doCreated       =  2;
             doOverwritten   =  3;
             doOverwritten   =  3;
-            
+
             FILE_EXISTED    =  doOpened;
             FILE_EXISTED    =  doOpened;
             FILE_CREATED    =  doCreated;
             FILE_CREATED    =  doCreated;
             FILE_TRUNCATED  =  doOverwritten;
             FILE_TRUNCATED  =  doOverwritten;
@@ -669,11 +669,11 @@ const       doFail          =  0;
                 contents : Creation flags is 10 hex not 10 dec.
                 contents : Creation flags is 10 hex not 10 dec.
             *)
             *)
             doCreate        = 16;
             doCreate        = 16;
-            
+
             FILE_OPEN       = doOpen;
             FILE_OPEN       = doOpen;
             FILE_TRUNCATE   = doOverwrite;
             FILE_TRUNCATE   = doOverwrite;
             FILE_CREATE     = doCreate;
             FILE_CREATE     = doCreate;
-            
+
 {    this nibble applies if file already exists                      xxxx }
 {    this nibble applies if file already exists                      xxxx }
       OPEN_ACTION_FAIL_IF_EXISTS     =doFail;       { ---- ---- ---- 0000 }
       OPEN_ACTION_FAIL_IF_EXISTS     =doFail;       { ---- ---- ---- 0000 }
       OPEN_ACTION_OPEN_IF_EXISTS     =doOpen;       { ---- ---- ---- 0001 }
       OPEN_ACTION_OPEN_IF_EXISTS     =doOpen;       { ---- ---- ---- 0001 }
@@ -713,16 +713,16 @@ const       doRead          =     0;
       OPEN_FLAGS_NO_LOCALITY         =$0000;        { ---- -000 ---- ---- }
       OPEN_FLAGS_NO_LOCALITY         =$0000;        { ---- -000 ---- ---- }
       OPEN_FLAGS_SEQUENTIAL          =doSequential; { ---- -001 ---- ---- }
       OPEN_FLAGS_SEQUENTIAL          =doSequential; { ---- -001 ---- ---- }
       OPEN_FLAGS_RANDOM              =doRandom;     { ---- -010 ---- ---- }
       OPEN_FLAGS_RANDOM              =doRandom;     { ---- -010 ---- ---- }
-      OPEN_FLAGS_RANDOMSEQUENTIAL    =doSequential 
+      OPEN_FLAGS_RANDOMSEQUENTIAL    =doSequential
                                    or doRandom;     { ---- -011 ---- ---- }
                                    or doRandom;     { ---- -011 ---- ---- }
       OPEN_FLAGS_NO_CACHE            =doNoCache;    { ---1 ---- ---- ---- }
       OPEN_FLAGS_NO_CACHE            =doNoCache;    { ---1 ---- ---- ---- }
       OPEN_FLAGS_FAIL_ON_ERROR       =doFailOnErr;  { --1- ---- ---- ---- }
       OPEN_FLAGS_FAIL_ON_ERROR       =doFailOnErr;  { --1- ---- ---- ---- }
       OPEN_FLAGS_WRITE_THROUGH       =doWriteThru;  { -1-- ---- ---- ---- }
       OPEN_FLAGS_WRITE_THROUGH       =doWriteThru;  { -1-- ---- ---- ---- }
       OPEN_FLAGS_DASD                =doDASD;       { 1--- ---- ---- ---- }
       OPEN_FLAGS_DASD                =doDASD;       { 1--- ---- ---- ---- }
-      
+
       OPEN_FLAGS_NONSPOOLED          =$00040000;
       OPEN_FLAGS_NONSPOOLED          =$00040000;
       OPEN_FLAGS_PROTECTED_HANDLE    =$40000000;
       OPEN_FLAGS_PROTECTED_HANDLE    =$40000000;
-            
+
 
 
 { Open a file.
 { Open a file.
 
 
@@ -2826,7 +2826,7 @@ const
 { Logging constants }
 { Logging constants }
   ErrLog_Service = 1;
   ErrLog_Service = 1;
   ErrLog_Version = 1;
   ErrLog_Version = 1;
- 
+
 { LogRecord status bits }
 { LogRecord status bits }
   lf_Bit_ProcName = 1;    {used to indicate whether the current error log}
   lf_Bit_ProcName = 1;    {used to indicate whether the current error log}
                           {entry packet contains space in which the error}
                           {entry packet contains space in which the error}
@@ -2850,7 +2850,7 @@ const
   lf_Bit_GetStatus = 64;
   lf_Bit_GetStatus = 64;
   lf_Bit_Register = 128;
   lf_Bit_Register = 128;
   lf_Bit_Remote_Fail = 256;
   lf_Bit_Remote_Fail = 256;
- 
+
 type
 type
 { Log entry record header for OS/2 2.x and above used    }
 { Log entry record header for OS/2 2.x and above used    }
 { by 32-bit device drivers and callers of LogAddEntries. }
 { by 32-bit device drivers and callers of LogAddEntries. }
@@ -2885,7 +2885,7 @@ type
   end;
   end;
   LogRecord = TLogRecord;
   LogRecord = TLogRecord;
   PLogRecord = ^TLogRecord;
   PLogRecord = ^TLogRecord;
- 
+
 { Format of buffer sent to LogAddEntries }
 { Format of buffer sent to LogAddEntries }
   TLogEntryRec = record
   TLogEntryRec = record
     Version: word;                      {this version is 1}
     Version: word;                      {this version is 1}
@@ -2894,7 +2894,7 @@ type
   end;
   end;
   LogEntryRec = TLogEntryRec;
   LogEntryRec = TLogEntryRec;
   PLogEntryRec = ^TLogEntryRec;
   PLogEntryRec = ^TLogEntryRec;
- 
+
 { Logging facility functions }
 { Logging facility functions }
 { Open a connection to the system error logging facility (through the system
 { Open a connection to the system error logging facility (through the system
   logging service device driver). }
   logging service device driver). }
@@ -2914,9 +2914,9 @@ function LogClose (Handle: cardinal): longint; cdecl;
 { Parameters:
 { Parameters:
   Handle - handle returned by previous LogOpen
   Handle - handle returned by previous LogOpen
   Service - specifies the class of logging facility:
   Service - specifies the class of logging facility:
-    0 ........... reserved 
+    0 ........... reserved
     1 ........... error logging
     1 ........... error logging
-    2 - $FFFF ... reserved 
+    2 - $FFFF ... reserved
   LogEntries - buffer containing a variable length error log entry. The first
   LogEntries - buffer containing a variable length error log entry. The first
     word of the buffer contains the number of packets in the error log entry.
     word of the buffer contains the number of packets in the error log entry.
     Multiple error log packets (LogRec structure) can be included within
     Multiple error log packets (LogRec structure) can be included within
@@ -4346,14 +4346,14 @@ procedure MagicHeaderEnd; assembler; forward;
 {$ASMMODE INTEL}
 {$ASMMODE INTEL}
 
 
 {start of _MSGSEG32 segment}
 {start of _MSGSEG32 segment}
-procedure MagicHeaderStart; assembler;               
+procedure MagicHeaderStart; assembler;
 asm
 asm
   db $0FF
   db $0FF
   db $4D,$53,$47,$53,$45,$47,$33,$32, 0       //'MSGSEG32'
   db $4D,$53,$47,$53,$45,$47,$33,$32, 0       //'MSGSEG32'
   dd $8001
   dd $8001
   dd MAGICHEADEREND
   dd MAGICHEADEREND
 end;
 end;
-    
+
 function DosGetMessage(Table:PInsertTable;TableSize:longint;Buf:PChar;
 function DosGetMessage(Table:PInsertTable;TableSize:longint;Buf:PChar;
                        BufSize,MsgNumber:longint;FileName:PChar;
                        BufSize,MsgNumber:longint;FileName:PChar;
                        var MsgSize:longint):longint;
                        var MsgSize:longint):longint;
@@ -4607,13 +4607,17 @@ external 'DOSCALLS' index 425;
 {$ASMMODE INTEL}
 {$ASMMODE INTEL}
 function SelToFlat (AFarPtr: TFarPtr): pointer; assembler;
 function SelToFlat (AFarPtr: TFarPtr): pointer; assembler;
  asm
  asm
+{$ifndef REGCALL}
   mov eax, AFarPtr
   mov eax, AFarPtr
+{$endif}
   call DosSelToFlat
   call DosSelToFlat
  end;
  end;
 
 
 function FlatToSel (APtr: pointer): cardinal; assembler;
 function FlatToSel (APtr: pointer): cardinal; assembler;
  asm
  asm
+{$ifndef REGCALL}
   mov eax, APtr
   mov eax, APtr
+{$endif}
   call DosFlatToSel
   call DosFlatToSel
  end;
  end;
 
 
@@ -4709,7 +4713,10 @@ external 'DOSCALLS' index 582;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2003-11-02 00:25:09  hajny
+  Revision 1.24  2003-12-04 21:22:38  peter
+    * regcall updates (untested)
+
+  Revision 1.23  2003/11/02 00:25:09  hajny
     * TFileFindBuf3 corrected
     * TFileFindBuf3 corrected
 
 
   Revision 1.22  2003/11/01 20:41:47  hajny
   Revision 1.22  2003/11/01 20:41:47  hajny

+ 7 - 3
rtl/os2/ports.pas

@@ -24,14 +24,15 @@
      for all EMX applications until EMX.DLL is unloaded from memory (i.e.
      for all EMX applications until EMX.DLL is unloaded from memory (i.e.
      all applications using this library finish).
      all applications using this library finish).
 *)
 *)
-    
+
 unit Ports;
 unit Ports;
 
 
 { This unit uses classes so ObjFpc mode is required. }
 { This unit uses classes so ObjFpc mode is required. }
 {$Mode ObjFpc}
 {$Mode ObjFpc}
+{$calling StdCall}
 
 
 interface
 interface
-    
+
 type
 type
  TPort = class
  TPort = class
   protected
   protected
@@ -146,7 +147,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2003-10-18 16:58:39  hajny
+  Revision 1.5  2003-12-04 21:22:38  peter
+    * regcall updates (untested)
+
+  Revision 1.4  2003/10/18 16:58:39  hajny
     * stdcall fixes again
     * stdcall fixes again
 
 
   Revision 1.3  2003/10/07 21:26:35  hajny
   Revision 1.3  2003/10/07 21:26:35  hajny

+ 76 - 23
rtl/os2/system.pas

@@ -1062,30 +1062,80 @@ begin
 *)
 *)
 end;
 end;
 
 
+
 function strcopy(dest,source : pchar) : pchar;assembler;
 function strcopy(dest,source : pchar) : pchar;assembler;
+var
+  saveeax,saveesi,saveedi : longint;
 asm
 asm
-        pushl %esi
-        pushl %edi
-        cld
-        movl 12(%ebp),%edi
-        movl $0xffffffff,%ecx
-        xorb %al,%al
-        repne
-        scasb
-        not %ecx
-        movl 8(%ebp),%edi
-        movl 12(%ebp),%esi
-        movl %ecx,%eax
-        shrl $2,%ecx
-        rep
-        movsl
-        movl %eax,%ecx
-        andl $3,%ecx
-        rep
-        movsb
-        movl 8(%ebp),%eax
-        popl %edi
-        popl %esi
+        movl    %edi,saveedi
+        movl    %esi,saveesi
+{$ifdef REGCALL}
+        movl    %eax,saveeax
+        movl    %edx,%edi
+{$else}
+        movl    source,%edi
+{$endif}
+        testl   %edi,%edi
+        jz      .LStrCopyDone
+        leal    3(%edi),%ecx
+        andl    $-4,%ecx
+        movl    %edi,%esi
+        subl    %edi,%ecx
+{$ifdef REGCALL}
+        movl    %eax,%edi
+{$else}
+        movl    dest,%edi
+{$endif}
+        jz      .LStrCopyAligned
+.LStrCopyAlignLoop:
+        movb    (%esi),%al
+        incl    %edi
+        incl    %esi
+        testb   %al,%al
+        movb    %al,-1(%edi)
+        jz      .LStrCopyDone
+        decl    %ecx
+        jnz     .LStrCopyAlignLoop
+        .balign  16
+.LStrCopyAligned:
+        movl    (%esi),%eax
+        movl    %eax,%edx
+        leal    0x0fefefeff(%eax),%ecx
+        notl    %edx
+        addl    $4,%esi
+        andl    %edx,%ecx
+        andl    $0x080808080,%ecx
+        jnz     .LStrCopyEndFound
+        movl    %eax,(%edi)
+        addl    $4,%edi
+        jmp     .LStrCopyAligned
+.LStrCopyEndFound:
+        testl   $0x0ff,%eax
+        jz      .LStrCopyByte
+        testl   $0x0ff00,%eax
+        jz      .LStrCopyWord
+        testl   $0x0ff0000,%eax
+        jz      .LStrCopy3Bytes
+        movl    %eax,(%edi)
+        jmp     .LStrCopyDone
+.LStrCopy3Bytes:
+        xorb     %dl,%dl
+        movw     %ax,(%edi)
+        movb     %dl,2(%edi)
+        jmp     .LStrCopyDone
+.LStrCopyWord:
+        movw    %ax,(%edi)
+        jmp     .LStrCopyDone
+.LStrCopyByte:
+        movb    %al,(%edi)
+.LStrCopyDone:
+{$ifdef REGCALL}
+        movl    saveeax,%eax
+{$else}
+        movl    dest,%eax
+{$endif}
+        movl    saveedi,%edi
+        movl    saveesi,%esi
 end;
 end;
 
 
 
 
@@ -1388,7 +1438,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.60  2003-11-23 07:21:16  yuri
+  Revision 1.61  2003-12-04 21:22:38  peter
+    * regcall updates (untested)
+
+  Revision 1.60  2003/11/23 07:21:16  yuri
   * native heap
   * native heap
 
 
   Revision 1.59  2003/11/19 18:21:11  yuri
   Revision 1.59  2003/11/19 18:21:11  yuri