mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 00:26:57 +00:00
fix __chkstk on aarch64
This commit is contained in:
parent
19691c0b17
commit
f83a4b444c
@ -53,19 +53,6 @@ pub fn zig_probe_stack() callconv(.Naked) void {
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
if (comptime native_arch.isAARCH64()) {
|
||||
asm volatile (
|
||||
\\ lsl x16, x15, #4
|
||||
\\ mov x17, sp
|
||||
\\1:
|
||||
\\ sub x17, x17, #PAGE_SIZE
|
||||
\\ subs x16, x16, #PAGE_SIZE
|
||||
\\ ldr xzr, [x17]
|
||||
\\ b.gt 1b
|
||||
\\
|
||||
\\ ret
|
||||
);
|
||||
}
|
||||
|
||||
unreachable;
|
||||
}
|
||||
@ -118,6 +105,21 @@ fn win_probe_stack_only() void {
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
if (comptime native_arch.isAARCH64()) {
|
||||
// NOTE: page size hardcoded to 4096 for now
|
||||
asm volatile (
|
||||
\\ lsl x16, x15, #4
|
||||
\\ mov x17, sp
|
||||
\\1:
|
||||
\\
|
||||
\\ sub x17, x17, 4096
|
||||
\\ subs x16, x16, 4096
|
||||
\\ ldr xzr, [x17]
|
||||
\\ b.gt 1b
|
||||
\\
|
||||
\\ ret
|
||||
);
|
||||
}
|
||||
|
||||
unreachable;
|
||||
}
|
||||
@ -199,7 +201,9 @@ pub fn _chkstk() callconv(.Naked) void {
|
||||
}
|
||||
pub fn __chkstk() callconv(.Naked) void {
|
||||
@setRuntimeSafety(false);
|
||||
switch (native_arch) {
|
||||
if (comptime native_arch.isAARCH64()) {
|
||||
@call(.{ .modifier = .always_inline }, win_probe_stack_only, .{});
|
||||
} else switch (native_arch) {
|
||||
.i386 => @call(.{ .modifier = .always_inline }, win_probe_stack_adjust_sp, .{}),
|
||||
.x86_64 => @call(.{ .modifier = .always_inline }, win_probe_stack_only, .{}),
|
||||
else => unreachable,
|
||||
|
Loading…
Reference in New Issue
Block a user