-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FreeBSD Arm64 support #295
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
aaede83
Add FreeBSD Arm64 detection
3137b9c
Add FreeBSD Arm64 tests
5ebeac1
Add flagm, flagm2 and rng detection
4b16730
Add HWCAP FreeBSD AArch64
toor1245 c783f81
Update include to use linux hwcaps for powerpc
toor1245 2b7c47a
Add FreeBSD aarch64 impl
toor1245 befb237
Separate Hwacps to freebsd and linux implementation
d773ad7
Add aarch64 midr_el1 implementation
toor1245 31793e3
Add detection hwcap cpuid to hwcaps.h
toor1245 a21ff2c
Add MIDR_EL1 tests
toor1245 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef CPU_FEATURES_INCLUDE_CPUID_AARCH64_H_ | ||
#define CPU_FEATURES_INCLUDE_CPUID_AARCH64_H_ | ||
|
||
#include <stdint.h> | ||
|
||
#include "cpu_features_macros.h" | ||
|
||
CPU_FEATURES_START_CPP_NAMESPACE | ||
|
||
uint64_t GetMidrEl1(void); | ||
|
||
CPU_FEATURES_END_CPP_NAMESPACE | ||
|
||
#endif // CPU_FEATURES_INCLUDE_CPUID_AARCH64_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#include "cpu_features_macros.h" | ||
|
||
#ifdef CPU_FEATURES_OS_FREEBSD | ||
|
||
#include "internal/hwcaps.h" | ||
|
||
#ifdef CPU_FEATURES_TEST | ||
// In test mode, hwcaps_for_testing will define the following functions. | ||
HardwareCapabilities CpuFeatures_GetHardwareCapabilities(void); | ||
const char* CpuFeatures_GetPlatformPointer(void); | ||
const char* CpuFeatures_GetBasePlatformPointer(void); | ||
#else | ||
|
||
#ifdef HAVE_STRONG_ELF_AUX_INFO | ||
#include <stddef.h> | ||
#include <sys/auxv.h> | ||
|
||
static unsigned long GetElfHwcapFromElfAuxInfo(int hwcap_type) { | ||
unsigned long hwcap; | ||
elf_aux_info(hwcap_type, &hwcap, sizeof(hwcap)); | ||
return hwcap; | ||
} | ||
|
||
HardwareCapabilities CpuFeatures_GetHardwareCapabilities(void) { | ||
HardwareCapabilities capabilities; | ||
capabilities.hwcaps = GetElfHwcapFromElfAuxInfo(AT_HWCAP); | ||
capabilities.hwcaps2 = GetElfHwcapFromElfAuxInfo(AT_HWCAP2); | ||
return capabilities; | ||
} | ||
|
||
const char *CpuFeatures_GetPlatformPointer(void) { return NULL; } | ||
|
||
const char *CpuFeatures_GetBasePlatformPointer(void) { return NULL; } | ||
|
||
#else | ||
#error "FreeBSD needs support for elf_aux_info" | ||
#endif // HAVE_STRONG_ELF_AUX_INFO | ||
|
||
#endif // CPU_FEATURES_TEST | ||
#endif // CPU_FEATURES_OS_FREEBSD |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this may look weird that we have to provide this file and not use
@platforms//...
directly but this comes from the fact that we have internal definitions for these cpu/platforms that are different from upstream Bazel. I hope we'll be able to remove this technical debt one day.