Skip to content

Commit 3fb33a8

Browse files
committed
Update PAL to support Apple Silicon
- Some material brought in from PAL at github.com/dotnet/ - Various manual changes to fit with existing codebase - Updated licensing in edited files, latest PAL is copyright .dotNet - Updated copyright check scripts to check pal/ files for new text
1 parent cbb9b10 commit 3fb33a8

30 files changed

+2796
-3489
lines changed

THIRD-PARTY-NOTICES.txt

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
ChakraCore uses third party material from the projects listed below.
22
The original copyright notice and the license under which Microsoft
3-
received such third party material are set forth below. Microsoft
4-
reserves all other rights not expressly granted, whether by
3+
or the ChakraCore Project Contributors received such third party material
4+
are set forth below. Microsoft, and where relevant the ChakraCore Project
5+
Contributors reserve all other rights not expressly granted, whether by
56
implication, estoppel or otherwise.
67

78
In the event that we accidentally failed to list a required notice, please
8-
bring it to our attention. Post an issue or email us: [email protected]
9+
bring it to our attention. Post an issue or message us on discord.
910

1011
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
1112
Do Not Translate or Localize
1213

1314
ChakraCore incorporates third party material from the projects listed below.
14-
The original copyright notice and the license under which Microsoft received
15-
such third party material are set forth below. Microsoft reserves all other
16-
rights not expressly granted, whether by implication, estoppel or otherwise.
15+
The original copyright notice and the license under which Microsoft or the
16+
ChakraCore Project Contributors received such third party material are set
17+
forth below. Microsoft, and where relevant the ChakraCore Project Contributors
18+
reserve all other rights not expressly granted, whether by implication, estoppel or otherwise.
1719

1820
1. backbone.suggestions (https://github.com/qloo/backbone.suggestions)
1921
2. BeatDetektor.js
@@ -48,6 +50,7 @@ rights not expressly granted, whether by implication, estoppel or otherwise.
4850
31. yargs-parser.js (https://github.com/yargs/yargs-parser)
4951
32. camelcase.js (https://github.com/sindresorhus/camelcase)
5052
33. ARES-6 (https://github.com/WebKit/webkit/tree/master/PerformanceTests/ARES-6)
53+
34. PAL (from dotNet)
5154

5255
%% backbone.suggestions NOTICES, INFORMATION, AND LICENSE BEGIN HERE
5356
=========================================
@@ -2041,3 +2044,30 @@ END OF ARES-6 NOTICES, INFORMATION, AND LICENSE
20412044

20422045
---------------------------------------------
20432046

2047+
%% PAL NOTICES, INFORMATION AND LICENSE BEGIN HERE
2048+
=========================================
2049+
The MIT License (MIT)
2050+
2051+
Copyright (c) .NET Foundation and Contributors
2052+
2053+
All rights reserved.
2054+
2055+
Permission is hereby granted, free of charge, to any person obtaining a copy
2056+
of this software and associated documentation files (the "Software"), to deal
2057+
in the Software without restriction, including without limitation the rights
2058+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2059+
copies of the Software, and to permit persons to whom the Software is
2060+
furnished to do so, subject to the following conditions:
2061+
2062+
The above copyright notice and this permission notice shall be included in all
2063+
copies or substantial portions of the Software.
2064+
2065+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2066+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2067+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2068+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2069+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2070+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2071+
SOFTWARE.
2072+
=========================================
2073+
END OF PAL NOTICES, INFORMATION, AND LICENSE

pal/inc/cclock.hpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
//-------------------------------------------------------------------------------------------------------
2-
// Copyright (C) Microsoft. All rights reserved.
2+
// ChakraCore/Pal
3+
// Contains portions (c) copyright Microsoft, portions copyright (c) the .NET Foundation and Contributors
4+
// and edits (c) copyright the ChakraCore Contributors.
5+
// See THIRD-PARTY-NOTICES.txt in the project root for .NET Foundation license
36
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
47
//-------------------------------------------------------------------------------------------------------
58

69
#ifndef CC_PAL_INC_CCLOCK_H
710
#define CC_PAL_INC_CCLOCK_H
811

9-
class CCLock
12+
#if defined(_M_ARM64)
13+
#define CCLOCK_ALIGN __declspec(align(8))
14+
#else
15+
#define CCLOCK_ALIGN
16+
#endif
17+
18+
class CCLOCK_ALIGN CCLock
1019
{
1120
char mutexPtr[64]; // keep mutex implementation opaque to consumer (PAL vs non-PAL)
1221

pal/inc/pal.h

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
//
2-
// Copyright (c) Microsoft. All rights reserved.
3-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4-
//
5-
1+
//-------------------------------------------------------------------------------------------------------
2+
// ChakraCore/Pal
3+
// Contains portions (c) copyright Microsoft, portions copyright (c) the .NET Foundation and Contributors
4+
// and edits (c) copyright the ChakraCore Contributors.
5+
// See THIRD-PARTY-NOTICES.txt in the project root for .NET Foundation license
6+
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
7+
//-------------------------------------------------------------------------------------------------------
68
/*++
79
810
Module Name:
@@ -2907,6 +2909,7 @@ typedef struct _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY {
29072909

29082910
#define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x1L)
29092911
#define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x2L)
2912+
#define CONTEXT_SEGMENTS (CONTEXT_ARM64 | 0x4L)
29102913
#define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x4L)
29112914
#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x8L)
29122915

@@ -3190,6 +3193,8 @@ PALIMPORT BOOL PALAPI PAL_VirtualUnwindOutOfProc(CONTEXT *context,
31903193
#define PAL_CS_NATIVE_DATA_SIZE 76
31913194
#elif defined(__APPLE__) && defined(__x86_64__)
31923195
#define PAL_CS_NATIVE_DATA_SIZE 120
3196+
#elif defined(__APPLE__) && defined(_ARM64_)
3197+
#define PAL_CS_NATIVE_DATA_SIZE 120
31933198
#elif defined(__LINUX__) && defined(__i386__)
31943199
#define PAL_CS_NATIVE_DATA_SIZE 56
31953200
#elif defined(__LINUX__) && defined(__x86_64__)
@@ -4713,11 +4718,29 @@ enum {
47134718
//
47144719
// A function table entry is generated for each frame function.
47154720
//
4721+
#ifdef _M_ARM64
4722+
typedef struct _RUNTIME_FUNCTION {
4723+
DWORD BeginAddress;
4724+
union {
4725+
DWORD UnwindData;
4726+
struct {
4727+
DWORD Flag : 2;
4728+
DWORD FunctionLength : 11;
4729+
DWORD RegF : 3;
4730+
DWORD RegI : 4;
4731+
DWORD H : 1;
4732+
DWORD CR : 2;
4733+
DWORD FrameSize : 9;
4734+
};
4735+
};
4736+
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
4737+
#else
47164738
typedef struct _RUNTIME_FUNCTION {
47174739
DWORD BeginAddress;
47184740
DWORD EndAddress;
47194741
DWORD UnwindData;
47204742
} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
4743+
#endif
47214744

47224745
PALIMPORT
47234746
BOOL
@@ -5810,11 +5833,6 @@ RtlCaptureContext(
58105833
OUT PCONTEXT ContextRecord
58115834
);
58125835

5813-
PALIMPORT
5814-
VOID
5815-
PALAPI
5816-
FlushProcessWriteBuffers();
5817-
58185836
typedef void (*PAL_ActivationFunction)(CONTEXT *context);
58195837
typedef BOOL (*PAL_SafeActivationCheckFunction)(SIZE_T ip, BOOL checkingCurrentThread);
58205838

@@ -5825,13 +5843,6 @@ PAL_SetActivationFunction(
58255843
IN PAL_ActivationFunction pActivationFunction,
58265844
IN PAL_SafeActivationCheckFunction pSafeActivationCheckFunction);
58275845

5828-
PALIMPORT
5829-
BOOL
5830-
PALAPI
5831-
PAL_InjectActivation(
5832-
IN HANDLE hThread
5833-
);
5834-
58355846
#define VER_PLATFORM_WIN32_WINDOWS 1
58365847
#define VER_PLATFORM_WIN32_NT 2
58375848
#define VER_PLATFORM_UNIX 10

0 commit comments

Comments
 (0)