Skip to content

Commit ea4df65

Browse files
committed
Add support for Arm64EC
1 parent 7a3ff32 commit ea4df65

File tree

5 files changed

+71
-5
lines changed

5 files changed

+71
-5
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
rust_toolchain: [nightly, stable, 1.63.0]
22-
os: [ubuntu-latest, windows-latest, macOS-latest]
22+
os: [ubuntu-latest, windows-latest, macOS-latest, windows-11-arm]
2323
mode: ["--release", "-Zminimal-versions", ""]
2424
manifest: ["psm/Cargo.toml", "Cargo.toml"]
2525
exclude:
2626
- rust_toolchain: stable
2727
mode: -Zminimal-versions
2828
- rust_toolchain: 1.63.0
2929
mode: -Zminimal-versions
30+
include:
31+
- os: windows-latest
32+
extra_target: i686-pc-windows-msvc
33+
- os: windows-11-arm
34+
rust_toolchain: nightly
35+
extra_target: arm64ec-pc-windows-msvc
3036
timeout-minutes: 10
3137
steps:
3238
- uses: actions/checkout@v4
@@ -36,6 +42,7 @@ jobs:
3642
toolchain: ${{ matrix.rust_toolchain }}
3743
profile: minimal
3844
default: true
45+
target: ${{ matrix.extra_target }}
3946
- name: Test ${{ matrix.manifest}} with ${{ matrix.mode }}
4047
uses: actions-rs/cargo@v1
4148
with:
@@ -46,6 +53,18 @@ jobs:
4653
with:
4754
command: test
4855
args: --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture
56+
- if: ${{ matrix.extra_target }}
57+
name: Test ${{ matrix.manifest}} with ${{ matrix.mode }} as ${{ matrix.extra_target }}
58+
uses: actions-rs/cargo@v1
59+
with:
60+
command: test
61+
args: --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} -- --nocapture
62+
- if: ${{ matrix.extra_target }}
63+
name: Test ${{ matrix.manifest}} examples with ${{ matrix.mode }} as ${{ matrix.extra_target }}
64+
uses: actions-rs/cargo@v1
65+
with:
66+
command: test
67+
args: --target=${{ matrix.extra_target }} --manifest-path=${{ matrix.manifest }} ${{ matrix.mode }} --examples -- --nocapture
4968

5069
clang-cl-test:
5170
name: Test ${{ matrix.manifest }} on ${{ matrix.rust_target }} with ${{ matrix.clang_cl }}

Cargo.toml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "stacker"
3-
version = "0.1.21"
3+
version = "0.1.22"
44
edition = "2021"
55
rust-version = "1.63"
66
authors = ["Alex Crichton <[email protected]>", "Simonas Kazlauskas <[email protected]>"]
@@ -25,14 +25,22 @@ cfg-if = "1.0.0"
2525
libc = "0.2.156"
2626
psm = { path = "psm", version = "0.1.7" }
2727

28-
[target.'cfg(windows)'.dependencies.windows-sys]
28+
[target.'cfg(all(windows, not(target_arch = "arm64ec")))'.dependencies.windows-sys]
2929
version = ">=0.52.0, <0.60.0"
3030
features = [
3131
"Win32_System_Memory",
3232
"Win32_System_Threading",
3333
"Win32_Foundation",
3434
]
3535

36+
[target.arm64ec-pc-windows-msvc.dependencies.windows-sys]
37+
version = ">=0.59.0, <0.60.0"
38+
features = [
39+
"Win32_System_Memory",
40+
"Win32_System_Threading",
41+
"Win32_Foundation",
42+
]
43+
3644

3745
[build-dependencies]
38-
cc = "1.1.22"
46+
cc = "1.2.33"

psm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ readme = "README.mkd"
1414
[dependencies]
1515

1616
[build-dependencies]
17-
cc = "1.1.22"
17+
cc = "1.2.33"

psm/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn find_assembly(
2828
Some(("src/arch/x86_64_windows_gnu.s", false))
2929
}
3030
("arm", _, "windows", "msvc") => Some(("src/arch/arm_armasm.asm", false)),
31+
("arm64ec", _, "windows", "msvc") => Some(("src/arch/arm64ec_armasm.asm", false)),
3132
("aarch64", _, "windows", _) => {
3233
if masm {
3334
Some(("src/arch/aarch64_armasm.asm", false))

psm/src/arch/arm64ec_armasm.asm

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
AREA |.text|, CODE, READONLY
2+
3+
GLOBAL |#rust_psm_stack_direction|
4+
ALIGN 4
5+
|#rust_psm_stack_direction| PROC
6+
orr w0, wzr, #2
7+
ret
8+
ENDP
9+
10+
11+
GLOBAL |#rust_psm_stack_pointer|
12+
ALIGN 4
13+
|#rust_psm_stack_pointer| PROC
14+
mov x0, sp
15+
ret
16+
ENDP
17+
18+
19+
GLOBAL |#rust_psm_replace_stack|
20+
ALIGN 4
21+
|#rust_psm_replace_stack| PROC
22+
mov sp, x2
23+
br x1
24+
ENDP
25+
26+
GLOBAL |#rust_psm_on_stack|
27+
ALIGN 4
28+
|#rust_psm_on_stack| PROC
29+
stp x29, x30, [sp, #-16]!
30+
mov x29, sp
31+
mov sp, x3
32+
blr x2
33+
mov sp, x29
34+
ldp x29, x30, [sp], #16
35+
ret
36+
ENDP
37+
38+
END

0 commit comments

Comments
 (0)