From 4236bee6f1832b11845869ffe99cb8ea0a96a230 Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 25 Jun 2021 21:15:08 +0000 Subject: [PATCH] * win64: factored out cpu specific code git-svn-id: trunk@49561 - --- .gitattributes | 2 + rtl/win64/Makefile | 212 +++++++++++++++++------------------ rtl/win64/Makefile.fpc | 2 +- rtl/win64/aarch64/cpuwin.inc | 53 +++++++++ rtl/win64/system.pp | 154 +------------------------ rtl/win64/x86_64/cpuwin.inc | 133 ++++++++++++++++++++++ 6 files changed, 299 insertions(+), 257 deletions(-) create mode 100644 rtl/win64/aarch64/cpuwin.inc create mode 100644 rtl/win64/x86_64/cpuwin.inc diff --git a/.gitattributes b/.gitattributes index 9df09bf8af..a5fe7c459c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12418,6 +12418,7 @@ rtl/win32/windows.pp svneol=native#text/plain rtl/win32/winsysut.pp svneol=native#text/plain rtl/win64/Makefile svneol=native#text/plain rtl/win64/Makefile.fpc svneol=native#text/plain +rtl/win64/aarch64/cpuwin.inc svneol=native#text/plain rtl/win64/buildrtl.lpi svneol=native#text/plain rtl/win64/buildrtl.pp svneol=native#text/plain rtl/win64/classes.pp svneol=native#text/plain @@ -12427,6 +12428,7 @@ rtl/win64/signals.pp svneol=native#text/plain rtl/win64/sysinit.pp svneol=native#text/plain rtl/win64/system.pp svneol=native#text/plain rtl/win64/windows.pp svneol=native#text/plain +rtl/win64/x86_64/cpuwin.inc svneol=native#text/plain rtl/wince/Makefile svneol=native#text/plain rtl/wince/Makefile.fpc svneol=native#text/plain rtl/wince/classes.pp svneol=native#text/plain diff --git a/rtl/win64/Makefile b/rtl/win64/Makefile index 6cf944a3c6..e393761265 100644 --- a/rtl/win64/Makefile +++ b/rtl/win64/Makefile @@ -1641,322 +1641,322 @@ endif override INSTALL_BUILDUNIT=buildrtl override INSTALL_FPCPACKAGE=y ifeq ($(FULL_TARGET),i386-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-go32v2) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-win32) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-os2) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-freebsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-beos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-haiku) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-netbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-solaris) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-netware) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-openbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-wdosx) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-darwin) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-emx) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-watcom) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-netwlibc) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-wince) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-symbian) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-nativent) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-iphonesim) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-android) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-aros) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-netbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-amiga) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-atari) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-palmos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-macosclassic) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),m68k-sinclairql) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-netbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-amiga) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-macosclassic) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-darwin) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-morphos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-wii) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc-aix) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),sparc-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),sparc-netbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),sparc-solaris) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),sparc-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-freebsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-haiku) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-netbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-solaris) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-openbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-darwin) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-win64) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-iphonesim) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-android) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-aros) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),x86_64-dragonfly) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-netbsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-palmos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-wince) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-gba) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-nds) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-symbian) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-android) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-aros) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-freertos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),arm-ios) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc64-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc64-darwin) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc64-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),powerpc64-aix) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),avr-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),armeb-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),armeb-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),mips-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),mipsel-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),mipsel-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),mipsel-android) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),mips64el-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),jvm-java) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),jvm-android) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i8086-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i8086-msdos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i8086-win16) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),aarch64-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),aarch64-freebsd) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),aarch64-darwin) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),aarch64-win64) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),aarch64-android) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),aarch64-ios) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),wasm32-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),wasm32-wasi) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),sparc64-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),riscv32-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),riscv32-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),riscv64-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),riscv64-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),xtensa-linux) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),xtensa-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),xtensa-freertos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),z80-embedded) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),z80-zxspectrum) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),z80-msxdos) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),z80-amstradcpc) -override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) +override COMPILER_INCLUDEDIR+=$(INC) $(PROCINC) $(ARCH) endif ifeq ($(FULL_TARGET),i386-linux) override COMPILER_SOURCEDIR+=$(INC) $(PROCINC) $(COMMON) $(WINDIR) diff --git a/rtl/win64/Makefile.fpc b/rtl/win64/Makefile.fpc index a5759e1ef4..450dbd524e 100644 --- a/rtl/win64/Makefile.fpc +++ b/rtl/win64/Makefile.fpc @@ -50,7 +50,7 @@ fpcdir=../.. target=win64 [compiler] -includedir=$(INC) $(PROCINC) +includedir=$(INC) $(PROCINC) $(ARCH) sourcedir=$(INC) $(PROCINC) $(COMMON) $(WINDIR) diff --git a/rtl/win64/aarch64/cpuwin.inc b/rtl/win64/aarch64/cpuwin.inc new file mode 100644 index 0000000000..5649e18abb --- /dev/null +++ b/rtl/win64/aarch64/cpuwin.inc @@ -0,0 +1,53 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 1999-2006 by Florian Klaempfl and Pavel Ozerski + member of the Free Pascal development team. + + FPC Pascal system unit aarch64 specific part for the Win64 API. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{$define FPC_SYSTEM_HAS_STACKTOP} +function StackTop: pointer; // assembler;nostackframe; +begin + result:=pointer($ffffffffffffffff); +end; + +function main_wrapper(arg: Pointer; proc: Pointer): ptrint; assembler; nostackframe; +asm + stp fp,lr,[sp, #-16]! +.seh_savefplr_x -16 +.seh_endprologue + blr x1 // { "arg" is passed in x0 } + nop // { this nop is critical for exception handling } + ldp fp,lr,[sp], #16 +.seh_handler __FPC_default_handler,@except,@unwind +end; + + +procedure Exe_entry(constref info: TEntryInformation);[public,alias:'_FPC_EXE_Entry']; + begin + SetupEntryInformation(info); + IsLibrary:=false; + { install the handlers for exe only ? + or should we install them for DLL also ? (PM) } + ExitCode:=0; + asm + mov x0,#0 + adrp x1,EntryInformation@PAGE + add x1,x1,EntryInformation@PAGEOFF + ldr x1,[x1,TEntryInformation.PascalMain] + adrp x8,main_wrapper@PAGE + add x8,x8,main_wrapper@PAGEOFF + blr x8 + end ['X8']; + { if we pass here there was no error ! } + system_exit; + end; diff --git a/rtl/win64/system.pp b/rtl/win64/system.pp index 09f521989b..0f0a62c2e0 100644 --- a/rtl/win64/system.pp +++ b/rtl/win64/system.pp @@ -50,10 +50,6 @@ var implementation -{$ifdef CPUX86_64} -{$asmmode att} -{$endif CPUX86_64} - var {$ifdef VER3_0} SysInstance : qword; @@ -65,42 +61,16 @@ var {$define FPC_SYSTEM_HAS_OSSETUPENTRYINFORMATION} procedure OsSetupEntryInformation(constref info: TEntryInformation); forward; -{$ifdef FPC_USE_WIN64_SEH} -function main_wrapper(arg: Pointer; proc: Pointer): ptrint; assembler; nostackframe; -asm - subq $40, %rsp -.seh_stackalloc 40 -.seh_endprologue - call %rdx { "arg" is passed in %rcx } - nop { this nop is critical for exception handling } - addq $40, %rsp -.seh_handler __FPC_default_handler,@except,@unwind -end; -{$endif FPC_USE_WIN64_SEH} -{$ifdef CPUAARCH64)} -function main_wrapper(arg: Pointer; proc: Pointer): ptrint; assembler; nostackframe; -asm - stp fp,lr,[sp, #-16]! -.seh_savefplr_x -16 -.seh_endprologue - blr x1 // { "arg" is passed in x0 } - nop // { this nop is critical for exception handling } - ldp fp,lr,[sp], #16 -.seh_handler __FPC_default_handler,@except,@unwind -end; -{$endif} +procedure SetupEntryInformation(constref info: TEntryInformation);forward; -{$if defined(CPUX86_64)} {$define FPC_SYSTEM_HAS_STACKTOP} -function StackTop: pointer; assembler;nostackframe; -asm - movq %gs:(8),%rax -end; -{$endif} +function main_wrapper(arg: Pointer; proc: Pointer): ptrint; forward; { include system independent routines } {$I system.inc} +{$I cpuwin.inc} + {***************************************************************************** System Dependent Exit code *****************************************************************************} @@ -152,80 +122,6 @@ begin ExitProcess(exitcode); end; -var - { old compilers emitted a reference to _fltused if a module contains - floating type code so the linker could leave away floating point - libraries or not. VC does this as well so we need to define this - symbol as well (FK) - } - _fltused : int64;cvar;public; - { value of the stack segment - to check if the call stack can be written on exceptions } - _SS : Cardinal; - - -{$ifdef VER3_0} -procedure Exe_entry;[public,alias:'_FPC_EXE_Entry']; -{$else VER3_0} -procedure Exe_entry(constref info: TEntryInformation);[public,alias:'_FPC_EXE_Entry']; -{$endif VER3_0} - begin -{$ifndef VER3_0} - SetupEntryInformation(info); -{$endif VER3_0} - IsLibrary:=false; - { install the handlers for exe only ? - or should we install them for DLL also ? (PM) } -{$ifndef SYSTEM_USE_WIN_SEH} - install_exception_handlers; -{$endif SYSTEM_USE_WIN_SEH} - ExitCode:=0; -{$if defined(CPUX86_64)} - asm - xorq %rax,%rax - movw %ss,%ax - movl %eax,_SS(%rip) - movq %rbp,%rsi - xorq %rbp,%rbp -{$ifdef VER3_0} -{$ifdef FPC_USE_WIN64_SEH} - xor %rcx,%rcx - lea PASCALMAIN(%rip),%rdx - call main_wrapper -{$else FPC_USE_WIN64_SEH} - call PASCALMAIN -{$endif FPC_USE_WIN64_SEH} -{$else VER3_0} -{$ifdef FPC_USE_WIN64_SEH} - xor %rcx,%rcx - lea EntryInformation(%rip),%rdx - movq TEntryInformation.PascalMain(%rdx),%rdx - call main_wrapper -{$else FPC_USE_WIN64_SEH} - lea EntryInformation(%rip),%rdx - call TEntryInformation.PascalMain(%rdx) -{$endif FPC_USE_WIN64_SEH} -{$endif VER3_0} - movq %rsi,%rbp - end ['RSI','RBP']; { <-- specifying RSI allows compiler to save/restore it properly } -{$elseif defined(CPUAARCH64)} - asm - mov x0,#0 - adrp x1,EntryInformation@PAGE - add x1,x1,EntryInformation@PAGEOFF - ldr x1,[x1,TEntryInformation.PascalMain] - adrp x8,main_wrapper@PAGE - add x8,x8,main_wrapper@PAGEOFF - blr x8 - end ['X8']; -{$else} - info.PascalMain(); -{$endif} - { if we pass here there was no error ! } - system_exit; - end; - - {$ifdef VER3_0} procedure _FPC_DLLMainCRTStartup(_hinstance : qword;_dllreason : dword;_dllparam:Pointer);stdcall;public name '_DLLMainCRTStartup'; begin @@ -247,53 +143,11 @@ begin end; {$endif VER3_0} -{$ifdef CPUX86_64} -function is_prefetch(p : pointer) : boolean; - var - a : array[0..15] of byte; - doagain : boolean; - instrlo,instrhi,opcode : byte; - i : longint; - begin - result:=false; - { read memory savely without causing another exeception } - if not(ReadProcessMemory(GetCurrentProcess,p,@a,sizeof(a),nil)) then - exit; - i:=0; - doagain:=true; - while doagain and (i<15) do - begin - opcode:=a[i]; - instrlo:=opcode and $f; - instrhi:=opcode and $f0; - case instrhi of - { prefix? } - $20,$30: - doagain:=(instrlo and 7)=6; - $60: - doagain:=(instrlo and $c)=4; - $f0: - doagain:=instrlo in [0,2,3]; - $0: - begin - result:=(instrlo=$f) and (a[i+1] in [$d,$18]); - exit; - end; - else - doagain:=false; - end; - inc(i); - end; - end; -{$endif} - - // // Hardware exception handling // {$I seh64.inc} - type TVectoredExceptionHandler = function (excep : PExceptionPointers) : Longint; diff --git a/rtl/win64/x86_64/cpuwin.inc b/rtl/win64/x86_64/cpuwin.inc new file mode 100644 index 0000000000..4bf4b2581a --- /dev/null +++ b/rtl/win64/x86_64/cpuwin.inc @@ -0,0 +1,133 @@ +{ + This file is part of the Free Pascal run time library. + Copyright (c) 1999-2006 by Florian Klaempfl and Pavel Ozerski + member of the Free Pascal development team. + + FPC Pascal system unit x86-64 specific part for the Win64 API. + + See the file COPYING.FPC, included in this distribution, + for details about the copyright. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + **********************************************************************} + +{$asmmode att} + +function StackTop: pointer; assembler;nostackframe; +asm + movq %gs:(8),%rax +end; + +{$ifdef FPC_USE_WIN64_SEH} +function main_wrapper(arg: Pointer; proc: Pointer): ptrint; assembler; nostackframe; +asm + subq $40, %rsp +.seh_stackalloc 40 +.seh_endprologue + call %rdx { "arg" is passed in %rcx } + nop { this nop is critical for exception handling } + addq $40, %rsp +.seh_handler __FPC_default_handler,@except,@unwind +end; +{$endif FPC_USE_WIN64_SEH} + +var + { old compilers emitted a reference to _fltused if a module contains + floating type code so the linker could leave away floating point + libraries or not. VC does this as well so we need to define this + symbol as well (FK) + } + _fltused : int64;cvar;public; + { value of the stack segment + to check if the call stack can be written on exceptions } + _SS : Cardinal; + +{$ifdef VER3_0} +procedure Exe_entry;[public,alias:'_FPC_EXE_Entry']; +{$else VER3_0} +procedure Exe_entry(constref info: TEntryInformation);[public,alias:'_FPC_EXE_Entry']; +{$endif VER3_0} + begin +{$ifndef VER3_0} + SetupEntryInformation(info); +{$endif VER3_0} + IsLibrary:=false; + { install the handlers for exe only ? + or should we install them for DLL also ? (PM) } +{$ifndef SYSTEM_USE_WIN_SEH} + install_exception_handlers; +{$endif SYSTEM_USE_WIN_SEH} + ExitCode:=0; + asm + xorq %rax,%rax + movw %ss,%ax + movl %eax,_SS(%rip) + movq %rbp,%rsi + xorq %rbp,%rbp +{$ifdef VER3_0} +{$ifdef FPC_USE_WIN64_SEH} + xor %rcx,%rcx + lea PASCALMAIN(%rip),%rdx + call main_wrapper +{$else FPC_USE_WIN64_SEH} + call PASCALMAIN +{$endif FPC_USE_WIN64_SEH} +{$else VER3_0} +{$ifdef FPC_USE_WIN64_SEH} + xor %rcx,%rcx + lea EntryInformation(%rip),%rdx + movq TEntryInformation.PascalMain(%rdx),%rdx + call main_wrapper +{$else FPC_USE_WIN64_SEH} + lea EntryInformation(%rip),%rdx + call TEntryInformation.PascalMain(%rdx) +{$endif FPC_USE_WIN64_SEH} +{$endif VER3_0} + movq %rsi,%rbp + end ['RSI','RBP']; { <-- specifying RSI allows compiler to save/restore it properly } + { if we pass here there was no error ! } + system_exit; + end; + +function is_prefetch(p : pointer) : boolean; + var + a : array[0..15] of byte; + doagain : boolean; + instrlo,instrhi,opcode : byte; + i : longint; + begin + result:=false; + { read memory savely without causing another exeception } + if not(ReadProcessMemory(GetCurrentProcess,p,@a,sizeof(a),nil)) then + exit; + i:=0; + doagain:=true; + while doagain and (i<15) do + begin + opcode:=a[i]; + instrlo:=opcode and $f; + instrhi:=opcode and $f0; + case instrhi of + { prefix? } + $20,$30: + doagain:=(instrlo and 7)=6; + $60: + doagain:=(instrlo and $c)=4; + $f0: + doagain:=instrlo in [0,2,3]; + $0: + begin + result:=(instrlo=$f) and (a[i+1] in [$d,$18]); + exit; + end; + else + doagain:=false; + end; + inc(i); + end; + end; + +