.
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
pub unsafe extern "C" fn __chkstk() {
|
pub unsafe extern "C" fn __chkstk() {
|
||||||
core::arch::asm!(
|
core::arch::asm!(
|
||||||
"push %rcx",
|
"push %rcx",
|
||||||
|
"push %rax",
|
||||||
"cmp $0x1000,%rax",
|
"cmp $0x1000,%rax",
|
||||||
"lea 16(%rsp),%rcx", // rsp before calling this routine -> rcx
|
"lea 24(%rsp),%rcx",
|
||||||
"jb 1f",
|
"jb 1f",
|
||||||
"2:",
|
"2:",
|
||||||
"sub $0x1000,%rcx",
|
"sub $0x1000,%rcx",
|
||||||
@@ -14,11 +15,8 @@ pub unsafe extern "C" fn __chkstk() {
|
|||||||
"1:",
|
"1:",
|
||||||
"sub %rax,%rcx",
|
"sub %rax,%rcx",
|
||||||
"test %rcx,(%rcx)",
|
"test %rcx,(%rcx)",
|
||||||
"lea 8(%rsp),%rax", // load pointer to the return address into rax
|
"pop %rax",
|
||||||
"mov %rcx,%rsp", // install the new top of stack pointer into rsp
|
"pop %rcx",
|
||||||
"mov -8(%rax),%rcx", // restore rcx
|
|
||||||
"push (%rax)", // push return address onto the stack
|
|
||||||
"sub %rsp,%rax", // restore the original value in rax
|
|
||||||
"ret",
|
"ret",
|
||||||
options(noreturn, att_syntax)
|
options(noreturn, att_syntax)
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user