Commit Graph

85 Commits

Author SHA1 Message Date
florian
4995677b0f --- Zusammenführung
-- Zusammenführen von r45995 in ».«:
U    rtl/linux/i386/sighnd.inc
U    rtl/linux/x86_64/sighnd.inc
A    tests/webtbs/tw37468.pp
-- Aufzeichnung der Informationen für Zusammenführung von r45995 in ».«:
 U   .
-- Zusammenführen von r46207 in ».«:
U    rtl/linux/i386/sighndh.inc
-- Aufzeichnung der Informationen für Zusammenführung von r46207 in ».«:
 G   .
-- Zusammenführen von r46208 in ».«:
G    rtl/linux/i386/sighnd.inc
-- Aufzeichnung der Informationen für Zusammenführung von r46208 in ».«:
 G   .
-- Zusammenführen von r46210 in ».«:
U    rtl/aix/sighnd.inc
U    rtl/beos/i386/sighnd.inc
U    rtl/go32v2/dpmiexcp.pp
U    rtl/haiku/i386/sighnd.inc
U    rtl/haiku/x86_64/sighnd.inc
U    rtl/i8086/math.inc
U    rtl/inc/genmath.inc
U    rtl/linux/m68k/sighnd.inc
U    rtl/linux/powerpc/sighnd.inc
U    rtl/linux/powerpc64/sighnd.inc
U    rtl/linux/sparc/sighnd.inc
U    rtl/linux/sparc64/sighnd.inc
G    rtl/linux/x86_64/sighnd.inc
U    rtl/netbsd/arm/sighnd.inc
U    rtl/netbsd/m68k/sighnd.inc
U    rtl/netbsd/powerpc/sighnd.inc
U    rtl/netbsd/x86_64/sighnd.inc
U    rtl/openbsd/i386/sighnd.inc
U    rtl/openbsd/x86_64/sighnd.inc
U    rtl/os2/system.pas
U    rtl/solaris/i386/sighnd.inc
U    rtl/solaris/sparc/sighnd.inc
U    rtl/solaris/x86_64/sighnd.inc
U    rtl/win32/system.pp
U    rtl/win64/system.pp
U    tests/webtbs/tw37468.pp
U    rtl/wince/system.pp
-- Aufzeichnung der Informationen für Zusammenführung von r46210 in ».«:
 G   .
-- Zusammenführen von r46992 in ».«:
G    rtl/linux/x86_64/sighnd.inc
A    tests/webtbs/tw37468b.pp
-- Aufzeichnung der Informationen für Zusammenführung von r46992 in ».«:
 G   .
-- Zusammenführen von r47114 in ».«:
G    rtl/linux/x86_64/sighnd.inc
G    rtl/linux/i386/sighnd.inc
A    tests/webtbs/tw37926.pp
-- Aufzeichnung der Informationen für Zusammenführung von r47114 in ».«:
 G   .
-- Zusammenführen von r47117 in ».«:
G    rtl/linux/i386/sighnd.inc
G    rtl/linux/x86_64/sighnd.inc
G    rtl/linux/m68k/sighnd.inc
-- Aufzeichnung der Informationen für Zusammenführung von r47117 in ».«:
 G   .

git-svn-id: branches/fixes_3_2@47906 -
2020-12-30 14:07:17 +00:00
marco
9728612601 # revisions: 44952,44996,45855,46343,46753,46839
git-svn-id: branches/fixes_3_2@47573 -
2020-11-25 07:26:17 +00:00
svenbarth
cfa5b9d809 - the external declaration of PascalMain is no longer needed for Win64 on 3.1.1+
git-svn-id: trunk@35369 -
2017-01-29 20:18:18 +00:00
Tomas Hajny
e5ceb04725 * patch by Dmitry Boyarintsev (bug #31023) implementing SysSetCtrlBreakHandler for Win32 and Win64
git-svn-id: trunk@35050 -
2016-12-03 23:35:20 +00:00
svenbarth
2808be3e20 + add and use sysinit unit for Win64 (only one since we don't support cygwin and gprof there)
* switch Win64 to indirect entry information

git-svn-id: trunk@34307 -
2016-08-13 19:10:27 +00:00
svenbarth
dbbd7b6969 * use FPCSysInstance instead of SysInstance directly
git-svn-id: trunk@34306 -
2016-08-13 19:09:08 +00:00
svenbarth
af53fcb48c Adjust SysInstance so that it is correctly handled with the indirect entry information on Win32
win/sysosh.inc, TEntryInformationOS:
  + new field SysInstance that will hold the address to the main program's SysInstance variable
win32/system.pp:
  * rename SysInstance to FPCSysInstance and make it a PLongInt
  * OsSetupEntryInformation: setup FPCSysInstance
  * adjust initialization of SysInstance to use FPCSysInstance instead
win32/sysinit.inc:
  * SysInstance is no longer an external
  * initialize the OS.SysInstance field of EntryInformation
win64/system.pp:
  * add a FPCSysInstance that's a pointer to SysInstance
win/winres.inc:
  * SysInstance is now a pointer and has the same name on both Win32 and Win64

git-svn-id: trunk@33107 -
2016-02-19 16:22:20 +00:00
svenbarth
b525cecad8 - get rid of the calling convention modifier for PascalMain as it's generated using the default calling convention anyway (without any parameters this luckily doesn't matter that much ;) )
(Note: adjusted merge info as in my packages branch there is a less complete commit for this)

git-svn-id: trunk@33023 -
2016-01-29 14:51:15 +00:00
sergei
d93d36e6d3 * Win64: Use separate implementation of CaptureBacktrace that calls RtlCaptureStackBackTrace. This way it does not require non-optimized code to work correctly.
git-svn-id: trunk@29692 -
2015-02-14 11:41:33 +00:00
svenbarth
2d454dc8fa Move DynLibs support to System unit using a manager approach like for Threads, WideStrings, etc.. This is needed so that we can support features like "delayed" and loading of dynamic packages.
Each port that allows the usage of dynamic libraries should call InitSystemDynLibs during initialization of the System unit.
The DynLibs unit has been adjusted to be a forwarder for the functions that now reside in the System unit (for backwards compatiblity just in case). Additionally the unit will register the DynLibsManager if it doesn't reside in the System unit anyway.
Currently only the Windows targets (Win32, Win64 and WinCE) implement the DynLibsManager inside the System unit. For other systems using the LoadLibrary, etc. functions will lead to a run error/exception.
If a port wants to implement its own DynLibsManager then it needs to define DISABLE_NO_DYNLIBS_MANAGER. TLibHandle, NilHandle and optionally TOrdinalEntry (it's set to SizeUInt otherwise) should be defined in sysdlh.inc which needs to be enabled using the define FPC_SYSTEM_HAS_SYSDLH (because there are targets which have FEATURE_DYNLIBS enabled, but don't support them... e.g. powerpc-wii -.-).
The DynLibsManager contains methods for loading a library based on a RawByteString and based on a UnicodeString. BOTH should be implemented, but internally one can forward to the other.
The loading by ordinal *can* be be implemented. If it is set to Nil then the implementation of GetProcAddress(lib,ordinal) will return Nil.

+ new functions SetDynLibsManager and GetDynLibsManager to set and retrieve the current DynLibsManager
* provide interface of DynLibs unit in unit System

git-svn-id: trunk@29613 -
2015-02-03 20:00:00 +00:00
florian
43515ab109 * explicitly add asmmode, resolves #27255
git-svn-id: trunk@29424 -
2015-01-06 14:45:34 +00:00
sergei
ae68a4962f - RTL: merged functionality of InitWideStringManager into InitUnicodeStringManager and removed the former.
git-svn-id: trunk@29130 -
2014-11-23 21:09:00 +00:00
sergei
3a5e6485b5 - RTL: removed InitVariantManager, it was an empty procedure since day 1.
git-svn-id: trunk@29114 -
2014-11-22 20:35:46 +00:00
sergei
3a55c4301e * Since StackTop=StackBottom+StackLength, any two variables are sufficient to describe stack, the third one is redundant.
* As a first part of cleanup, replaced StackTop with function returning StackBottom+StackLength.
* On Win32 and Win64, StackTop returns the stack base from TIB instead.

git-svn-id: trunk@27119 -
2014-03-12 19:48:03 +00:00
sergei
c83f4c5ddc * Windows targets: removed 'errno' threadvar, OS error codes can be passed directly to Errno2InOutRes().
git-svn-id: trunk@26815 -
2014-02-19 07:28:46 +00:00
sergei
489b23cecd * Made TStartupInfo type common for win32 and win64 and updated as suggested by Mantis #23074.
* Deprecated StartupInfo variable because it is not there for Delphi compatibility (Delphi apparently does not have such variable in interface of its System unit), and we don't have other reasons to export non-portable stuff.

git-svn-id: trunk@26810 -
2014-02-18 16:49:08 +00:00
pierre
3ab1762d92 Use new GetExceptionPointer nostackframe assembler function to avoid 32bit relocation on .bss problem
git-svn-id: trunk@24221 -
2013-04-10 13:36:07 +00:00
sergei
6788fd6433 + Win64 SEH: install a top-level exception handler around thread functions. This was a missing puzzle piece of SEH support. Now behavior of unhandled exceptions in non-main threads is consistent with that of main thread, and, in general, behavior of SEH-enabled RTL is consistent with one without SEH.
git-svn-id: trunk@23482 -
2013-01-21 17:16:15 +00:00
sergei
bc4c1149c3 + Native threadvar implementation for Win32 and Win64 (most of it, but not yet complete).
git-svn-id: trunk@23359 -
2013-01-10 19:13:02 +00:00
florian
0e9139c914 * retrieve stack size correctly
git-svn-id: trunk@21928 -
2012-07-17 20:14:15 +00:00
florian
a6a1f2a0a1 * properly retrieve the stacktop on win64
git-svn-id: trunk@21926 -
2012-07-17 19:47:35 +00:00
Tomas Hajny
d442d14e0c + FileNameCasePreserving added - see #18066 in Mantis
git-svn-id: trunk@20894 -
2012-04-15 20:56:13 +00:00
sergei
cd44c5f45c Win32 and Win64, fixed DLL exit sequence, resolves #14603:
* Unwind to DllEntry context only if called from DllEntry. Otherwise, terminate the entire process, making sure that RTL won't be finalized twice.
* Call DLL_process_detach_hook before RTL is finalized, not after.

git-svn-id: trunk@20367 -
2012-02-16 23:39:03 +00:00
sergei
ea37d71f67 - win64: removed empty procedures remove_exception_handlers and fpc_cpucodeinit.
git-svn-id: trunk@20366 -
2012-02-16 23:22:42 +00:00
sergei
cbad0abab5 + Platform-specific exception support for x86_64-win64. Enable by cycling with OPT=-dTEST_WIN64_SEH.
git-svn-id: trunk@20098 -
2012-01-16 23:13:31 +00:00
florian
562932a2c9 * change dllparam into PtrInt, this is required for 64 bit systems, patch based on Gennadiy's patch in #21089, resolves #21089
git-svn-id: trunk@20079 -
2012-01-14 20:21:52 +00:00
sergei
cd347e40b2 * Moved existing exception-related definitions into separate include file seh64.inc, and added some more WinAPI definitions needed for SEH.
git-svn-id: trunk@19869 -
2011-12-18 01:15:31 +00:00
sergei
ebb2205c63 * Moved TExceptionRecord definition to sysos.inc, it is identical for all Windows targets.
git-svn-id: trunk@19868 -
2011-12-18 00:45:52 +00:00
sergei
bcbd25568e * Call InitHeap before InitSystemThreads in TLS callback (necessary because InitSystemThreads calls RelocateHeap), and skip both of them in initialization section of system.pp if they have been called from TLS callback. This restores correct initialization sequence which was broken by r19779, resulting in lots of debug messages about corrupted heap when running tests/test/theapthread.pp
git-svn-id: trunk@19836 -
2011-12-13 07:40:02 +00:00
sergei
32094761ef * win32/system.pp, win64/system.pp: Moved duplicated declarations of WinAPI functions to sysos.inc (Florian's comment about include ordering is no longer true, wstrings.inc comes after sysos.inc these days).
* Result of GetCurrentProcess and first argument of ReadProcessMemory are THandle, not dword.

git-svn-id: trunk@19726 -
2011-12-02 18:52:48 +00:00
paul
1ccf16358c rtl: init widestring and unitcodestring managers before initialization of Standard IO files (stdin,stdout,stderr)
git-svn-id: trunk@19542 -
2011-10-25 02:29:29 +00:00
sergei
8e41ecfd54 * Made a stupid mistake in r19460: restoring rbp from rbp-relative reference will obviously crash. This went unnoticed however, because PASCALMAIN does not return and wrong code is never executed. Fixed by storing rbp in non-volatile register instead of local var.
git-svn-id: trunk@19501 -
2011-10-16 12:38:47 +00:00
sergei
1404b7397a - Win64, EXE_Entry: removed messing with gs:[0], it won't work anyway.
- Also don't modify rsp in the middle of procedure, x86_64 targets use fixed stack.
- Cleaned outdated FPC_HAS_RIP_RELATIVE and VER2_2 defines.

git-svn-id: trunk@19460 -
2011-10-11 08:38:10 +00:00
sergei
268d8685e7 - Removed SysResetFPU/SysInitFPU from win32/win64 system unit initialization. It is redundant here because it is called from fpc_initializeunits->fpc_cpuinit (on win64) or from fpc_cpucodeinit (on win32).
* Also declared hprevinst as a typed constant and removed its initialization from code.

git-svn-id: trunk@19234 -
2011-09-25 19:27:52 +00:00
sergei
ad5d2ccabb * Moved command line handling and randomize() to syswin.inc, so a single copy of code is used for both win32 and win64. This implies that apostrophe is no longer supported as quoting symbol in win64.
Win64 doesn't support it itself either.

git-svn-id: trunk@19201 -
2011-09-23 21:45:02 +00:00
sergei
f35a8179b1 * Status codes are identical for win32 and win64, moved them to syswin.inc.
git-svn-id: trunk@19160 -
2011-09-20 15:01:22 +00:00
sergei
ad94e5e719 * Link TLS directory and callbacks only into executables. It is not necessary for DLLs, because callback functionality is contained in DllMain. Moreover, DLLs with TLS directory cannot be dynamically loaded in Windows versions prior to Vista.
* In Win32, reference TLS directory from SysInit units, allowing the module which needs TLS to be different from module which contains system unit.
* Don't write to TLS directory, as it can be placed into read-only memory.

git-svn-id: trunk@18028 -
2011-07-27 23:22:09 +00:00
sergei
50952945e1 * Moved WideString-related code, which is identical for Win32 and Win64, into syswin.inc
* Defined HAS_WIDESTRINGMANAGER for Win32 and Win64, this allows to smartlink away part of generic widestring routines.

git-svn-id: trunk@17963 -
2011-07-08 20:07:51 +00:00
sergei
cd94bb5edf * tls_index must be renamed everywhere, forgotten part of r17943.
git-svn-id: trunk@17948 -
2011-07-06 20:33:45 +00:00
pierre
46a6be05a5 * More dummy code to avoid removal of required labels
git-svn-id: trunk@17898 -
2011-07-01 14:21:50 +00:00
pierre
bffd571f9d * win/sysos.inc: TTlsDirectory, new record type
Used to support TlsCallbacks.

    Tls callback code added inside
    ifdef FPC_USE_TLS_DIRECTORY.
    NOTE: This code needs compiler changes also to work.

  * win/systhread.inc:
    Exec_Tls_callback: Callback for main executable.
    Several new external variables:
    FreePascal_TLS_callback, FreePascal_end_of_TLS_callback
    need to be placed into .CRT$XL* section,
    using  name '.section .CRT$XLFPC __FPC_tls_callbacks'
    extension to be provided by compiler change.
    tls_callbacks : pointer; external name '___crt_xl_start__';
    tls_data_start : pointer; external name '___tls_start__';
    tls_data_end : pointer; external name '___tls_end__';
    provided by linker script.
    tls_index : DWord that will contain the automatic
    TlsIndex generated by executable launch code (not used by
    FPC code, but might be used by code from loaded objects).
    _tls_used: TTlsdirectory record.

  * win32/system.pp and win64/system.pp:
    Code to force loading of _tls_used record.

git-svn-id: trunk@17893 -
2011-07-01 10:40:35 +00:00
sergei
3a7ac49cc2 - Removed Win32Wide2AnsiMove, using Win32Unicode2AnsiMove for both Unicode-to-ansi and Wide-to-ansi conversions. In general, we don't need two different conversion routines in wideStringManager, as long as they differ only in PWideChar vs PUnicodeChar (these types are identical).
git-svn-id: trunk@17202 -
2011-03-29 05:25:05 +00:00
florian
a0c25dc0f9 - removes Thread_count from the system unit of several OSes: the value of this variable was unpredictable and the hebaviour was not fixable, resolves #18089
git-svn-id: trunk@16472 -
2010-11-28 20:46:50 +00:00
pierre
ed1c558726 * Fix RIP relative assmebler code of rev 16410
git-svn-id: trunk@16414 -
2010-11-24 07:57:01 +00:00
pierre
709d36a1d0 + Add signals unit for win64
git-svn-id: trunk@16410 -
2010-11-23 23:57:10 +00:00
pierre
61547f6a5a * Fix incorrect instruction size
git-svn-id: trunk@15935 -
2010-09-01 11:56:52 +00:00
pierre
90d1dac1d3 + Add StartupConsoleMode as for win32
git-svn-id: trunk@14125 -
2009-11-09 17:01:16 +00:00
michael
1cf64c032f * Patch to remove useless process_entry_hook from sven barth
git-svn-id: trunk@14094 -
2009-11-07 10:10:47 +00:00
florian
cba72c423d * patch by Sergei Gorelkin to use always SetFilePointer, also for files with >2GB, this saves some lines of code, resolves #14630
git-svn-id: trunk@13838 -
2009-10-10 18:52:50 +00:00
florian
a2862ce347 * cleaned up mess of r13516
git-svn-id: trunk@13524 -
2009-08-12 19:34:46 +00:00