Browse Source

* from Yury Sidorov:
+ Added new target WinCE for i386 (to be able compile and run programs in WinCE emulator)
+ Exceptions work now.
* System unit seems to be fully working

git-svn-id: trunk@597 -

florian 20 years ago
parent
commit
0a58f18502
7 changed files with 663 additions and 329 deletions
  1. 2 1
      .gitattributes
  2. 14 18
      rtl/win/sysos.inc
  3. 1 1
      rtl/win/systhrd.inc
  4. 9 2
      rtl/wince/Makefile.fpc
  5. 15 3
      rtl/wince/arm/wprt0.as
  6. 56 0
      rtl/wince/i386/wprt0.as
  7. 566 304
      rtl/wince/system.pp

+ 2 - 1
.gitattributes

@@ -4181,8 +4181,9 @@ rtl/win64/Makefile.fpc svneol=native#text/plain
 rtl/win64/system.pp svneol=native#text/plain
 rtl/wince/Makefile svneol=native#text/plain
 rtl/wince/Makefile.fpc svneol=native#text/plain
+rtl/wince/arm/wprt0.as svneol=native#text/plain
+rtl/wince/i386/wprt0.as svneol=native#text/plain
 rtl/wince/system.pp svneol=native#text/plain
-rtl/wince/wprt0.as svneol=native#text/plain
 rtl/x86_64/int64p.inc svneol=native#text/plain
 rtl/x86_64/makefile.cpu -text
 rtl/x86_64/math.inc svneol=native#text/plain

+ 14 - 18
rtl/win/sysos.inc

@@ -187,13 +187,11 @@ threadvar
      stdcall;external KernelDLL name 'GetStartupInfoA';
    function GetStdHandle(nStdHandle:DWORD):THANDLE;
      stdcall;external KernelDLL name 'GetStdHandle';
-{$endif WINCE}
 
    { command line/enviroment functions }
    function GetCommandLine : pchar;
-     stdcall;external KernelDLL name 'GetCommandLine' + ApiSuffix;
+     stdcall;external KernelDLL name 'GetCommandLineA';
 
-{$ifndef WINCE}
   function GetCurrentProcessId:DWORD;
     stdcall; external KernelDLL name 'GetCurrentProcessId';
 
@@ -217,37 +215,35 @@ threadvar
      stdcall;external KernelDLL name 'ReadFile';
    function CloseHandle(h : thandle) : longint;
      stdcall;external KernelDLL name 'CloseHandle';
-   function DeleteFile(p : pchar) : longint;
-     stdcall;external KernelDLL name 'DeleteFile' + ApiSuffix;
-   function MoveFile(old,_new : pchar) : longint;
-     stdcall;external KernelDLL name 'MoveFile' + ApiSuffix;
    function SetFilePointer(l1,l2 : thandle;l3 : pointer;l4 : longint) : longint;
      stdcall;external KernelDLL name 'SetFilePointer';
    function GetFileSize(h:thandle;p:pointer) : longint;
      stdcall;external KernelDLL name 'GetFileSize';
-   function CreateFile(lpFileName:pchar; dwDesiredAccess:DWORD; dwShareMode:DWORD;
-                       lpSecurityAttributes:PSECURITYATTRIBUTES; dwCreationDisposition:DWORD;
-                       dwFlagsAndAttributes:DWORD; hTemplateFile:DWORD):longint;
-     stdcall;external KernelDLL name 'CreateFile' + ApiSuffix;
    function SetEndOfFile(h : thandle) : longbool;
      stdcall;external KernelDLL name 'SetEndOfFile';
 {$ifndef WINCE}
    function GetFileType(Handle:thandle):DWord;
      stdcall;external KernelDLL name 'GetFileType';
-{$endif WINCE}
    function GetFileAttributes(p : pchar) : dword;
-     stdcall;external KernelDLL name 'GetFileAttributes' + ApiSuffix;
+     stdcall;external KernelDLL name 'GetFileAttributesA';
+   function DeleteFile(p : pchar) : longint;
+     stdcall;external KernelDLL name 'DeleteFileA';
+   function MoveFile(old,_new : pchar) : longint;
+     stdcall;external KernelDLL name 'MoveFileA';
+   function CreateFile(lpFileName:pchar; dwDesiredAccess:DWORD; dwShareMode:DWORD;
+                       lpSecurityAttributes:PSECURITYATTRIBUTES; dwCreationDisposition:DWORD;
+                       dwFlagsAndAttributes:DWORD; hTemplateFile:DWORD):longint;
+     stdcall;external KernelDLL name 'CreateFileA';
 
    { Directory }
    function CreateDirectory(name : pointer;sec : pointer) : longbool;
-     stdcall;external KernelDLL name 'CreateDirectory' + ApiSuffix;
+     stdcall;external KernelDLL name 'CreateDirectoryA';
    function RemoveDirectory(name:pointer):longbool;
-     stdcall;external KernelDLL name 'RemoveDirectory' + ApiSuffix;
-{$ifndef WINCE}
+     stdcall;external KernelDLL name 'RemoveDirectoryA';
    function SetCurrentDirectory(name : pointer) : longbool;
-     stdcall;external KernelDLL name 'SetCurrentDirectory' + ApiSuffix;
+     stdcall;external KernelDLL name 'SetCurrentDirectoryA';
    function GetCurrentDirectory(bufsize : longint;name : pchar) : longbool;
-     stdcall;external KernelDLL name 'GetCurrentDirectory' + ApiSuffix;
+     stdcall;external KernelDLL name 'GetCurrentDirectoryA';
 {$endif WINCE}
 
    Procedure Errno2InOutRes;

+ 1 - 1
rtl/win/systhrd.inc

@@ -50,8 +50,8 @@ function  TerminateThread  (threadHandle : THandle; var exitCode : dword) : bool
 function  WaitForSingleObject (hHandle : THandle;Milliseconds: dword): dword; stdcall;external KernelDLL name 'WaitForSingleObject';
 function  WinThreadSetPriority (threadHandle : THandle; Prio: longint): boolean; stdcall;external KernelDLL name 'SetThreadPriority';
 function  WinThreadGetPriority (threadHandle : THandle): LongInt; stdcall;external KernelDLL name 'GetThreadPriority';
-function  CreateEvent(lpEventAttributes:pointer;bManualReset:longbool;bInitialState:longbool;lpName:pchar): THandle; stdcall; external KernelDLL name 'CreateEvent' + ApiSuffix;
 {$ifndef WINCE}
+function  CreateEvent(lpEventAttributes:pointer;bManualReset:longbool;bInitialState:longbool;lpName:pchar): THandle; stdcall; external KernelDLL name 'CreateEventA';
 function  ResetEvent(hEvent:THandle):LONGBOOL; stdcall; external KernelDLL name 'ResetEvent';
 function  SetEvent(hEvent:THandle):LONGBOOL; stdcall; external KernelDLL name 'SetEvent';
 {$endif WINCE}

+ 9 - 2
rtl/wince/Makefile.fpc

@@ -86,8 +86,15 @@ SYSDEPS=$(SYSINCDEPS) $(SYSCPUDEPS)
 # Loaders
 #
 
-wprt0$(OEXT) : $(PRT0).as
-        $(AS) -o $(UNITTARGETDIRPREFIX)wprt0$(OEXT) $(PRT0).as
+#
+# Loaders
+#
+
+wprt0$(OEXT) : $(CPU_TARGET)/$(PRT0).as
+        $(AS) $(ASTARGET) -o $(UNITTARGETDIRPREFIX)wprt0$(OEXT) $(CPU_TARGET)/$(PRT0).as
+        
+#wprt0$(OEXT) : $(PRT0).as
+#        $(AS) -o $(UNITTARGETDIRPREFIX)wprt0$(OEXT) $(PRT0).as
 
 gprt0$(OEXT) : gprt0.as
 

+ 15 - 3
rtl/wince/wprt0.as → rtl/wince/arm/wprt0.as

@@ -4,7 +4,13 @@ Written by Yury Sidorov 2005
 */
 
 .section .text
-  .balign 4
+@ for kernel exception handler, must be directly before ___EH_CODE_START__
+__EH_HANDLER__:
+	.word _ARM_ExceptionHandler
+	.word 0
+
+__EH_CODE_START__:
+
 .globl mainCRTStartup
 mainCRTStartup:
 .globl _mainCRTStartup
@@ -24,8 +30,8 @@ do_start:
 
 .globl asm_exit
 asm_exit:
-  eor   r0,r0,r0
-  bl	exitthread
+  mov r0,#0
+  bl exitthread
   
 _PISCONSOLE:
   .long U_SYSTEM_ISCONSOLE
@@ -65,3 +71,9 @@ exitthread:
 .section .idata$7
 .L6:
 	.ascii	"coredll.dll\000"
+
+@ for kernel exception handler
+	.section .pdata
+	.word __EH_CODE_START__
+@ max 22 bits for number of instructions
+	.word 0xc0000002 | (0xFFFFF << 8)

+ 56 - 0
rtl/wince/i386/wprt0.as

@@ -0,0 +1,56 @@
+//Startup code for WIN32 port of Free Pascal
+//Written by P.Ozerski 1998
+// modified by Pierre Muller
+     .text
+     .globl _mainCRTStartup
+_mainCRTStartup:
+     movb   $1,U_SYSTEM_ISCONSOLE
+     call   _FPC_EXE_Entry
+     .globl _WinMainCRTStartup
+_WinMainCRTStartup:
+     movb   $0,U_SYSTEM_ISCONSOLE
+     call   _FPC_EXE_Entry
+     
+     .globl asm_exit
+asm_exit:     
+    pushl   %eax
+	call	exitprocess
+
+.text
+.globl	exitprocess
+exitprocess:
+	jmp	*.L10
+	.balign 4,144
+	
+.text
+	.balign 4,144
+
+.section .idata$2
+	.rva	.L7
+	.long	0,0
+	.rva	.L6
+	.rva	.L8
+
+.section .idata$4
+.L7:
+	.rva	.L9
+	.long	0
+
+.section .idata$5
+.L8:
+	
+
+.section .idata$5
+.L10:
+	.rva	.L9
+	.long	0
+
+.section .idata$6
+.L9:
+	.short	0
+	.ascii	"ExitThread\000"
+	.balign 2,0
+
+.section .idata$7
+.L6:
+	.ascii	"coredll.dll\000"

File diff suppressed because it is too large
+ 566 - 304
rtl/wince/system.pp


Some files were not shown because too many files changed in this diff