path: root/src/pal/inc/pal.h
AgeCommit message (Collapse)AuthorFilesLines
2021-06-29Add YieldProcessor implementation for armsubmit/tizen/20210629.000826accepted/tizen/unified/20210629.130321Gleb Balykov1-1/+1
2020-03-25Mark Relocation Section as NotNeeded (#25715)Dong-Heon Jung1-0/+16
- After relocation, relocation section in zap image is not necessary. - Mark the section as NotNeeded by giving advice(madvise with MADV_DONTNEED) - It reduces 120~150KB PSS in tizen sample apps.
2020-03-25[Tizen] Add coreclr_preload_assembly to CoreCLR host APIKonstantin Baladurin1-1/+33
2020-03-25[Tizen] Implement detecting of sanitized librariesAndrey Drobyshev1-0/+8
Parse ".dynamic" section (ELF dynamic array tags) of the module being added, find ".rel(a).plt" section and search it for presence of '__asan_init' symbol. Change-Id: Ie7cc4c818b791b5f00713b42ba15131325b8152c Signed-off-by: Andrey Drobyshev <>
2019-06-10Add support for the NetTrace EventPipe file formatnoahfalk1-0/+11
Right now the new format is not on by default, but it can be enabled using COMPlus_EventPipeNetTraceFormat = 1 for testing purposes. The plan to have a follow up PR that will add shipping configuration mechanisms and change the default setting. See the documentation in the PerfView repo for more details about the format. At a glance the goal is to create a format that is more efficient to produce, has a smaller on disk size, and offers enhanced functionality in a few areas: a) 64 bit thread id support b) Detection of dropped events via sequence numbers c) Better support for extracting subsets of the file Together with the change there was also some refactoring of the EventPipeBufferManager and EventPipeThread. This change addresses (at least in part) the following issues: #19688, #23414, #24188, #20751, #20555, #21827, #24852, #25046
2019-05-29Use /proc/<pid>/mem to read memory in remote DBI data target. It makes the ↵Mike McLaughlin1-1/+4
test case run at (#24844) least 4 to 5 times faster than before. Fallback to old transport ReadMemory if /proc/<pid>/mem can't be opened. This happens on attach because of permissions/access, but works fine on the launch (the most important case).
2019-05-21Avoid PAL LoadLibrary simulator for regular PInvoke (#24669)Jan Kotas1-7/+0
Fixes #21009
2019-05-17Merge pull request #24520 from am11/freebsd/set-affinityJan Vorlicek1-13/+12
Fix CPUSET_T definition for FreeBSD
2019-05-16Add support for invariant casing in PAL (#24597)Michal Strehovský1-0/+3
unicodedata.cpp based on UnicodeData.txt v11.0.
2019-05-15Delete unicode API emulator (#24581)Michal Strehovský1-27/+14
2019-05-11Adjust PAL_STDCPP_COMPAT to accommodate FreeBSDAdeel1-13/+12
2019-05-08Add generate crash dump command to diagnostics server (#24460)Mike McLaughlin1-0/+8
Add the DiagnosticProtocolHelper class to deserialize and dispatch the new GenerateCoreDump command. Refactor the PAL createdump launch on unhandled exception code to used by a new PAL_GenerateCoreDump method that doesn't depend on the complus dump environment variables. Changed the "full" createdump not to include the uncommitted pages and removed the "add module metadata" workaround for SOS clrstack !UNKNOWN problem now that is fixed in SOS (crashinfo.cpp).
2019-04-09Fix several issuesJan Vorlicek1-0/+5
* Fix build on OSX and Linux machines without NUMA installed - there were couple of places where I was missing ifdefs * Fix bug in nodeMaskLength computation * Remove testing change in eeconfig.cpp that has leaked into the PR * Fix GCToOSInterface::GetTotalProcessorCount for embedded GC to return all processors on the system, not just the ones enabled for the current process.
2019-04-09Remove Unix CPU groups emulationJan Vorlicek1-137/+3
This change removes CPU groups emulation from Unix PAL and modifies the GC and thread pool code accordingly.
2019-04-08Add Large pages support in GCMukul Sabharwal1-0/+1
2019-03-29Unify clang with GNUCSinan Kaya1-1/+9
Enable SSE for GCC
2019-03-18Conversion issuesSinan Kaya1-2/+2
2019-03-18[EventPipe] Adding an IPC server to handle out of process communication. ↵José Rivero1-0/+11
(#23106) This is the first commit to enable a "diagnostic port" using IPC (Named Pipe on Windows and Unix Domain Socket on other platforms). This change currently enable EventPipe to be enabled/disabled without the use of a file drop. - Split the DiagnosticsIpc into (DiagnosticsIpc/IpcStream) - DiagnosticsIpc (IPC listener) is meant to be used by the Diagnostic server. - IpcStream (IPC channel) is meant to be use to communicate with the connected client. - Change the FastSerializer dependency from `CFileStream` to `StreamWriter` This abstraction is meant decouple the writing of objects in order to extend its usability. The main objective is to reuse FastSerializer to stream data through the open IPC channel. - Moved the EventPipeSessionProvider* classes to their own file. - Added a more streamlined parsing achievable by defining a simpler binary protocol (by noahfalk). 1. Only one allocation is needed for the EventPipeProviderConfiguration array, no allocations or copies are needed for strings because we can refer to them directly out of the incoming command buffer 2. No change to the EventPipe API for enable is required. EventPipeProviderConfiguration retains its current behavior of not deleting the string pointers it holds. 3. No leaks happen because the command buffer owns the string memory and ensures that it stays alive for the duration of the Enable() call.
2019-03-11Fix no-return false positives in static analyzer buildJan Vorlicek1-0/+6
There were about 800 false positive issues in the clang status analyzer build caused by the fact that various forms of asserts were not considered by the analyzer as not returning. This change adds __attribute__((analyzer_noreturn)) (wrapped in a macro) to those assertion functions.
2019-02-20Abstract deprecated and selectany for GCC and remove LLVM'ism where possible ↵Sinan Kaya1-4/+4
(#22662) * Abstract selectany * Fix initializer element is not constant src/corefx/System.Globalization.Native/pal_icushim.c:58:34: error: initializer element is not constant static const int MaxICUVersion = MinICUVersion + 20; * Enable ms extensions * Apply LLVM patterns to GCC * Remove deprecated function * Fix const conversion error src/corefx/System.Globalization.Native/pal_calendarData.c:390:16: warning: passing argument 1 of ‘ures_close_ptr’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] ures_close(erasResBundle); src/corefx/System.Globalization.Native/pal_calendarData.c:419:22: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] char* name = GetCalendarName(calendarId); * Remove old compiler option
2019-02-17Fix Integer Rounding issue and duplicate definition of __deref in sal.h (#22645)Sinan Kaya1-1/+1
* Fix large integer truncation pal/pal.h:4988:43: warning: large integer implicitly truncated to unsigned type [-Woverflow] static const SIZE_T NoTargetFrameSp = SIZE_MAX; ^~~~~~~~ * Fix compilation error with GCC /usr/include/c++/7.3.0/debug/functions.h:452:15: error: expected unqualified-id before ')' token __deref(); ^ /usr/include/c++/7.3.0/debug/functions.h:455:34: error: expected primary-expression before '<' token typename = decltype(__deref<_It>() < __deref<_It>())> ^ /usr/include/c++/7.3.0/debug/functions.h:455:38: error: expected primary-expression before '>' token typename = decltype(__deref<_It>() < __deref<_It>())> ^ /usr/include/c++/7.3.0/debug/functions.h:455:40: error: expected primary-expression before ')' token typename = decltype(__deref<_It>() < __deref<_It>())> ^
2019-02-17Delete RtlMoveMemory and tests (#22668)Adeel Mujahid1-9/+0
2019-02-16Fix visibility and signed comparison issues for GCC (#22586)Adeel Mujahid1-85/+88
* Fix visibility and signed comparison issues for GCC * Fix hidden _CLRDataCreateInstance warned by macOS * Fix indentation in vswprintf/test1 * Change void* to PVOID in implementation files
2019-02-10Cleanup DLL exports (#22500)Jan Kotas1-6/+8
2019-02-09Set visibility option to hidden (#21924)Adeel Mujahid1-47/+45
2019-02-07More PAL layer cleanup for GNU and add build script support for GCC (#22369)Sinan Kaya1-4/+6
* Declare throw only when compiling for c++ Prevent the definition from getting defined multiple times and map it to throw() only when compiling c++ code. * Suppress warnings for tests Suppress: -Wno-write-strings -Wno-sign-compare -Wno-narrowing -fpermissive -Wno-int-to-pointer-cast to allow tests to compile * Add gcc option to script Following clangx.y model add -gccx.y command line arguments with gcc5 and gcc7 being the currnetly supported options. * Allow environment variable to be used for TOOLCHAIN Remove CLANG specific compiler options as well. * Hide non-GNU compiler options * Do not include local directory if cross compiling [ 0%] Building CXX object src/pal/src/eventprovider/tracepointprovider/CMakeFiles/coreclrtraceptprovider.dir/__/lttng/traceptprovdotnetruntime.cpp.o cc1plus: error: include location "/usr/local/include" is unsafe for cross-compilation [-Werror=poison-system-directories] * Suppress unknown pragma warnings src/pal/src/exception/seh-unwind.cpp:37:0: warning: ignoring #pragma clang diagnostic [-Wunknown-pragmas] #pragma clang diagnostic pop Removing these cause compilation error on clang7 and arm as follows: In file included from /bin/obj/Linux.arm.Debug/src/pal/src/libunwind/include/libunwind.h:9: /src/pal/src/libunwind/include/libunwind-arm.h:247:9: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] typedef struct unw_tdep_save_loc ^ /src/pal/src/libunwind/include/libunwind-arm.h:288:9: error: empty struct has size 0 in C, size 1 in C++ [-Werror,-Wextern-c-compat] typedef struct * plt not useful for GNU and ARM64/ARM src/pal/src/arch/arm64/callsignalhandlerwrapper.S: Assembler messages: src/pal/src/arch/arm64/callsignalhandlerwrapper.S:31: Error: unexpected characters following instruction at operand 1 -- `bl signal_handler_worker@plt' src/pal/src/arch/arm64/callsignalhandlerwrapper.S:32: Error: unexpected characters following instruction at operand 1 -- `bl signal_handler_worker@plt' * Remove double const from argv in PAL_Initialize Seeing compilation error with GNU for C source files as follows: if (PAL_Initialize(argc, argv) != 0) ^ src/pal/tests/palsuite/common/palsuite.h:21:0, from src/pal/tests/palsuite/c_runtime/asinhf/test1/test1.c:18: src/pal/inc/pal.h:374:1: note: expected ‘const char * const*’ but argument is of type ‘char **’ * Suppress format warnings using GNU for libunwind warning: format ‘%li’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=] Debug (4, " aligned frame, offset %li\n", f->cfa_reg_offset); * Fix -fpermissive warnings for GNU * Suppress unused variable warning in libunwind src/pal/src/libunwind/include/libunwind-aarch64.h:201:5: warning: right-hand operand of comma expression has no effect [-Wunused-value] #define unw_tdep_getcontext(uc) (({ \ ~~~~~~~~~ unw_tdep_context_t *unw_ctx = (uc); \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __asm__ __volatile__ ( \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x0, x1, [%[base], #0]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x2, x3, [%[base], #16]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x4, x5, [%[base], #32]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x6, x7, [%[base], #48]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x8, x9, [%[base], #64]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x10, x11, [%[base], #80]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x12, x13, [%[base], #96]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x14, x13, [%[base], #112]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x16, x17, [%[base], #128]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x18, x19, [%[base], #144]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x20, x21, [%[base], #160]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x22, x23, [%[base], #176]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x24, x25, [%[base], #192]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x26, x27, [%[base], #208]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "stp x28, x29, [%[base], #224]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "str x30, [%[base], #240]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "mov x1, sp\n" \ ~~~~~~~~~~~~~~~~ "stp x1, x30, [%[base], #248]\n" \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ : [base] "+r" (unw_base) : : "x1", "memory"); \ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }), 0) * Fix warning: ‘memset’ used with length equal to number of elements warning Fix similar warnings to these by including the element size into total size calculation. src/pal/tests/palsuite/miscellaneous/SetEnvironmentVariableW/test1/test.cpp: In function ‘int main(int, char**)’: src/pal/tests/palsuite/miscellaneous/SetEnvironmentVariableW/test1/test.cpp:89:31: warning: ‘memset’ used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size] memset(NewValue,0,BUF_SIZE); * Define CLR specific compiler option CLR_CMAKE_COMPILER By the time toolchain.cmake is called, the compiler detection from cmake is not active. We need an intermediate definition to pass to compiler detection.
2019-02-01Coreclr gnuport (#22129)Sinan Kaya1-15/+36
* Abstract away NOINLINE statement MSVC and GNU compilers use different attributes for noinline. Abstract away compiler differences. * Replace __sync_swap with __atomic_exchange_n __sync_swap doesn't exist on GNU. Replacing with __atomic_exchange_n which is universally available. * Define CDECL for GNUC __cdecl is not defined by default on GNU compilers. * Define gcc version of __declspec(thread) * Correct pointer casting A pointer value is usually unsigned long on most platforms. Casting it to integer causes signedness issues. Use size_t to be efficient on all 32 and 64 bit architectures. * Put quotes around the error string Correct error statement. GNU G++ is picky about the string following the error statement with ' character in it. It needs to be enclosed with double quotes. * Fix casting problem Seeing these warnings with GNU G++ compiler src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalInitializeCriticalSectionAndSpinCount(PCRITICAL_SECTION, DWORD, bool)’: src/pal/src/sync/cs.cpp:630:48: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ src/pal/src/sync/cs.cpp: In function ‘void CorUnix::InternalLeaveCriticalSection(CorUnix::CPalThread*, _CRITICAL_SECTION*)’: src/pal/src/sync/cs.cpp:880:43: warning: converting to non-pointer type ‘SIZE_T {aka long unsigned int}’ from NULL [-Wconversion-null] pPalCriticalSection->OwningThread = NULL; ^ * Abstract optnone compiler attribute GNU compiler doesn't support optnone attribute. pal/src/exception/seh-unwind.cpp:449:77: warning: ‘optnone’ attribute directive ignored [-Wattributes] * Set the aligned attribute for GNU compiler * Make __rotl and __rotr functions portable GNU compiler doesn't have an intrinsic for these. Open code them using the provided implementation. * Define deprecated attribute for gcc * Add throw specifier for GCC /usr/include/string.h:43:28: error: declaration of ‘void* memcpy(void*, const void*, size_t) throw ()’ has a different exception specifier size_t __n) __THROW __nonnull ((1, 2));
2019-01-15On SIGTERM default to a non-zero exit code (#21300)Tom Deseyn1-1/+1
* On SIGTERM default to a non-zero exit code * Fix Windows builds * Improve SIG_DFL/SIG_IGN handling * Remove PAL_GetTerminationExitCode * Use sa_handler/sa_sigaction based on SA_SIGINFO; remove HAVE_SIGINFO_T. * configure.cmake: remove siginfo_t check * Move restore_signal_and_resend so OSX can use it; add function documentation * Fix OSX build: include pal/process.h for gPID * Check SIG_IGN and SIG_DFL against sa_handler * Don't use sa_handler when SA_SIGINFO is set * Fix equality check * Swap order of checking SA_SIGINFO and SIG_IGN/SIG_DFL
2019-01-08Fix issue #20585 createdump explicitly uses /tmp. (#21866)Mike McLaughlin1-0/+8
Changed to PAL's GetTempPathA to get the temp path.
2019-01-02Delete lstrlen from Unix PAL (#21745)Jan Kotas1-18/+0
strlen/wcslen works just fine.
2018-12-12Added support for debugging a sandboxed app on Mac (#21068)Oded Hanson1-1/+3
* Fixed bug in StackString where the size is not initialized correctly to STACK_COUNT * Added CharString and WCharString template classes and a generic CharStringFromLPCWSTR method * Added support for debugging a sandboxed app on Mac This change fixes the usage of IPC while debugging while running in a sandbox. When running in a sandbox, the temporary folder for each process will be different. Thus the pipes being created in TwoWayPipe right now would be created in different directories in the debugger process and the process being debugged. This change configures the folder to be used based on the application group ID that the sandboxed app belongs to. For the same reasons, the names sempahores being used to synchronize the debugger attach need to be prefixed with the application group ID. This change was abit more involved since the name of the semaphore is limited to 31 characters, so we had to encode the semaphore names differently to make them shorter. Last, new APIs to the debugger shim were added to support this new feature. This change only handles the runtime side and the dbgshim. An additional change to vsdbg needs to be done to use the new APIs. fixes #21066 * Fixed build breaks on non Mac Unix platforms * Fixed usage of gApplicationGroupId in non apple environments * Fixed bug in semaphore names * Got rid of usage of StackString * Made PAL_GetApplicationGroupId Apple specific * Added comment about pragma pack * Fixed comment * Added exported symbols * Duplicated applicationGroupId so it can be used from another thread during register complete callback * Renamed BitNum2ByteNum to GetExtraEncodedAreaSize to make intent clearer * Fixed nit comments * Removed redundant changes in StackString * Fixed windows build break * Fixed compilation switch from __APPLE to __APPLE__ * Added missing exports
2018-12-03Don't typedef intptr_t/uintptr_t when PAL_STDCPP_COMPAT is defined (#21165)Ilia1-0/+1
Bug: 20766
2018-11-28Move all the math functions undef #ifndef PAL_STDCPP_COMPAT (#21170)Ilia1-3/+3
Bug: 20786
2018-11-21Introduce Marshall.LoadLibrary API (#20871)Swaroop Sridhar1-3/+16
Implement Native LoadLibrary API This change commits the following changes: 1) Refactoring DllImport code to reuse LodLibrary by search for pInvoke and LoadLibrary cases 2) Implement the new Native Library API in System.Runtime.Interop.Marshall 3) Add tests for the new APIs
2018-11-12LoadLibrary refactoring (#20841)Swaroop Sridhar1-1/+6
* Refactor LoadLibrary Methods This change refactors the code in DllImport in preparation for implementing the new NativeLibrary API here: dotnet/corefx#32015 The two main changes are: 1) A change in the semantics of the internal LoadLibrary helper functions. When a native library is loaded, there are two categories of callers expecting different return values: External callers like AssemblyNative::InternalLoadUnmanagedDllFromPath() and the upcoming System.Runtime.Interop.Marshall.LoadLibrary() need the raw system handle Internal callers like LoadLibraryModule() need the PAL registered handle This change modifies the internal LoadLibraryModule* methods to work in terms of native system handles, so that external callers can obrain them directly. Methods requiring PAL-handles can register them explicitly. There is no change in external signature of DllImport class, or the native Dll cache in AppDomain class. 2) Differentiate HMODULE and NATIVE_LIBRARY_HANDLE This change defines NATIVE_LIBRARY_HANDLE type to represent raw system handles to native libraries that are not registered with the PAL (On Unix systems). The types on PAL and DlImport methods are adjusted to make this semantic distinction explicit. * Fix loading LibC via PAL_LoadLibraryDirect()
2018-11-06Loop-free GC rounding helpers with _BitScanReverse. (#20157)Jack Pappas1-0/+49
2018-11-06Added support for running in a sandbox on Mac (#20735)Oded Hanson1-0/+7
* Added support for running in a sandbox on Mac When running in a sandbox, the Mac operating system will limit access to resources, esp. the file system. Right now both Mutex and SharedMemory in the PAL are accessing the /tmp folder for which Mac does not provide the application permissions to access. Instead, the sandbox provides the ability to share information between applications by using a shared container folder. This is done by registering the application with an Application Group ID. Using this ID, we can access the shared folder and read/write from it. Since the .Net runtime can be loaded in multiple ways, we decided that the easiest way to let the runtime know what the application group ID is via an environment variable. Thus, if the NETCOREAPP_SANDBOX_APPLICATION_GROUP_ID environment variable is set (on Mac), the runtime will assume we are sandboxed, and will use the value provided as the application group ID. Note that due to limitations on semaphore file lengths, we will not allow application group IDs longer than 13 characters. This gives us 10 characters for the developer ID, and 3 extra characters for the group name. When sandbox is disabled (the environment variable is empty) then the folder for Mutex and SharedMemory will continue to be rooted in /tmp. However when the sandbox is enabled, these files will be created under /user/{loginname}/Library/Group Containers/{AppGroupId}/. Fixes #20473 * Made gApplicationContainerPath a pointer so it does not get automatically deleted by the c runtime * Made s_runtimeTempDirectoryPath and s_sharedMemoryDirectoryPath pointers so they are not automatically deleted by the c runtime * Renamed gApplicationContainerPath to gSharedFilesPath * Renamed NETCOREAPP_SANDBOX_APPLICATION_GROUP_ID to DOTNET_SANDBOX_APPLICATION_GROUP_ID * Fixed usage of VerifyStringOperation * Replaced new with InternalNew * Wrapped Apple specific code with #ifdef * Added exception handling during close * Moved VerifyStringOperation macro into SharedMemoryManager * Moved PathCharString variable declarations before AutoCleanup is declared. * Fixed initialization functions not to throw * Renamed CopyPath to BuildSharedFilesPath * Fixed misc nits * Fixed implicit conversions from BOOL to bool * Moved MAX_APPLICATION_GROUP_ID_LENGTH inside ifdef APPLE * Removed PAL_IsApplicationSandboxed
2018-11-05Adding some new functions to System.Math and System.MathF (#20788)Tanner Gooding1-1/+17
* Adding BitIncrement, BitDecrement, CopySign, MaxMagnitude, and MinMagnitude to Math and MathF * Adding FusedMultiplyAdd, IlogB, Log2, and ScaleB to Math and MathF * Adding some basic PAL tests for fma, ilogb, log2, and scalbn * Fixing a couple typos and adding clarifying comments * Fixing the MSVC _VVV FCALL declarations
2018-10-31Make BitScanForward/BitScanForward64 PAL wrappers branchless. (#20412)Jack Pappas1-23/+15
The BitScanForward/BitScanForward64 wrapper functions from the PAL and gcenv have been modified so they're faster (and branchless), while also adhering more closely to the behavior of the MSVC intrinsics. Use _BitScanForward64 when targeting 64-bit Windows. The _WIN32 macro is always defined by MSVC, even when targeting 64-bit versions of Windows. Use the _WIN64 macro instead to check whether the build is targeting 64-bit Windows, and if so, use the _BitScanForward64 intrinsic for the BitScanForward64 wrapper instead of the 32-bit-based fallback.
2018-10-07Remove mention of rotor from comments (#20297)Austin Wise1-6/+4
* Remove old reference to Rotor in documentation. All remaining references relate to rotor's role in CoreCLR history. * Remove rotor comment from enummem.cpp. I can find no evidence that the presence of g_pStressLog is conditional on FEATURE_PAL being defined. * Remove old todo, DbgDllMain looks for thread detach. * Update nativepipeline.h comment refernce to rotor. All unix-like systems except android have FEATURE_DBGIPC_TRANSPORT_DI defined, hence "most unix-like platforms". * Update some comments to not refer to Rotor. * Remove some more references to Rotor from comments. * Remove old comment. Though maybe this macro should be removed and everywhere use the & operator. It appears there are only two places that use this macro.
2018-09-20Removing BitScanReverse from pal.hTanner Gooding1-46/+0
2018-09-06Updating Number.Formatting to properly print -0Tanner Gooding1-0/+2
2018-08-28Break into debugger on assertion failures (#19702)Jan Kotas1-5/+4
* Break into debugger on assertion failures Assertion failures terminated the process by default that made them hard to debug. Changed them to break into debugger or trigger fail fast when the debugger is not attached. This should make the day-to-day CoreCLR developer experience better and it is simular to what we had on .NET Framework in the past. * Fix Unix build break Add RaiseFailFastException to Unix PAL
2018-08-16Determine memory load based on cgroup usage. (#19518)Tom Deseyn1-1/+1
cgroup usage is used to trigger oom kills. It includes rss and file cache of the cgroup. The implementation was only using the process rss to determine memory load. This is less than the cgroup usage and leads to oom kills due to GC not being triggered soon enough.
2018-08-14Code review feedback for the alternate stack changes (PR #19309). (#19476)Mike McLaughlin1-4/+2
Fixed SOS plugin for core dumps.
2018-08-06Only register signals and create alt exception stack in coreclr. (#19309)Mike McLaughlin1-5/+27
There was a couple of places where the DAC (IsValidObject, GetAppDomainForObject) assumed that a NULL target/debuggee address would throw an exception that would be caught by try/catch. Any other invalid address is handled with a software exception throwed by the read memory functions. In general it is a better overall design not to have any of the DBI/DAC, etc. code depend on hardware exceptions being caught. On Linux the C++ runtime sometimes can't handle it. There is a slight risk that there are other places in the DAC that make the NULL address assumption but testing so far has found any. Added PAL_SetInitializeDLLFlags as a fallback to allow the PAL_InitializeDLL flags to be set for a PAL instance for the DAC where we could still register h/w signals but not the altstack switching to reduce this risk. The flags can't be build time conditional because we only build one coreclrpal.a library that all the modules used. Having a PAL_InitializeFlags function doesn't really help either because of the PAL_RegisterModule call to PAL_IntializeDLL and the LoadLibrary dance/protocol that uses it to call the loading module's DLLMain. Add PAL_SetInitializeFlags; remove flags from PAL_INITIALIZE and PAL_INITIALIZE_DLL default. Add PAL_InitializeFlags() to allowing the default to be overriden.
2018-08-01Expose OSThreadId and TimeStamp on EventWrittenEventArgs (#19002)Brian Robbins1-0/+6
* Add EventWrittenEventArgs public properties OSThreadId and TimeStamp and plumb through OSThreadId. * Plumb ActivityId and RelatedActivityId to EventListener.
2018-07-12Add prefix to DAC's PAL exports for alpine (#18873)Mike McLaughlin1-5/+47
Added some cmake logic to create assembly include mapping files. One that maps the prefixed name (DAC_foo) to the actual name (foo) which is included in the DAC module and another that maps the actual name to the prefixed name that is included in the SOS, DBI and createdump modules. The data exports like IID_IUnknown are not prefixed and don't need to be (immutable static data). There were some C++ exports functions exported with their decorated names in the CatchHardwareExceptionHolder and NativeExceptionHolderBase classes. Created PAL_* style export functions that implements the code. Fix lldb plugin cmake file to use LLDB_H/LLDB_LIB env vars to build it.
2018-06-09Avoid NativeOverlapped pinning by allocating unmanaged memory for it (#18360)Jan Kotas1-1/+7
It makes PinnableBufferCache unnecessary
2018-04-16Enable support DllImport a native assembly whose name contains '.' (#17505)Luqun Lou1-3/+6