Skip to content
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 initial support for ARM CPUs #200

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0796650
Add initial support for ARM CPUs
TheTumultuousUnicornOfDarkness Jun 10, 2024
f189611
Add CPU_FEATURE_AES to whitelist in check-consistency.py
TheTumultuousUnicornOfDarkness Jun 11, 2024
cc064be
CI: update macOS runners
TheTumultuousUnicornOfDarkness Jun 11, 2024
ced4168
Detect ARM CPUs topology
TheTumultuousUnicornOfDarkness Jun 11, 2024
40831eb
Detect ARM CPUs purpose
TheTumultuousUnicornOfDarkness Jun 15, 2024
ded8aa7
Add Armv8.1 architecture extension
TheTumultuousUnicornOfDarkness Jun 20, 2024
5e3b9fa
Add Armv8.2 architecture extension
TheTumultuousUnicornOfDarkness Jun 20, 2024
b967cea
Add Armv8.3 architecture extension
TheTumultuousUnicornOfDarkness Jun 21, 2024
b9882cc
Add Armv8.4 architecture extension
TheTumultuousUnicornOfDarkness Jun 21, 2024
5a4739a
Add Armv8.5 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
09c10f0
Add Armv8.6 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
bac7b0f
Add Armv8.7 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
be5dc9c
Add Armv8.8 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
23ed73b
Add Armv8.9 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
9cb87ff
Add Armv9.0 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
2fd3b24
Add Armv9.2 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
4d5e9ad
Add Armv9.3 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
0dd570f
Add Armv9.4 architecture extension
TheTumultuousUnicornOfDarkness Jun 22, 2024
7778d96
Detect ARM feature level
TheTumultuousUnicornOfDarkness Jun 23, 2024
dde56c7
Merge branch 'master' into arm_cpus
TheTumultuousUnicornOfDarkness Jun 24, 2024
4b7da42
Fix decode_arm_architecture_version()
TheTumultuousUnicornOfDarkness Jun 24, 2024
c2e8aa5
Move ARM specific fields to sub-struct in struct cpu_id_t
TheTumultuousUnicornOfDarkness Jun 24, 2024
76b306f
Move x86 specific fields to sub-struct in struct cpu_id_t
TheTumultuousUnicornOfDarkness Jun 25, 2024
9e17976
Add ARM fields to cpuid_tool
TheTumultuousUnicornOfDarkness Jun 26, 2024
09c2ba0
Add tests for ARM CPUs
TheTumultuousUnicornOfDarkness Jun 26, 2024
787d76a
utils: add script to parse ARM Architecture Reference Manual PDF file
TheTumultuousUnicornOfDarkness Jun 26, 2024
7abe55e
Fix detection for ARMv9-A CPUs
TheTumultuousUnicornOfDarkness Jun 26, 2024
21565a5
Add codenames for some ARM CPUs
TheTumultuousUnicornOfDarkness Jun 26, 2024
f5514f0
Fix run_tests.py for ARM CPUs
TheTumultuousUnicornOfDarkness Jun 26, 2024
7fca7c3
Set LIBCPUID_DEPRECATED macro to deprecate attributes
TheTumultuousUnicornOfDarkness Jun 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 24 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,36 +23,45 @@ jobs:
./configure
make dist
- name: Download macOS artifacts
- name: Download macOS x86_64 artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: unix.yml
commit: ${{ github.sha }}
name: macos
path: macos
name: macos-x86_64
path: macos-x86_64

- name: Download Windows (32-bit) artifacts
- name: Download macOS AArch64 artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: unix.yml
commit: ${{ github.sha }}
name: macos-aarch64
path: macos-aarch64

- name: Download Windows ix86 artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: windows.yml
commit: ${{ github.sha }}
name: win32
path: win32
name: windows-ix86
path: windows-ix86

- name: Download Windows (64-bit) artifacts
- name: Download Windows x86_64 artifacts
uses: dawidd6/action-download-artifact@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: windows.yml
commit: ${{ github.sha }}
name: win64
path: win64
name: window-x86_64
path: window-x86_64

- name: Compress artifacts
run: |
for dir in macos win32 win64; do
for dir in macos-* windows-*; do
zip -r "libcpuid-$VERSION-$dir.zip" "$dir"
done
env:
Expand All @@ -70,7 +79,8 @@ jobs:
As a convenience, the following binaries are provided:
- A source tarball;
- Build for 64-bit macOS (built under [macOS 14.X](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md));
- Build for 32-bit Windows, using MSVC XX.XX, in Debug, Release and Release DLL configurations (built under [Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md));
- Build for 64-bit Windows, using MSVC XX.XX, in Debug, Release and Release DLL configurations (built under [Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md)).
artifacts: "libcpuid-${{ env.VERSION }}.tar.gz,libcpuid-${{ env.VERSION }}-macos.zip,libcpuid-${{ env.VERSION }}-win32.zip,libcpuid-${{ env.VERSION }}-win64.zip"
- Build for x86_64 macOS (built under [macOS 13.X](https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md));
- Build for AArch64 macOS (built under [macOS 14.X](https://github.com/actions/runner-images/blob/main/images/macos/macos-14-Readme.md));
- Build for ix86 Windows, using MSVC XX.XX, in Debug, Release and Release DLL configurations (built under [Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md));
- Build for x86_64 Windows, using MSVC XX.XX, in Debug, Release and Release DLL configurations (built under [Windows Server 2022](https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md)).
artifacts: "libcpuid-${{ env.VERSION }}.tar.gz,libcpuid-${{ env.VERSION }}-macos-x86_64.zip,libcpuid-${{ env.VERSION }}-macos-aarch64.zip,libcpuid-${{ env.VERSION }}-windows-ix86.zip,libcpuid-${{ env.VERSION }}-window-x86_64.zip"
12 changes: 10 additions & 2 deletions .github/workflows/unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ jobs:
strategy:
matrix:
os:
- { label: macos-latest, name: macos }
- { label: ubuntu-latest, name: linux }
- { label: macos-latest, name: macos-aarch64 }
- { label: macos-13, name: macos-x86_64 }
- { label: ubuntu-latest, name: linux-x86_64 }
env:
OS_NAME: ${{ matrix.os.name }}

Expand All @@ -29,6 +30,13 @@ jobs:
- name: Build
run: cmake --build build

# - name: Run cpuid_tool
# run: |
# echo "RAW dump"
# ./build/cpuid_tool/cpuid_tool --save=-
# echo "Report"
# ./build/cpuid_tool/cpuid_tool --all

- name: Run tests
run: |
make -C build consistency
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
matrix:
config: [Debug, Release, ReleaseDLL]
platform:
- { bitness: x32, ms: Win32, name: win32 }
- { bitness: x64, ms: x64, name: win64 }
- { bitness: x32, ms: Win32, name: windows-ix86 }
- { bitness: x64, ms: x64, name: window-x86_64 }
env:
CONFIG: ${{ matrix.config }}
BITNESS: ${{ matrix.platform.bitness }}
Expand Down Expand Up @@ -73,8 +73,8 @@ jobs:
strategy:
matrix:
platform:
- win32
- win64
- windows-ix86
- window-x86_64

steps:
- name: Merge artifacts for ${{ matrix.platform }}
Expand Down
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ if(HAVE_POPCOUNT64)
add_definitions(-DHAVE_POPCOUNT64)
endif(HAVE_POPCOUNT64)

# check if auxiliary vector is available
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL)
if(HAVE_GETAUXVAL)
add_definitions(-DHAVE_GETAUXVAL)
endif(HAVE_GETAUXVAL)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
check_symbol_exists(elf_aux_info "sys/auxv.h" HAVE_ELF_AUX_INFO)
if(HAVE_ELF_AUX_INFO)
add_definitions(-DHAVE_ELF_AUX_INFO)
endif(HAVE_ELF_AUX_INFO)
endif()

# Global variables
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

Expand All @@ -42,7 +55,7 @@ if(UNIX)
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/lib")
set(includedir "\${prefix}/include")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wuninitialized -Wstrict-prototypes -Wformat -Wformat-security -Wunused-parameter")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wuninitialized -Wstrict-prototypes -Wformat -Wformat-security -Wunused-parameter -Wno-deprecated-declarations")
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/libcpuid.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/libcpuid.pc" ESCAPE_QUOTES
@ONLY)
install(FILES "${PROJECT_BINARY_DIR}/libcpuid.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
Expand Down
16 changes: 16 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ AC_CANONICAL_HOST
build_windows=no
build_netbsd=no
build_dragonflybsd=no
build_freebsd=no
build_linux=no

case "${host_os}" in
cygwin*|mingw*)
Expand All @@ -78,6 +80,12 @@ case "${host_os}" in
dragonfly*)
build_dragonflybsd=yes
;;
freebsd*)
build_freebsd=yes
;;
linux*)
build_linux=yes
;;
esac

if test "$build_windows" = "no"; then
Expand All @@ -88,6 +96,14 @@ if test "$build_netbsd" = "yes" || test "$build_dragonflybsd" = "yes"; then
AM_LDFLAGS="$AM_LDFLAGS -pthread"
fi

if test "$build_linux" = "yes"; then
AC_CHECK_FUNCS([getauxval])
fi

if test "$build_freebsd" = "yes"; then
AC_CHECK_FUNCS([elf_aux_info])
fi

AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])

AC_SUBST(AM_CPPFLAGS)
Expand Down
Loading